Repository navigation
P3: Warn when +Use Template: is used on a ship class that already exists - #8075
Open
dustinspace217 wants to merge 1 commit into
Open
dustinspace217 wants to merge 1 commit into
dustinspace217 wants to merge 1 commit into
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 witherror_displayat 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
-noparseerrorsit 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/shiporcode/parsebetween them), with MediaVPs 5.0.3 and GOTY Missions 1.0.3: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.