fix(savegame): rebuild shroud grid on load to clear fog over own base#234
Closed
coolswood wants to merge 1 commit into
Closed
fix(savegame): rebuild shroud grid on load to clear fog over own base#234coolswood wants to merge 1 commit into
coolswood wants to merge 1 commit into
Conversation
After loading a save in Generals Challenge, fog of war crept over the player's own base within a few seconds: static structures never re-look, so when the restored undo-queue drained (~30 frames) their cells dropped to FOGGED and became unselectable gray ghosts. PartitionManager::loadPostProcess was an empty stub, so nothing re-applied object lookers after the per-cell counters and undo-queue were deserialized. Mirror the established TerrainLogic::setActiveBoundary rebuild: drain the queue, snapshot explored/permanently-revealed cells, reset the grid to the all-shrouded default, then re-look every object so each owns exactly one live looker. Also guard the challenge relationship-setup block against running on load. Tested: loading a challenge save no longer fogs the player's own base and buildings stay selectable.
Owner
|
Hey @coolswood thank for the PR. Could you please fix the build pipeline? thanks! |
Author
|
Looks like the macOS ZH build failed, but it's not the code — vcpkg couldn't download freetype from gitlab.freedesktop.org (HTTP 504 on all 3 retry attempts). The build never even got to compiling the game. The same change builds fine on the other jobs, including macOS Generals and Linux ZH, so this looks like a transient network issue with the GitLab mirror. Would someone with access mind re-running the failed job? Should go green once the mirror is back up. |
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.
Description
Fixes fog of war creeping over the player's own base after loading a save in Generals Challenge mode.
Symptom: After saving → loading a challenge save, fog of war covered the player's own buildings within ~5-10 seconds. The player's own structures became gray "previously seen" ghosts that could no longer be selected or controlled.
Root cause
After a save load,
PartitionManagerrestores the per-cell shroud counters (m_currentShroud) and the pending undo-queue from the file, but nothing re-applies object lookers —PartitionManager::loadPostProcess()was an empty stub.When the restored undo-queue drains (~
m_unlookPersistDuration= 30 frames later),removeLookerfires at each queued position. Static structures never re-look, so their cells drop toFOGGED(gray ghost / unselectable). The restoredm_partitionLastLookand the cell counters also disagree, so any laterhandleShroud()would double-count.A relationship-loss hypothesis was investigated first and disproved: brute-forcing all players to mutual ALLIES on load did not fix it, because relationships only matter inside
Object::look(), which is never called after load.Changes
GeneralsMD/Code/GameEngine/Source/GameLogic/Object/PartitionManager.cppImplemented
PartitionManager::loadPostProcess()(previously an empty stub) by mirroring the establishedTerrainLogic::setActiveBoundaryrebuild pattern:storeFoggedCellsfriend_prepareForMapBoundaryAdjust) so the laterunlook()/unshroud()are no-ops instead of double-undoesreset()+init())friend_notifyOfNewMapBoundary→ each object owns exactly one live looker)refreshShroudForLocalPlayer()After this the undo-queue is empty, every live object owns its looker, and static structures stay CLEAR permanently.
GeneralsMD/Code/GameEngine/Source/GameLogic/System/GameLogic.cppGuarded the challenge-mode relationship-setup block in
tryStartNewGame()withloadingSaveGame == FALSE, so it cannot overwrite serialized relationships on load.Verification
macos-vulkan), Zero Hour target00000062.sav, ~6.7 MB)restoreFoggedCellspreserves explored stateNotes