diff --git a/distribution/changelog.txt b/distribution/changelog.txt index cb118e6646..634b9f7ea3 100644 --- a/distribution/changelog.txt +++ b/distribution/changelog.txt @@ -4,6 +4,7 @@ - Fix: [#12694] Crash when switching ride types with construction window open. - Fix: [#12701] Silent NSIS setup flag /S isn't silent, upgrade pop-up appears anyway. - Fix: [#12737] Space Rings draw the same vehicle 4 times. +- Fix: [#12764] Rides don't start aged anymore. - Fix: Incomplete loop collision box allowed overlapping track (original bug). 0.3.0 (2020-08-15) 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/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/network/NetworkBase.cpp b/src/openrct2/network/NetworkBase.cpp index f7b6ff3ea4..723ea828b6 100644 --- a/src/openrct2/network/NetworkBase.cpp +++ b/src/openrct2/network/NetworkBase.cpp @@ -33,7 +33,7 @@ // This string specifies which version of network stream current build uses. // It is used for making sure only compatible builds get connected, even within // single OpenRCT2 version. -#define NETWORK_STREAM_VERSION "1" +#define NETWORK_STREAM_VERSION "2" #define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION static Peep* _pickup_peep = nullptr; diff --git a/src/openrct2/rct1/RCT1.h b/src/openrct2/rct1/RCT1.h index d609e6d7fe..f4e4888c23 100644 --- a/src/openrct2/rct1/RCT1.h +++ b/src/openrct2/rct1/RCT1.h @@ -176,7 +176,7 @@ struct rct1_ride uint8_t pad_11F[0x7]; // 0x11F uint8_t spiral_slide_progress; // 0x126 uint8_t pad_127[0x9]; // 0x127 - uint16_t build_date; // 0x130 + int16_t build_date; // 0x130 money16 upkeep_cost; // 0x131 uint16_t race_winner; // 0x132 uint8_t unk_134[2]; // 0x134 diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 8c0b1788c0..be409da1f4 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -875,7 +875,7 @@ private: SetRideColourScheme(dst, src); // Maintenance - dst->build_date = src->build_date; + dst->build_date = static_cast(src->build_date); dst->inspection_interval = src->inspection_interval; dst->last_inspection = src->last_inspection; dst->reliability = src->reliability; @@ -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/RCT2.h b/src/openrct2/rct2/RCT2.h index 1e2c4dfa1a..59505c810d 100644 --- a/src/openrct2/rct2/RCT2.h +++ b/src/openrct2/rct2/RCT2.h @@ -256,7 +256,7 @@ struct rct2_ride uint8_t pad_16F[0x7]; // 0x16F uint8_t spiral_slide_progress; // 0x176 uint8_t pad_177[0x9]; // 0x177 - uint16_t build_date; // 0x180 + int16_t build_date; // 0x180 money16 upkeep_cost; // 0x182 uint16_t race_winner; // 0x184 uint8_t pad_186[0x02]; // 0x186 diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 012eb760a6..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; @@ -703,7 +703,7 @@ void S6Exporter::ExportRide(rct2_ride* dst, const Ride* src) // pad_16F[0x7]; dst->spiral_slide_progress = src->spiral_slide_progress; // pad_177[0x9]; - dst->build_date = src->build_date; + dst->build_date = static_cast(src->build_date); dst->upkeep_cost = src->upkeep_cost; dst->race_winner = src->race_winner; // pad_186[0x02]; diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 3763133dde..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; @@ -718,7 +718,7 @@ public: // pad_16F[0x7]; dst->spiral_slide_progress = src->spiral_slide_progress; // pad_177[0x9]; - dst->build_date = src->build_date; + dst->build_date = static_cast(src->build_date); dst->upkeep_cost = src->upkeep_cost; dst->race_winner = src->race_winner; // pad_186[0x02]; diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 1e9bce0ee0..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 = gDateMonthsElapsed; + ride.build_date -= gDateMonthsElapsed; } } diff --git a/src/openrct2/ride/Ride.h b/src/openrct2/ride/Ride.h index 69bd99ff06..8b2e09f663 100644 --- a/src/openrct2/ride/Ride.h +++ b/src/openrct2/ride/Ride.h @@ -306,7 +306,7 @@ struct Ride }; uint8_t slide_peep_t_shirt_colour; uint8_t spiral_slide_progress; - uint16_t build_date; + int32_t build_date; money16 upkeep_cost; uint16_t race_winner; uint32_t music_position; 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/scripting/ScRide.hpp b/src/openrct2/scripting/ScRide.hpp index 1ec513eef3..88a357fe66 100644 --- a/src/openrct2/scripting/ScRide.hpp +++ b/src/openrct2/scripting/ScRide.hpp @@ -546,12 +546,12 @@ namespace OpenRCT2::Scripting } } - int16_t buildDate_get() const + int32_t buildDate_get() const { auto ride = GetRide(); return ride != nullptr ? ride->build_date : 0; } - void buildDate_set(int16_t value) + void buildDate_set(int32_t value) { ThrowIfGameStateNotMutable(); auto ride = GetRide(); 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