diff --git a/src/openrct2-ui/windows/Finances.cpp b/src/openrct2-ui/windows/Finances.cpp index f67694699d..15c7d9ddce 100644 --- a/src/openrct2-ui/windows/Finances.cpp +++ b/src/openrct2-ui/windows/Finances.cpp @@ -742,7 +742,7 @@ static void window_finances_summary_scrollpaint(rct_window* w, rct_drawpixelinfo } // Expenditure / Income values for each month - int16_t currentMonthYear = gDateMonthsElapsed; + int16_t currentMonthYear = static_cast(gDateMonthsElapsed); for (int32_t i = summary_max_available_month(); i >= 0; i--) { screenCoords.y = 0; diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index 6c6ffd5b03..ea570799f6 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -276,7 +276,7 @@ void GameState::UpdateLogic() #endif date_update(); - _date = Date(gDateMonthsElapsed, gDateMonthTicks); + _date = Date(static_cast(gDateMonthsElapsed), gDateMonthTicks); scenario_update(); climate_update(); diff --git a/src/openrct2/actions/RideCreateAction.hpp b/src/openrct2/actions/RideCreateAction.hpp index aff4cafc78..8fd31ed8e3 100644 --- a/src/openrct2/actions/RideCreateAction.hpp +++ b/src/openrct2/actions/RideCreateAction.hpp @@ -286,7 +286,7 @@ public: ride->num_riders = 0; ride->slide_in_use = 0; ride->maze_tiles = 0; - ride->build_date = static_cast(gDateMonthsElapsed); + ride->build_date = gDateMonthsElapsed; ride->music_tune_id = 255; ride->breakdown_reason = 255; diff --git a/src/openrct2/localisation/Date.h b/src/openrct2/localisation/Date.h index c21e72d25d..4f96c1a52a 100644 --- a/src/openrct2/localisation/Date.h +++ b/src/openrct2/localisation/Date.h @@ -48,7 +48,7 @@ extern const rct_string_id DateFormatStringIds[]; extern const rct_string_id DateFormatStringFormatIds[]; extern uint16_t gDateMonthTicks; -extern uint16_t gDateMonthsElapsed; +extern int32_t gDateMonthsElapsed; extern openrct2_timeofday gRealTimeOfDay; diff --git a/src/openrct2/localisation/Localisation.Date.cpp b/src/openrct2/localisation/Localisation.Date.cpp index 61d77bcbd5..a896ab4b1a 100644 --- a/src/openrct2/localisation/Localisation.Date.cpp +++ b/src/openrct2/localisation/Localisation.Date.cpp @@ -15,7 +15,7 @@ #include uint16_t gDateMonthTicks; -uint16_t gDateMonthsElapsed; +int32_t gDateMonthsElapsed; // rct2: 0x00993988 const int16_t days_in_month[MONTH_COUNT] = { 31, 30, 31, 30, 31, 31, 30, 31 }; diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index f4da9a7765..a22e6a3c9a 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -318,7 +318,7 @@ News::Item* News::AddItemToQueue(News::ItemType type, const utf8* text, uint32_t newsItem->Flags = 0; newsItem->Assoc = assoc; newsItem->Ticks = 0; - newsItem->MonthYear = gDateMonthsElapsed; + newsItem->MonthYear = static_cast(gDateMonthsElapsed); newsItem->Day = ((days_in_month[date_get_month(newsItem->MonthYear)] * gDateMonthTicks) >> 16) + 1; safe_strcpy(newsItem->Text, text, sizeof(newsItem->Text)); diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 0e9dd2f03f..be409da1f4 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2523,7 +2523,7 @@ private: // Date and srand gScenarioTicks = _s4.ticks; scenario_rand_seed(_s4.random_a, _s4.random_b); - gDateMonthsElapsed = _s4.month; + gDateMonthsElapsed = static_cast(_s4.month); gDateMonthTicks = _s4.day; // Park rating diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 2f54ce1996..42122d8efe 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -186,7 +186,7 @@ void S6Exporter::Export() } } - _s6.elapsed_months = gDateMonthsElapsed; + _s6.elapsed_months = static_cast(gDateMonthsElapsed); _s6.current_day = gDateMonthTicks; _s6.scenario_ticks = gScenarioTicks; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 0c91b61563..827be11249 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -216,7 +216,7 @@ public: safe_strcpy(gS6Info.details, _s6.info.details, sizeof(gS6Info.details)); } - gDateMonthsElapsed = _s6.elapsed_months; + gDateMonthsElapsed = static_cast(_s6.elapsed_months); gDateMonthTicks = _s6.current_day; gScenarioTicks = _s6.scenario_ticks; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index b654789286..a00ca9e787 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -280,7 +280,7 @@ size_t Ride::GetNumPrices() const int32_t Ride::GetAge() const { - return static_cast(gDateMonthsElapsed) - build_date; + return gDateMonthsElapsed - build_date; } int32_t Ride::GetTotalQueueLength() const @@ -932,7 +932,7 @@ void reset_all_ride_build_dates() { for (auto& ride : GetRideManager()) { - ride.build_date -= static_cast(gDateMonthsElapsed); + ride.build_date -= gDateMonthsElapsed; } } @@ -7114,7 +7114,7 @@ void Ride::Delete() void Ride::Renew() { // Set build date to current date (so the ride is brand new) - build_date = static_cast(gDateMonthsElapsed); + build_date = gDateMonthsElapsed; reliability = RIDE_INITIAL_RELIABILITY; } diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 3db779ebec..9bec767e34 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -715,7 +715,7 @@ static void scenario_objective_check_guests_by() { uint8_t objectiveYear = gScenarioObjectiveYear; int16_t parkRating = gParkRating; - int16_t currentMonthYear = gDateMonthsElapsed; + int32_t currentMonthYear = gDateMonthsElapsed; if (currentMonthYear == MONTH_COUNT * objectiveYear || gConfigGeneral.allow_early_completion) { @@ -733,7 +733,7 @@ static void scenario_objective_check_guests_by() static void scenario_objective_check_park_value_by() { uint8_t objectiveYear = gScenarioObjectiveYear; - int16_t currentMonthYear = gDateMonthsElapsed; + int32_t currentMonthYear = gDateMonthsElapsed; money32 objectiveParkValue = gScenarioObjectiveCurrency; money32 parkValue = gParkValue; diff --git a/src/openrct2/scripting/ScDate.hpp b/src/openrct2/scripting/ScDate.hpp index f746e7d6b9..227ec5ad75 100644 --- a/src/openrct2/scripting/ScDate.hpp +++ b/src/openrct2/scripting/ScDate.hpp @@ -37,16 +37,16 @@ namespace OpenRCT2::Scripting } private: - uint32_t monthsElapsed_get() const + int32_t monthsElapsed_get() const { const auto& date = GetDate(); return date.GetMonthsElapsed(); } - void monthsElapsed_set(uint32_t value) + void monthsElapsed_set(int32_t value) { ThrowIfGameStateNotMutable(); - gDateMonthsElapsed = value; + gDateMonthsElapsed = static_cast(value); } uint32_t monthProgress_get() const diff --git a/src/openrct2/world/Climate.cpp b/src/openrct2/world/Climate.cpp index 3d1243e2a5..d569f71300 100644 --- a/src/openrct2/world/Climate.cpp +++ b/src/openrct2/world/Climate.cpp @@ -258,7 +258,7 @@ static int8_t climate_step_weather_level(int8_t currentWeatherLevel, int8_t next */ static void climate_determine_future_weather(int32_t randomDistribution) { - int8_t month = date_get_month(gDateMonthsElapsed); + int32_t month = date_get_month(gDateMonthsElapsed); // Generate a random variable with values 0 up to DistributionSize-1 and chose weather from the distribution table // accordingly