Repository navigation
Conversation
…d#1465) Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
Fixes #1465.
GameGlobalInfo::reset()callssp::ecs::Entity::destroyAllEntities(). Each destroy runs the entity's LuaonDestroyedcallback. A callback that creates a ship during teardown gets a freed entity slot, so the new ship survives into the next scenario. As agreed in the issue thread, callbacks should not run while everything is being destroyed.Change:
OnDestroySystem::destroyAllEntities()sets a flag;destroyCallbackreturns early while it is set; it then callsEntity::destroyAllEntities().GameGlobalInfo::reset()andTutorialGame::finish()(repeated tutorial) call it instead ofEntity::destroyAllEntities().Note: the line in
reset()is also adjacent to the hunk in #2891; trivial conflict if both land.Test
Scenario: phase 1 makes 3 stations + a ship whose
onDestroyedspawns a ship calledLEAK, then callssetScenarioon itself; phase 2 counts objects andLEAKships. Variant B has the callback spawn 2 ships and logs each callback run. Windows build, headless, one run each.(Callback count: B logs "EE1465B spawn" per callback run: 1 before, 0 after. A: leak count equals runs.)
Stock scenarios (all 40
scenario_*.lua, Windows, headless): each run 10 s, thensetScenarioto a probe that counts objects. 35 completed the switch on both builds; same 5 did not on both (harness limits, not the change). All 35 end with 0 objects on this PR. On master,scenario_59_borderleaves 37 objects after the switch (this PR: 0), andscenario_30_brokenglass("attempt to index a nil value") andscenario_79_kessler("Attempted to set victory faction to Ghosts...") log errors raised during teardown (this PR: none). Pre-switch object counts vary run to run (unseeded).Not tested
TutorialGame::finish): compiled only, not run.onDestroyedcallback firing during scenario switch (behaviour change by design).2a58cad: same results (35 of 40 switched, all 35 end at 0 objects; the same 5 not covered).🤖 Generated with Claude Code