Skip to content

refactor(saveload): Decouple result handling from game state#3000

Open
bobtista wants to merge 2 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/saveload-result-ui
Open

refactor(saveload): Decouple result handling from game state#3000
bobtista wants to merge 2 commits into
TheSuperHackers:mainfrom
bobtista:bobtista/refactor/saveload-result-ui

Conversation

@bobtista

@bobtista bobtista commented Jul 22, 2026

Copy link
Copy Markdown

Fixes #2998

GameState::saveGame and GameState::loadGame present their results directly through TheInGameUI and MessageBoxOk. This couples save serialization to interactive client UI and prevents non-interactive callers from handling results themselves.

Now save and load functions only return SaveCode results, while GUI callers present the existing success and error messages. Save functions can also return the resolved filename when one is generated automatically.

Todo:

[] Test creating and overwriting a normal save
[x] Test successful and failed save loading
[] Test mission-save feedback
[x] Replicate to Generals

@bobtista bobtista self-assigned this Jul 22, 2026
@bobtista bobtista added the Refactor Edits the code with insignificant behavior changes, is never user facing label Jul 22, 2026
@greptile-apps

greptile-apps Bot commented Jul 22, 2026

Copy link
Copy Markdown

Greptile Summary

Refactors save/load result presentation out of GameState and into GUI-layer helpers.

  • Adds optional resolved-filename outputs for normal and mission saves.
  • Moves existing success and error feedback into SaveLoadFeedback.
  • Updates popup and score-screen callers in both game targets.
  • Registers the new helper files in both GameEngine builds.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failures remain.

Important Files Changed

Filename Overview
Generals/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp Removes direct UI presentation from persistence methods and returns structured save/load results with optional resolved filenames.
Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/SaveLoadFeedback.cpp Centralizes the existing GUI messages and dialogs associated with save/load result codes.
Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/PopupSaveLoad.cpp Captures save/load results and delegates their presentation to the new GUI helper.
Generals/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/Menus/ScoreScreen.cpp Presents mission-save results from the score-screen caller.
GeneralsMD/Code/GameEngine/Source/Common/System/SaveGame/GameState.cpp Mirrors the decoupled persistence result handling for Zero Hour.
GeneralsMD/Code/GameEngine/Source/GameClient/GUI/GUICallbacks/SaveLoadFeedback.cpp Mirrors the centralized save/load GUI feedback implementation for Zero Hour.

Reviews (2): Last reviewed commit: "refactor(saveload): Decouple result hand..." | Re-trigger Greptile

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Refactor Edits the code with insignificant behavior changes, is never user facing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GameState save and load functions present results through client UI

1 participant