-
Notifications
You must be signed in to change notification settings - Fork 283
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: Clean up world saving/loading codepath (Phase 1 of v2 save …
…format) (#5774) * fix: Add 'cataclysm-bn-tiles' and 'json_formatter' to .gitignore All the other binaries are listed except for the ones that cmake actually generates for tiles builds. Signed-off-by: David Li <jiawei.davidli@gmail.com> * refactor: Begin consolidating world loading Clean up and refactor worldfactory and world. * The old 'WORLD' struct is now renamed `WORLDINFO` to better reflect its actual purpose. * Get rid of the WORLDPTR = WORLD* convention. This isn't the Windows API, and nothing else does this. * Move file saving logic into a new class called `world`, meant to encapsulate the idea of a loaded world. I will begin consolidating more world loading logic into this class. Signed-off-by: David Li <jiawei.davidli@gmail.com> * refactor: Simplify file I/O utility methods Replace the 2 write and 6 read methods with 1 write and 2 read. This simplification is needed because future save loaders will need to provide their own implementations of these methods. * The `_optional` variants can be replaced with default arguments. * The `JsonDeserializer` variants are never used. * The `_json` variants do save some boilerplate (`path`) so I'll keep that in for now. Signed-off-by: David Li <jiawei.davidli@gmail.com> * refactor: Consolidate more world loading methods into `world` Player file IO is still janky, particularly `mm` files - WIP. However, the game does work and the on-disk format should be unchanged. Signed-off-by: David Li <jiawei.davidli@gmail.com> * refactor: Consolidate player-specific save IO Clean up how the game determines where to place player- specific files, in preparation for the V2 save format. NOTE: This removes backwards compatibility for the pre-2020 map memory ('mm') format. This logic only triggered when loading a map that has not seen a save event since 2020 - I think it's safe to remove this now. Signed-off-by: David Li <jiawei.davidli@gmail.com> * style(autofix.ci): automated formatting * fix: Forgot to migrate some code in non-tiles build Signed-off-by: David Li <jiawei.davidli@gmail.com> * fix: Bug in initializing world dir structure Signed-off-by: David Li <jiawei.davidli@gmail.com> * fix: Subtle change in write_to_file error handling The consolidation of write_to_file methods introduced a subtle API change where passing nullptr to the third argument no longer caused write_to_file to eat exceptions. This largely only affected tests and a small number of edge cases. Alter the API so that the right way to eat exceptions is via passing in the empty string as the message. Signed-off-by: David Li <jiawei.davidli@gmail.com> * refactor: Remember save format in the WORLDINFO struct Plus misc bug fixes Signed-off-by: David Li <jiawei.davidli@gmail.com> * refactor: Address code style and const in save refactor Signed-off-by: David Li <jiawei.davidli@gmail.com> --------- Signed-off-by: David Li <jiawei.davidli@gmail.com> Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
- Loading branch information
1 parent
7ccdf4b
commit 374bd34
Showing
44 changed files
with
921 additions
and
682 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.