Fix: base .aslx file's own duplicate template names lose to the first, not the last#1843
Merged
Merged
Conversation
…, not the last Loading a bare .aslx (not a compiled .quest package - e.g. WasmPlayer's ?id= route, which fetches an unpacked .aslx via the textadventures.co.uk API) triggers GameLoader.ScanForTemplates, a preliminary pass that locks in the first value seen for each template name as an unoverridable "base template" so a later library file can't clobber a game's own override. Old Quest 5.8 desktop exports inline a full language pack directly in the base file instead of as a separate library (e.g. an English block followed by a German block, both defining the same template names), and the guard was blocking the later, correct definition from winning even though both come from the base file itself - silently keeping the earlier English text (e.g. "You are carrying" instead of "Du trägst"). AddTemplate's guard now only blocks a *non-base* (library) definition from overwriting a locked base template - a later base-template definition (i.e. still within the same base-file scan) is allowed to win, matching ordinary top-to-bottom XML semantics. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Summary
.aslx(not a compiled.questpackage — e.g. WasmPlayer's?id=route, which fetches an unpacked.aslxvia the textadventures.co.uk API instead of a.questzip) runsGameLoader.ScanForTemplates, a preliminary pass that locks in the first value seen for each template name as an unoverridable "base template", so a later library file can't clobber a game's own override.You are carryinginstead ofDu trägst).Template.AddTemplate's guard now only blocks a non-base (library) definition from overwriting a locked base template — a later base-template definition (still within the same base-file scan) is allowed to win, matching ordinary top-to-bottom XML semantics. This doesn't change the original protection (a library trying to override a game-defined template is still blocked).Test plan
tests/EngineTests/duplicatetemplatetest.aslx, a minimal bare.aslxfixture (no<include>d libraries) defining the same template name twice.TemplateTests.DuplicateTemplateInBaseAslxFile_LaterDefinitionWins, which loads that fixture and asserts the later definition wins.Expected: German value. Actual: English value) and passes with the fix.EngineTestssuite passes (273/273)..aslxthe same way WasmPlayer's?id=route does, confirmed the fix resolves it there too.🤖 Generated with Claude Code