Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start centralizing all save related data in GameState_t #21122

Merged
merged 7 commits into from
Jan 19, 2024

Conversation

ZehMatt
Copy link
Member

@ZehMatt ZehMatt commented Dec 27, 2023

I took the initiative to start the process of moving everything into a central place that is relevant to the save file. This is also how its done in OpenLoco, we need to move all the globals and everything that is going to be saved/loaded into the new struct GameState_t. I avoided touching the existing GameState class as that would end up in more refactor work, once we moved all the things we can look into cleaning up the game loop and get rid of the current GameState thing. There should be as little OOP usage as possible which also makes this struct trivial to copy then. After we have this done we can actually have save/load done in a separate thread and also have an in-game indicator that some work is done without halting the entire game. Moving all the globals and relevant things will be quite a bit of work but this is the only way forward. Also having this a separate state allows to load multiple parks at some point and potentially re-use the format for blueprints/new track format, it also makes the entire track format preview less painful by having a separate state for that.

I started with the first variable gCurrentTicks and layed out the groundworks for the import/export code, now we just need to shove more into it.

@Gymnasiast
Copy link
Member

It would probably be good if you create a project for this (I’m just assuming this won’t be a small job.)

@ZehMatt
Copy link
Member Author

ZehMatt commented Dec 28, 2023

It would probably be good if you create a project for this (I’m just assuming this won’t be a small job.)

Hm maybe, it's mostly moving globals into the struct, I'll have a look in the next couple days once I have a bit of time.

@Gymnasiast Gymnasiast modified the milestone: After v0.4.7 Dec 29, 2023
@ZehMatt
Copy link
Member Author

ZehMatt commented Jan 13, 2024

Created the issue for this #21193

Copy link
Member

@Broxzier Broxzier left a comment

Choose a reason for hiding this comment

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

Code LGTM. I haven't tested this in-game, but from the changes there shouldn't be any logic changes anyway.

src/openrct2-ui/scripting/ScTitleSequence.hpp Show resolved Hide resolved
src/openrct2-ui/title/TitleSequencePlayer.cpp Show resolved Hide resolved
src/openrct2-ui/title/TitleSequencePlayer.cpp Show resolved Hide resolved
src/openrct2/GameState.h Outdated Show resolved Hide resolved
@ZehMatt ZehMatt merged commit d08612b into OpenRCT2:develop Jan 19, 2024
22 checks passed
@ZehMatt ZehMatt deleted the gamestate branch January 19, 2024 23:12
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.

None yet

3 participants