diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/json.cpp | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/editor/json.cpp b/editor/json.cpp index 7a64b207..f3317d5e 100644 --- a/editor/json.cpp +++ b/editor/json.cpp @@ -8,8 +8,15 @@ namespace floormat { -#define save_dir "../save" +#define FM_SAVE_BINARY + +#ifdef FM_SAVE_BINARY +#define quicksave_file save_dir "/" "quicksave.dat" +#else #define quicksave_file save_dir "/" "quicksave.json" +#endif + +#define save_dir "../save" #define quicksave_tmp quicksave_file ".tmp" namespace Path = Corrade::Utility::Path; @@ -35,7 +42,13 @@ void app::do_quicksave() if (Path::exists(quicksave_tmp)) Path::remove(quicksave_tmp); fputs("quicksave...", stderr); fflush(stderr); +#if 0 +#ifdef FM_SAVE_BINARY + json_helper::to_binary(world, quicksave_tmp); +#else json_helper::to_json(world, quicksave_tmp); +#endif +#endif Path::move(quicksave_tmp, quicksave_file); fputs(" done\n", stderr); fflush(stderr); } @@ -50,7 +63,13 @@ void app::do_quickload() } auto& world = M->world(); fputs("quickload...", stderr); fflush(stderr); +#if 0 +#ifdef FM_SAVE_BINARY + world = json_helper::from_binary<struct world>(quicksave_file); +#else world = json_helper::from_json<struct world>(quicksave_file); +#endif +#endif fputs(" done\n", stderr); fflush(stderr); } |