From fef99a60315a17fb32c256a485ee931fea8768b3 Mon Sep 17 00:00:00 2001 From: Neil McGill Date: Sat, 12 Aug 2023 12:51:05 +0100 Subject: [PATCH] bug: fix monochrome on upgrading version --- build/VERSION | 2 +- src/game_load.cpp | 2 +- src/globals.cpp | 25 +++++++++++++++++++++++++ src/main.cpp | 2 ++ src/my_globals.hpp | 2 ++ 5 files changed, 31 insertions(+), 2 deletions(-) diff --git a/build/VERSION b/build/VERSION index 318f24aa8..3a8b61e95 100644 --- a/build/VERSION +++ b/build/VERSION @@ -1 +1 @@ -export MYVER="0.1.4" +export MYVER="0.1.5" diff --git a/src/game_load.cpp b/src/game_load.cpp index dbb3e99a3..954b0948c 100644 --- a/src/game_load.cpp +++ b/src/game_load.cpp @@ -1107,7 +1107,7 @@ std::istream &operator>>(std::istream &in, Bits< Config & > my) LOG("Read config: gfx_fullscreen_desktop = %d", my.t.gfx_fullscreen_desktop); LOG("Read config: gfx_fullscreen = %d", my.t.gfx_fullscreen); LOG("Read config: gfx_inverted = %d", my.t.gfx_inverted); - LOG("Read config: gfx_monochrome = %d", my.t.gfx_monochrome); + LOG("Read config: gfx_monochrome = %d", my.t.gfx_monochrome); LOG("Read config: gfx_show_hidden = %d", my.t.gfx_show_hidden); LOG("Read config: gfx_vsync_enable = %d", my.t.gfx_vsync_enable); LOG("Read config: g_opt_ascii = %d", g_opt_ascii); diff --git a/src/globals.cpp b/src/globals.cpp index 8c59b450d..3ac80e90c 100644 --- a/src/globals.cpp +++ b/src/globals.cpp @@ -74,3 +74,28 @@ int DUNGEON_GRID_CHUNK_HEIGHT; int DUNGEON_GRID_CHUNK_WIDTH; int g_last_logged_callframes_depth; + +void reset_globals(void) +{ + g_opt_ascii = false; + g_opt_ascii_override = false; + g_opt_biome_chasms = false; + g_opt_biome_flooded = false; + g_opt_biome_ice = false; + g_opt_biome_lava = false; + g_opt_biome_swamp = false; + g_opt_gfx_monochrome = false; + g_opt_no_slow_log_flush = false; + g_opt_override_debug_level = false; + g_opt_resume = false; + g_opt_silent = false; + g_opt_test_dungeon_gen = false; + g_opt_test_level_start = false; + g_opt_tests = false; + g_opt_test_save_load = false; + g_opt_test_skip_main_menu = false; + g_render_monochrome = false; + g_opt_debug1 = false; + g_opt_debug2 = false; + g_opt_debug3 = false; +} diff --git a/src/main.cpp b/src/main.cpp index c685b173f..34f709025 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -837,11 +837,13 @@ int main(int argc, char *argv[]) game->config.version.c_str(), version.c_str()); delete game; game = new Game(std::string(appdata)); + reset_globals(); game->save_config(); g_errored = false; } else if (! config_error.empty()) { SDL_MSG_BOX("Config error: %s. Will need to reset config.", config_error.c_str()); delete game; + reset_globals(); game = new Game(std::string(appdata)); game->save_config(); g_errored = false; diff --git a/src/my_globals.hpp b/src/my_globals.hpp index 51e84792b..c092514ee 100644 --- a/src/my_globals.hpp +++ b/src/my_globals.hpp @@ -135,4 +135,6 @@ extern int g_last_logged_callframes_depth; #define MY_STDERR (g_log_stderr ? g_log_stderr : stderr) #define MY_STDOUT (g_log_stdout ? g_log_stdout : stdout) +void reset_globals(void); + #endif