From 1f8e0a1cb4359342be9ab2e4293f7fa1d0a118a2 Mon Sep 17 00:00:00 2001 From: Anton Burmistrov Date: Fri, 25 Nov 2022 00:05:10 +0400 Subject: [PATCH] Eternal weather (#59707) * Set eternal weather on creating a world * Serialization stuff * Removed unneeded stuff * Replaced Sunny weather with Clear weather Also updated description. * Set eternal weather update in do_turn * Removed no longer needed debug menu Change weather option * Update debug_menu.h * WEATHER_NULL * Removed some more unneeded stuff * Returned back debug changing weather * Moved options from options.cpp to game_balance.json * Oops * Update data/core/game_balance.json --- data/core/game_balance.json | 7 +++++++ src/do_turn.cpp | 11 ++++++++++- src/main_menu.cpp | 7 +++++++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/data/core/game_balance.json b/data/core/game_balance.json index 71941491ace40..c90c6f2311de3 100644 --- a/data/core/game_balance.json +++ b/data/core/game_balance.json @@ -341,5 +341,12 @@ "info": "Determines frequency (in minutes) of displaying music description in sidebar when listening to MP3-players and the like.", "stype": "int", "value": 5 + }, + { + "type": "EXTERNAL_OPTION", + "name": "ETERNAL_WEATHER", + "info": "Sets eternal weather. Possible values are 'normal', 'clear', 'cloudy', 'light_drizzle', 'drizzle', 'rain', 'rainstorm', 'thunder', 'lightning', 'flurries', 'snowing', 'snowstorm', 'early_portal_storm', 'portal_storm'. 'normal' clears all eternal weather overrides and sets normal weather pattern. Requires restart of the game after changing value to take effect.", + "stype": "string_input", + "value": "normal" } ] diff --git a/src/do_turn.cpp b/src/do_turn.cpp index ed5b7454ce4e9..58c0cdddf03b1 100644 --- a/src/do_turn.cpp +++ b/src/do_turn.cpp @@ -599,7 +599,7 @@ bool do_turn() return turn_handler::cleanup_at_end(); } // Actual stuff - if( g-> new_game ) { + if( g->new_game ) { g->new_game = false; } else { g->gamemode->per_turn(); @@ -609,6 +609,15 @@ bool do_turn() play_music( music::get_music_id_string() ); weather_manager &weather = get_weather(); + if( get_option( "ETERNAL_WEATHER" ) != "normal" ) { + weather.weather_override = static_cast + ( get_option( "ETERNAL_WEATHER" ) ); + weather.set_nextweather( calendar::turn ); + } else { + weather.weather_override = WEATHER_NULL; + weather.set_nextweather( calendar::turn ); + } + // starting a new turn, clear out temperature cache weather.temperature_cache.clear(); diff --git a/src/main_menu.cpp b/src/main_menu.cpp index 0178e7a97e4fd..896ad922a509e 100644 --- a/src/main_menu.cpp +++ b/src/main_menu.cpp @@ -871,6 +871,13 @@ bool main_menu::opening_screen() } if( start && !load_game && get_scenario() ) { add_msg( get_scenario()->description( player_character.male ) ); + + if( get_option( "ETERNAL_WEATHER" ) != "normal" ) { + if( player_character.posz() >= 0 ) { + add_msg( _( "You feel as if this %1$s will last forever…" ), + get_options().get_option( "ETERNAL_WEATHER" ).getValueName() ); + } + } } return true; }