CleverRaven / Cataclysm-DDA

Cataclysm - Dark Days Ahead. A turn-based survival game set in a post-apocalyptic world.
http://cataclysmdda.org
Other
9.95k stars 4.08k forks source link

Season Length option is bugged #74535

Open shadowonwhite opened 3 weeks ago

shadowonwhite commented 3 weeks ago

Describe the bug

setting Season Length to 14 will make the default start date for new game be within year 2

Attach save file

N/A

Steps to reproduce

  1. create world with Season Length set to 14
  2. create Custom Character inside the world

Expected behavior

makes starting date respect the option

Screenshots

No response

Versions and configuration

Additional context

No response

ZhilkinSerg commented 2 weeks ago
diff --git a/src/scenario.cpp b/src/scenario.cpp
index 02afd86acf8..ae6184c01fd 100644
--- a/src/scenario.cpp
+++ b/src/scenario.cpp
@@ -111,7 +111,7 @@ void scenario::load( const JsonObject &jo, const std::string_view )
     if( !was_loaded ) {

         int _start_of_cataclysm_hour = 0;
-        int _start_of_cataclysm_day = 61;
+        int _start_of_cataclysm_day = 1 + get_option<int>( "SEASON_LENGTH" ) / 3 * 2;
         season_type _start_of_cataclysm_season = SPRING;
         int _start_of_cataclysm_year = 1;
         if( jo.has_member( "start_of_cataclysm" ) ) {
@@ -129,7 +129,7 @@ void scenario::load( const JsonObject &jo, const std::string_view )
                                       ;

         int _start_of_game_hour = 8;
-        int _start_of_game_day = 61;
+        int _start_of_game_day = 1 + get_option<int>( "SEASON_LENGTH" ) / 3 * 2;