1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2025-12-19 13:52:54 +01:00

Change gDateMonthsElapsed type to int32_t

This commit is contained in:
Tulio Leao
2020-08-25 19:06:38 -03:00
parent 10aca0fe6e
commit efdb7e1a2d
13 changed files with 18 additions and 18 deletions

View File

@@ -742,7 +742,7 @@ static void window_finances_summary_scrollpaint(rct_window* w, rct_drawpixelinfo
} }
// Expenditure / Income values for each month // Expenditure / Income values for each month
int16_t currentMonthYear = gDateMonthsElapsed; int16_t currentMonthYear = static_cast<int16_t>(gDateMonthsElapsed);
for (int32_t i = summary_max_available_month(); i >= 0; i--) for (int32_t i = summary_max_available_month(); i >= 0; i--)
{ {
screenCoords.y = 0; screenCoords.y = 0;

View File

@@ -276,7 +276,7 @@ void GameState::UpdateLogic()
#endif #endif
date_update(); date_update();
_date = Date(gDateMonthsElapsed, gDateMonthTicks); _date = Date(static_cast<uint32_t>(gDateMonthsElapsed), gDateMonthTicks);
scenario_update(); scenario_update();
climate_update(); climate_update();

View File

@@ -286,7 +286,7 @@ public:
ride->num_riders = 0; ride->num_riders = 0;
ride->slide_in_use = 0; ride->slide_in_use = 0;
ride->maze_tiles = 0; ride->maze_tiles = 0;
ride->build_date = static_cast<int32_t>(gDateMonthsElapsed); ride->build_date = gDateMonthsElapsed;
ride->music_tune_id = 255; ride->music_tune_id = 255;
ride->breakdown_reason = 255; ride->breakdown_reason = 255;

View File

@@ -48,7 +48,7 @@ extern const rct_string_id DateFormatStringIds[];
extern const rct_string_id DateFormatStringFormatIds[]; extern const rct_string_id DateFormatStringFormatIds[];
extern uint16_t gDateMonthTicks; extern uint16_t gDateMonthTicks;
extern uint16_t gDateMonthsElapsed; extern int32_t gDateMonthsElapsed;
extern openrct2_timeofday gRealTimeOfDay; extern openrct2_timeofday gRealTimeOfDay;

View File

@@ -15,7 +15,7 @@
#include <time.h> #include <time.h>
uint16_t gDateMonthTicks; uint16_t gDateMonthTicks;
uint16_t gDateMonthsElapsed; int32_t gDateMonthsElapsed;
// rct2: 0x00993988 // rct2: 0x00993988
const int16_t days_in_month[MONTH_COUNT] = { 31, 30, 31, 30, 31, 31, 30, 31 }; const int16_t days_in_month[MONTH_COUNT] = { 31, 30, 31, 30, 31, 31, 30, 31 };

View File

@@ -318,7 +318,7 @@ News::Item* News::AddItemToQueue(News::ItemType type, const utf8* text, uint32_t
newsItem->Flags = 0; newsItem->Flags = 0;
newsItem->Assoc = assoc; newsItem->Assoc = assoc;
newsItem->Ticks = 0; newsItem->Ticks = 0;
newsItem->MonthYear = gDateMonthsElapsed; newsItem->MonthYear = static_cast<uint16_t>(gDateMonthsElapsed);
newsItem->Day = ((days_in_month[date_get_month(newsItem->MonthYear)] * gDateMonthTicks) >> 16) + 1; newsItem->Day = ((days_in_month[date_get_month(newsItem->MonthYear)] * gDateMonthTicks) >> 16) + 1;
safe_strcpy(newsItem->Text, text, sizeof(newsItem->Text)); safe_strcpy(newsItem->Text, text, sizeof(newsItem->Text));

View File

@@ -2523,7 +2523,7 @@ private:
// Date and srand // Date and srand
gScenarioTicks = _s4.ticks; gScenarioTicks = _s4.ticks;
scenario_rand_seed(_s4.random_a, _s4.random_b); scenario_rand_seed(_s4.random_a, _s4.random_b);
gDateMonthsElapsed = _s4.month; gDateMonthsElapsed = static_cast<int32_t>(_s4.month);
gDateMonthTicks = _s4.day; gDateMonthTicks = _s4.day;
// Park rating // Park rating

View File

@@ -186,7 +186,7 @@ void S6Exporter::Export()
} }
} }
_s6.elapsed_months = gDateMonthsElapsed; _s6.elapsed_months = static_cast<uint16_t>(gDateMonthsElapsed);
_s6.current_day = gDateMonthTicks; _s6.current_day = gDateMonthTicks;
_s6.scenario_ticks = gScenarioTicks; _s6.scenario_ticks = gScenarioTicks;

