Skip to content

Accept saves taken while a unit is entering a building - #143

Closed
Giszmo wants to merge 1 commit into
masterfrom
junior/fix-save-unit-entering-building
Closed

Accept saves taken while a unit is entering a building#143
Giszmo wants to merge 1 commit into
masterfrom
junior/fix-save-unit-entering-building

Conversation

@Giszmo

@Giszmo Giszmo commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Cherry-picked bugfix from PR #132 (fix/fullscreen-scaling), split out to shrink #132/#129's diff against master per Leo's request.

A unit on its final step into a building (displacement DIS_ENTERING_BUILDING) already carries the building's position, but the integrity check rejected the save as invalid, so games with a unit in that exact state failed to load.

Original commit: 9f48906

A unit on its final step into a building (displacement
DIS_ENTERING_BUILDING) already carries the building's position, but by
design it stays registered on the map cell it came from until it is
inside; UnitDisplacement.cpp clears (posX-dx, posY-dy) at that point.
Game::load's air-unit invariant demanded that every registered cell
equal the unit's position, so a save written during those few ticks was
rejected as corrupt for good. Any game with an explorer heading into an
inn could hit it, and Leo's FourSquares1 save did (explorer at 78,66,
dx=1, registered at 77,66).

Compare against the cell the unit is expected to occupy in that state
instead. Verified: the rejected save loads and runs headless; a fresh
save still loads.
genixpro
genixpro previously approved these changes Sep 6, 2026

@genixpro genixpro left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed the focused diff and validated it against current master. The combined set applies cleanly after the five already merged fixes and builds successfully on macOS arm64; this PR has green Ubuntu 22.04, Ubuntu 24.04, and Windows CI.

@genixpro
genixpro dismissed their stale review September 6, 2026 01:14

Superseding provisional compile-only approval while behavior-focused testing is completed.

@genixpro

genixpro commented Sep 6, 2026

Copy link
Copy Markdown
Contributor

Current already contains the entering-building integrity handling in . The old branch conflicts because the implementation was split during the refactor. This PR is superseded on current master.

@kylelutze

Copy link
Copy Markdown
Contributor

Already on master — landed with the #132 merge (86d0398); the check moved from Game.cpp to Game_io.cpp, hence the conflict here.

@kylelutze kylelutze closed this Sep 6, 2026
@kylelutze
kylelutze deleted the junior/fix-save-unit-entering-building branch September 6, 2026 03:11
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.

3 participants