diff --git a/src/settings.cpp b/src/settings.cpp index bf4d460a78..6b34e2c46b 100644 --- a/src/settings.cpp +++ b/src/settings.cpp @@ -1252,17 +1252,17 @@ static void ChangeTimekeepingUnits(int32_t) InvalidateWindowClassesData(WC_GAME_OPTIONS, 0); - /* It is possible to change these units in Scenario Editor. We must set the economy date appropriately. */ - if (_game_mode == GM_EDITOR) { + /* It is possible to change these units in-game. We must set the economy date appropriately. */ + if (_game_mode != GM_MENU) { EconTime::Date new_economy_date; EconTime::DateFract new_economy_date_fract; if (EconTime::UsingWallclockUnits()) { - /* If the new mode is wallclock units, set the economy year back to 1. */ - new_economy_date = EconTime::DAYS_TILL_ORIGINAL_BASE_YEAR_WALLCLOCK_MODE; - new_economy_date_fract = 0; + /* If the new mode is wallclock units, adjust the economy date to account for different month/year lengths. */ + new_economy_date = EconTime::ConvertYMDToDate(EconTime::CurYear(), EconTime::CurMonth(), Clamp(EconTime::CurDay(), 1, EconTime::DAYS_IN_ECONOMY_WALLCLOCK_MONTH)); + new_economy_date_fract = EconTime::CurDateFract(); } else { - /* If the new mode is calendar units, sync the economy year with the calendar year. */ + /* If the new mode is calendar units, sync the economy date with the calendar date. */ new_economy_date = CalTime::CurDate().base(); new_economy_date_fract = CalTime::CurDateFract(); } diff --git a/src/table/settings/economy_settings.ini b/src/table/settings/economy_settings.ini index 04f7808c43..297399f957 100644 --- a/src/table/settings/economy_settings.ini +++ b/src/table/settings/economy_settings.ini @@ -715,7 +715,7 @@ cat = SC_BASIC [SDT_VAR] var = economy.timekeeping_units type = SLE_UINT8 -flags = SF_GUI_DROPDOWN | SF_NEWGAME_ONLY | SF_SCENEDIT_TOO +flags = SF_GUI_DROPDOWN def = TKU_CALENDAR min = TKU_CALENDAR max = TKU_WALLCLOCK