View File

@@ -216,7 +216,7 @@ public:
safe_strcpy(gS6Info.details, _s6.info.details, sizeof(gS6Info.details)); safe_strcpy(gS6Info.details, _s6.info.details, sizeof(gS6Info.details));
} }
gDateMonthsElapsed = _s6.elapsed_months; gDateMonthsElapsed = static_cast<int32_t>(_s6.elapsed_months);
gDateMonthTicks = _s6.current_day; gDateMonthTicks = _s6.current_day;
gScenarioTicks = _s6.scenario_ticks; gScenarioTicks = _s6.scenario_ticks;

View File

@@ -280,7 +280,7 @@ size_t Ride::GetNumPrices() const
int32_t Ride::GetAge() const int32_t Ride::GetAge() const
{ {
return static_cast<int32_t>(gDateMonthsElapsed) - build_date; return gDateMonthsElapsed - build_date;
} }
int32_t Ride::GetTotalQueueLength() const int32_t Ride::GetTotalQueueLength() const
@@ -932,7 +932,7 @@ void reset_all_ride_build_dates()
{ {
for (auto& ride : GetRideManager()) for (auto& ride : GetRideManager())
{ {
ride.build_date -= static_cast<int32_t>(gDateMonthsElapsed); ride.build_date -= gDateMonthsElapsed;
} }
} }
@@ -7114,7 +7114,7 @@ void Ride::Delete()
void Ride::Renew() void Ride::Renew()
{ {
// Set build date to current date (so the ride is brand new) // Set build date to current date (so the ride is brand new)
build_date = static_cast<int32_t>(gDateMonthsElapsed); build_date = gDateMonthsElapsed;
reliability = RIDE_INITIAL_RELIABILITY; reliability = RIDE_INITIAL_RELIABILITY;
} }

View File

@@ -715,7 +715,7 @@ static void scenario_objective_check_guests_by()
{ {
uint8_t objectiveYear = gScenarioObjectiveYear; uint8_t objectiveYear = gScenarioObjectiveYear;
int16_t parkRating = gParkRating; int16_t parkRating = gParkRating;
int16_t currentMonthYear = gDateMonthsElapsed; int32_t currentMonthYear = gDateMonthsElapsed;
if (currentMonthYear == MONTH_COUNT * objectiveYear || gConfigGeneral.allow_early_completion) 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() static void scenario_objective_check_park_value_by()
{ {
uint8_t objectiveYear = gScenarioObjectiveYear; uint8_t objectiveYear = gScenarioObjectiveYear;
int16_t currentMonthYear = gDateMonthsElapsed; int32_t currentMonthYear = gDateMonthsElapsed;
money32 objectiveParkValue = gScenarioObjectiveCurrency; money32 objectiveParkValue = gScenarioObjectiveCurrency;
money32 parkValue = gParkValue; money32 parkValue = gParkValue;

View File

@@ -37,16 +37,16 @@ namespace OpenRCT2::Scripting
} }
private: private:
uint32_t monthsElapsed_get() const int32_t monthsElapsed_get() const
{ {
const auto& date = GetDate(); const auto& date = GetDate();
return date.GetMonthsElapsed(); return date.GetMonthsElapsed();
} }
void monthsElapsed_set(uint32_t value) void monthsElapsed_set(int32_t value)
{ {
ThrowIfGameStateNotMutable(); ThrowIfGameStateNotMutable();
gDateMonthsElapsed = value; gDateMonthsElapsed = static_cast<int32_t>(value);
} }
uint32_t monthProgress_get() const uint32_t monthProgress_get() const

View File

@@ -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) 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 // Generate a random variable with values 0 up to DistributionSize-1 and chose weather from the distribution table
// accordingly // accordingly