Closed secsome closed 3 months ago
The changes enhance the game state management in TActionExt
by introducing a static member variable to track pending save actions. The SaveGame
method is streamlined to reset this variable and prepare a description for saving, while a new hook function manages the saving process and user notifications. These modifications improve the efficiency and clarity of game saving functionalities.
Files | Change Summary |
---|---|
src/Ext/TAction/Body.cpp , src/Ext/TAction/Body.h |
Added a static member PendingSaveGameByTrigger in TActionExt , managing save game states more effectively. |
src/Ext/TAction/Hooks.cpp |
Introduced Main_Loop_ProcessTActionPendingSaveGame , handling save state actions and user notifications. |
sequenceDiagram
participant User
participant TActionExt
participant ScenarioClass
User->>TActionExt: Trigger Save Game
TActionExt->>TActionExt: Reset PendingSaveGameByTrigger
TActionExt->>TActionExt: Build save description
TActionExt->>ScenarioClass: SaveGame(description)
ScenarioClass-->>TActionExt: Save successful
TActionExt->>User: Notify success
🐇 In fields of code, I hop and play,
New save actions brighten the day,
With every save, a tale to weave,
In game worlds, we dare to believe!
🌟✨
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?
The old implementation for this TAction has a bug which will break the trigger use it after you load the save.
Here is an example to reproduce:
Time Elapsed...
5 secondsDisable Trigger
itself andSaveGame
You will find out this SaveGame trigger will only be executed at the first time, that's because we implemented this SaveGame trigger while executing the trigger, which will save the status of trigger immediately. The proper implementation is make this save request pending, and do it at the beginning of next game frame so no unfinished game objects will be affected.
Summary by CodeRabbit