Skip to content

Commit

Permalink
bug: fix monochrome on upgrading version
Browse files Browse the repository at this point in the history
  • Loading branch information
goblinhack committed Aug 12, 2023
1 parent 3d39d10 commit fef99a6
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 2 deletions.
2 changes: 1 addition & 1 deletion build/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export MYVER="0.1.4"
export MYVER="0.1.5"
2 changes: 1 addition & 1 deletion src/game_load.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
25 changes: 25 additions & 0 deletions src/globals.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 2 additions & 0 deletions src/my_globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit fef99a6

Please sign in to comment.