Skip to content

P3: Warn when +Use Template: is used on a ship class that already exists - #8075

Open
dustinspace217 wants to merge 1 commit into
scp-fs2open:masterfrom
dustinspace217:ship/template-on-existing-class
Open

dustinspace217 wants to merge 1 commit into
scp-fs2open:masterfrom
dustinspace217:ship/template-on-existing-class

Conversation

@dustinspace217

Copy link
Copy Markdown
Contributor

What?

Fixes #3542

When a ship entry in a modular table uses +Use Template: on a class that already exists, the game now warns at table load, naming the class and the template. The template is still applied, same as before.

Why?

A ship template is a complete ship entry, so using one on an existing class replaces the whole class, not just the values the template sets. In the report, a modder wanted to stamp a few tweaks (glide, banking) over the retail ships. The tables load with no complaint, the GTF Ulysses ends up with no model, and the game stops only when a mission creates the ship: "Cannot create ship GTF Ulysses; pof file is not valid". Nothing in that message points back at the table.

How?

In parse_ship, when +Use Template: finds its template and the class already exists, I report it with error_display at its release-level warning, so it carries the table file and line. The message ends with how to do what the modder probably wanted: list the values without +Use Template:. I kept the existing behavior so any mod that relies on it keeps working.

In release builds this is a popup at load, one per affected class, like other release-level table warnings. With -noparseerrors it falls back to a debug-only warning.

Testing?

Linux, OpenGL. Branch commit fee6a91 (Release and Debug) against master 94d278a (Release) and its parent f0d45f6 (Debug; no changes to code/ship or code/parse between them), with MediaVPs 5.0.3 and GOTY Missions 1.0.3:

  • The issue's two .tbm files: the branch warns in Release and Debug, naming GTF Ulysses, WM GTF, the file and the line. Master says nothing.
  • A new class made from the same template: no warning.
  • Retail with no mods: SM1-01 boots into gameplay with no warnings.
  • Blue Planet: Chanticleer 5.0.6 (with Complete 3.3.3 and MediaVPs 4.7.3), a released mod with big ship tables: no new warning in Release or Debug.

An earlier build of this change with a shorter message (e5e48760c) also showed that UlyTest still stops with the same pof error as master, and that MediaVPs 5.0.3 + GOTY Missions load SM1-01 with no new warnings.

I didn't run Vulkan: the change only runs during table parsing and draws nothing.

Anything Else?

I used Claude Code to help write and test this.

A ship template is a complete ship entry, so applying one in a modular
table to a class that is already defined replaces the whole class, not
only the values the template sets. The class can lose its model, and
nothing said so until a mission tried to create the ship. Show a
warning at table load, in release builds too, naming the class and the
template. The template is still applied as before.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Applying templates to ships in modular tables creates hard crash on mission launch

1 participant