Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
ENGINES: Savegame code simplifications #2037
This pull request aims to simply provide some simplification and improvements for the savegame code, particularly going forward for new engines added in the future. It consists of:
So, to combat this, I've added several new methods to the base Engine class, and changed the implementation of loadGameState and saveGameState. First of all, this shouldn't affect any of the existing engines, since they all override loadGameState and saveGameState, so they'll remain unaffected. When not overridden, the assumption is that new engines will be using the new extended savegame code. The loadGameState and saveGameState methods now contain the code for:
Speaking of autosaves, I think this is something that should really be considered for being moved into the core as well. My latest commit added autosave support for Griffon, but it occurred to me that that's somewhat inefficient. Currently, not even a quarter of the engines call the "shouldPerformAutoSave" method. I was thinking maybe we could do the checks in the events managers - it could access the global engine pointer to call the method as well as canSaveGameStateCurrently, and maintain the last autosave time. That way, we could do away with engines having to do it themselves. Thoughts?
This is primarily future-proofing. Many games either show a message or do some other UI action like closing an open game menu, and obviously that should only be done when a savegame created by the user is done, rather than for regular autosaves. By making this a flag, when engines override saveGameStream, they'll be able to tell if it's an autosave, and only do UI changes if not