diff --git a/src/cheats.c b/src/cheats.c index 880dce0bb9..340e408ae5 100644 --- a/src/cheats.c +++ b/src/cheats.c @@ -2,8 +2,9 @@ #include "config.h" #include "game.h" #include "interface/window.h" -#include "network/network.h" +#include "localisation/date.h" #include "management/finance.h" +#include "network/network.h" #include "world/climate.h" #include "world/footpath.h" #include "world/scenery.h" @@ -145,7 +146,7 @@ static void cheat_renew_rides() FOR_ALL_RIDES(i, ride) { // Set build date to current date (so the ride is brand new) - ride->build_date = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16); + ride->build_date = gDateMonthsElapsed; // Set reliability to 100 ride->reliability = (100 << 8); } diff --git a/src/interface/graph.c b/src/interface/graph.c index dc9cae385e..3680e480bb 100644 --- a/src/interface/graph.c +++ b/src/interface/graph.c @@ -27,8 +27,8 @@ static void graph_draw_months_uint8(rct_drawpixelinfo *dpi, uint8 *history, int { int i, x, y, yearOver32, currentMonth, currentDay; - currentMonth = date_get_month(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16)); - currentDay = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16); + currentMonth = date_get_month(gDateMonthsElapsed); + currentDay = gDateMonthTicks; yearOver32 = (currentMonth * 4) + (currentDay >> 14) - 31; x = baseX; y = baseY; @@ -103,8 +103,8 @@ static void graph_draw_months_money32(rct_drawpixelinfo *dpi, money32 *history, { int i, x, y, yearOver32, currentMonth, currentDay; - currentMonth = date_get_month(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16)); - currentDay = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16); + currentMonth = date_get_month(gDateMonthsElapsed); + currentDay = gDateMonthTicks; yearOver32 = (currentMonth * 4) + (currentDay >> 14) - 31; x = baseX; y = baseY; diff --git a/src/localisation/date.c b/src/localisation/date.c index 6e2cd7cc73..25312854a4 100644 --- a/src/localisation/date.c +++ b/src/localisation/date.c @@ -61,7 +61,7 @@ int date_get_total_months(int month, int year) */ void date_reset() { - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) = MONTH_MARCH; - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, sint16) = 0; + gDateMonthsElapsed = 0; + gDateMonthTicks = 0; gCurrentTicks = 0; } diff --git a/src/localisation/date.h b/src/localisation/date.h index 6ae0b112e8..039a4d1ebb 100644 --- a/src/localisation/date.h +++ b/src/localisation/date.h @@ -47,6 +47,9 @@ extern const sint16 days_in_month[MONTH_COUNT]; extern const rct_string_id DateFormatStringIds[]; extern const rct_string_id DateFormatStringFormatIds[]; +#define gDateMonthTicks RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) +#define gDateMonthsElapsed RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) + int date_get_month(int months); int date_get_year(int months); int date_get_total_months(int month, int year); diff --git a/src/management/finance.c b/src/management/finance.c index fccd42ab72..bee850fadf 100644 --- a/src/management/finance.c +++ b/src/management/finance.c @@ -21,6 +21,7 @@ #include "../addresses.h" #include "../game.h" #include "../interface/window.h" +#include "../localisation/date.h" #include "../localisation/localisation.h" #include "../peep/peep.h" #include "../ride/ride.h" @@ -130,7 +131,7 @@ void finance_pay_ride_upkeep() FOR_ALL_RIDES(i, ride) { if (!(ride->lifecycle_flags & RIDE_LIFECYCLE_EVER_BEEN_OPENED)) { - ride->build_date = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16); + ride->build_date = gDateMonthsElapsed; ride->reliability = RIDE_INITIAL_RELIABILITY; } @@ -336,7 +337,7 @@ void game_command_set_current_loan(int* eax, int* ebx, int* ecx, int* edx, int* void finance_shift_expenditure_table() { // If EXPENDITURE_TABLE_MONTH_COUNT months have passed then is full, sum the oldest month - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) >= EXPENDITURE_TABLE_MONTH_COUNT) { + if (gDateMonthsElapsed >= EXPENDITURE_TABLE_MONTH_COUNT) { money32 sum = 0; for (uint32 i = EXPENDITURE_TABLE_TOTAL_COUNT - RCT_EXPENDITURE_TYPE_COUNT; i < EXPENDITURE_TABLE_TOTAL_COUNT; i++) { sum += RCT2_ADDRESS(RCT2_ADDRESS_EXPENDITURE_TABLE, money32)[i]; diff --git a/src/management/news_item.c b/src/management/news_item.c index 17a588f174..bd3d10ded7 100644 --- a/src/management/news_item.c +++ b/src/management/news_item.c @@ -292,8 +292,8 @@ void news_item_add_to_queue_raw(uint8 type, const utf8 *text, uint32 assoc) newsItem->flags = 0; newsItem->assoc = assoc; newsItem->ticks = 0; - newsItem->month_year = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16); - newsItem->day = ((days_in_month[(newsItem->month_year & 7)] * RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16)) >> 16) + 1; + newsItem->month_year = gDateMonthsElapsed; + newsItem->day = ((days_in_month[(newsItem->month_year & 7)] * gDateMonthTicks) >> 16) + 1; safe_strcpy(newsItem->text, text, 255); newsItem->text[254] = 0; diff --git a/src/management/research.c b/src/management/research.c index db17ceca8d..31adc3b188 100644 --- a/src/management/research.c +++ b/src/management/research.c @@ -79,8 +79,8 @@ static void research_calculate_expected_date() int progress = RCT2_GLOBAL(RCT2_ADDRESS_RESEARH_PROGRESS, uint16); int progressStage = RCT2_GLOBAL(RCT2_ADDRESS_RESEARH_PROGRESS_STAGE, uint8); int researchLevel = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_RESEARCH_LEVEL, uint8); - int currentDay = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16); - int currentMonth = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16); + int currentDay = gDateMonthTicks; + int currentMonth = gDateMonthsElapsed; int expectedDay, expectedMonth, dayQuotient, dayRemainder, progressRemaining, daysRemaining; if (progressStage == RESEARCH_STAGE_INITIAL_RESEARCH || researchLevel == RESEARCH_FUNDING_NONE) { diff --git a/src/network/network.cpp b/src/network/network.cpp index d2cd44823b..a37456a4b8 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -1126,8 +1126,8 @@ void Network::AdvertiseHeartbeat() json_t *gameInfo = json_object(); json_object_set_new(gameInfo, "mapSize", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, sint16))); - json_object_set_new(gameInfo, "day", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16))); - json_object_set_new(gameInfo, "month", json_integer(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16))); + json_object_set_new(gameInfo, "day", json_integer(gDateMonthTicks)); + json_object_set_new(gameInfo, "month", json_integer(gDateMonthsElapsed)); json_object_set_new(gameInfo, "guests", json_integer(gNumGuestsInPark)); json_object_set_new(gameInfo, "parkValue", json_integer(gParkValue)); if (!(gParkFlags & PARK_FLAGS_NO_MONEY)) { diff --git a/src/peep/staff.c b/src/peep/staff.c index 31493a4ee8..670edfab42 100644 --- a/src/peep/staff.c +++ b/src/peep/staff.c @@ -23,6 +23,7 @@ #include "../game.h" #include "../scenario.h" #include "../interface/viewport.h" +#include "../localisation/date.h" #include "../localisation/string_ids.h" #include "../management/finance.h" #include "../util/util.h" @@ -250,7 +251,7 @@ void game_command_hire_new_staff_member(int* eax, int* ebx, int* ecx, int* edx, invalidate_sprite_2((rct_sprite*)newPeep); } - newPeep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16); + newPeep->time_in_park = gDateMonthsElapsed; newPeep->pathfind_goal.x = 0xFF; newPeep->pathfind_goal.y = 0xFF; newPeep->pathfind_goal.z = 0xFF; @@ -538,7 +539,7 @@ void staff_reset_stats() rct_peep *peep; FOR_ALL_STAFF(spriteIndex, peep) { - peep->time_in_park = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16); + peep->time_in_park = gDateMonthsElapsed; peep->staff_lawns_mown = 0; peep->staff_rides_fixed = 0; peep->staff_gardens_watered = 0; diff --git a/src/rct1/S4Importer.cpp b/src/rct1/S4Importer.cpp index 8dc1387711..b3f069c918 100644 --- a/src/rct1/S4Importer.cpp +++ b/src/rct1/S4Importer.cpp @@ -929,8 +929,8 @@ void S4Importer::ImportParkFlags() gCurrentTicks = _s4.ticks; RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_0, uint32) = _s4.random_a; RCT2_GLOBAL(RCT2_ADDRESS_SCENARIO_SRAND_1, uint32) = _s4.random_b; - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) = _s4.month; - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) = _s4.day; + gDateMonthsElapsed = _s4.month; + gDateMonthTicks = _s4.day; // Park rating gParkRating = _s4.park_rating; diff --git a/src/ride/ride.c b/src/ride/ride.c index ae0502ae4b..811a0019b7 100644 --- a/src/ride/ride.c +++ b/src/ride/ride.c @@ -864,7 +864,7 @@ void reset_all_ride_build_dates() rct_ride *ride; FOR_ALL_RIDES(i, ride) - ride->build_date -= RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16); + ride->build_date -= gDateMonthsElapsed; } #pragma endregion @@ -2132,7 +2132,7 @@ static void ride_inspection_update(rct_ride *ride) static int get_age_penalty(rct_ride *ride) { int years; - years = date_get_year(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) - ride->build_date); + years = date_get_year(gDateMonthsElapsed - ride->build_date); switch (years) { case 0: return 0; @@ -2265,7 +2265,7 @@ static int ride_get_new_breakdown_problem(rct_ride *ride) if (gCheatsDisableBrakesFailure) return -1; - monthsOld = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint8) - ride->build_date; + monthsOld = gDateMonthsElapsed - ride->build_date; if (monthsOld < 16 || ride->reliability > (50 << 8)) return -1; @@ -6054,7 +6054,7 @@ foundRideEntry: ride->num_riders = 0; ride->slide_in_use = 0; ride->maze_tiles = 0; - ride->build_date = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16); + ride->build_date = gDateMonthsElapsed; ride->music_tune_id = 255; ride->breakdown_reason = 255; diff --git a/src/ride/ride_ratings.c b/src/ride/ride_ratings.c index 05d0b0517c..41e52065e7 100644 --- a/src/ride/ride_ratings.c +++ b/src/ride/ride_ratings.c @@ -20,6 +20,7 @@ #include "../addresses.h" #include "../interface/window.h" +#include "../localisation/date.h" #include "../world/map.h" #include "ride.h" #include "ride_data.h" @@ -647,7 +648,7 @@ static void ride_ratings_calculate_value(rct_ride *ride) (((ride->intensity * RideRatings[ride->type].intensity) * 32) >> 15) + (((ride->nausea * RideRatings[ride->type].nausea) * 32) >> 15); - int monthsOld = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) - ride->build_date; + int monthsOld = gDateMonthsElapsed - ride->build_date; // New ride reward if (monthsOld <= 12) { diff --git a/src/scenario.c b/src/scenario.c index 1fc6fa81d8..0a74819873 100644 --- a/src/scenario.c +++ b/src/scenario.c @@ -533,7 +533,7 @@ static void scenario_day_update() static void scenario_week_update() { - int month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7; + int month = gDateMonthsElapsed & 7; finance_pay_wages(); finance_pay_research(); @@ -575,7 +575,7 @@ static void scenario_update_daynight_cycle() gDayNightCycle = 0; if (RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) == SCREEN_FLAGS_PLAYING && gConfigGeneral.day_night_cycle) { - float monthFraction = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) / (float)0x10000; + float monthFraction = gDateMonthTicks / (float)0x10000; if (monthFraction < (1 / 8.0f)) { gDayNightCycle = 0.0f; } else if (monthFraction < (3 / 8.0f)) { @@ -602,9 +602,9 @@ static void scenario_update_daynight_cycle() void scenario_update() { if (!(RCT2_GLOBAL(RCT2_ADDRESS_SCREEN_FLAGS, uint8) & ~SCREEN_FLAGS_PLAYING)) { - uint32 currentMonthTick = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16); + uint32 currentMonthTick = gDateMonthTicks; uint32 nextMonthTick = currentMonthTick + 4; - uint8 currentMonth = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7; + uint8 currentMonth = gDateMonthsElapsed & 7; uint8 currentDaysInMonth = (uint8)days_in_month[currentMonth]; if ((currentDaysInMonth * nextMonthTick) >> 16 != (currentDaysInMonth * currentMonthTick) >> 16) { @@ -617,9 +617,9 @@ void scenario_update() scenario_fortnight_update(); } - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) = (uint16)nextMonthTick; + gDateMonthTicks = (uint16)nextMonthTick; if (nextMonthTick >= 0x10000) { - RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16)++; + gDateMonthsElapsed++; scenario_month_update(); } } @@ -1257,7 +1257,7 @@ static void scenario_objective_check_guests_by() sint16 parkRating = gParkRating; sint16 guestsInPark = gNumGuestsInPark; sint16 objectiveGuests = gScenarioObjectiveNumGuests; - sint16 currentMonthYear = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16); + sint16 currentMonthYear = gDateMonthsElapsed; if (currentMonthYear == 8 * objectiveYear){ if (parkRating >= 600 && guestsInPark >= objectiveGuests) @@ -1270,7 +1270,7 @@ static void scenario_objective_check_guests_by() static void scenario_objective_check_park_value_by() { uint8 objectiveYear = gScenarioObjectiveYear; - sint16 currentMonthYear = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16); + sint16 currentMonthYear = gDateMonthsElapsed; money32 objectiveParkValue = gScenarioObjectiveCurrency; money32 parkValue = gParkValue; @@ -1321,7 +1321,7 @@ static void scenario_objective_check_10_rollercoasters() */ static void scenario_objective_check_guests_and_rating() { - if (gParkRating < 700 && RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) >= 1) { + if (gParkRating < 700 && gDateMonthsElapsed >= 1) { RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16)++; if (RCT2_GLOBAL(RCT2_ADDRESS_PARK_RATING_WARNING_DAYS, uint16) == 1) { if (gConfigNotifications.park_rating_warnings) { diff --git a/src/windows/finances.c b/src/windows/finances.c index 85bbf0c753..948bfb94ba 100644 --- a/src/windows/finances.c +++ b/src/windows/finances.c @@ -673,7 +673,7 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi) // Expenditure / Income values for each month x = w->x + 118; - sint16 currentMonthYear = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16); + sint16 currentMonthYear = gDateMonthsElapsed; for (i = 4; i >= 0; i--) { y = w->y + 47; @@ -746,7 +746,7 @@ static void window_finances_summary_paint(rct_window *w, rct_drawpixelinfo *dpi) if (gScenarioObjectiveType == OBJECTIVE_MONTHLY_FOOD_INCOME) { // Last month's profit from food, drink and merchandise money32 lastMonthProfit = 0; - if (RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) != 0) { + if (gDateMonthsElapsed != 0) { lastMonthProfit += RCT2_GLOBAL(0x01357898, money32); lastMonthProfit += RCT2_GLOBAL(0x0135789C, money32); lastMonthProfit += RCT2_GLOBAL(0x013578A0, money32); diff --git a/src/windows/game_bottom_toolbar.c b/src/windows/game_bottom_toolbar.c index 1863eb8d22..85fc4566bb 100644 --- a/src/windows/game_bottom_toolbar.c +++ b/src/windows/game_bottom_toolbar.c @@ -228,8 +228,8 @@ static void window_game_bottom_toolbar_tooltip(rct_window* w, int widgetIndex, r RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = gParkRating; break; case WIDX_DATE: - month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7; - day = ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) * days_in_month[month]) >> 16) & 0xFF; + month = gDateMonthsElapsed & 7; + day = ((gDateMonthTicks * days_in_month[month]) >> 16) & 0xFF; RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = STR_DATE_DAY_1 + day; RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, short) = STR_MONTH_MARCH + month; @@ -452,9 +452,9 @@ static void window_game_bottom_toolbar_draw_right_panel(rct_drawpixelinfo *dpi, y = window_game_bottom_toolbar_widgets[WIDX_RIGHT_OUTSET].top + w->y + 2; // Date - int year = date_get_year(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16)) + 1; - int month = date_get_month(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7); - int day = ((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_TICKS, uint16) * days_in_month[month]) >> 16) & 0xFF; + int year = date_get_year(gDateMonthsElapsed) + 1; + int month = date_get_month(gDateMonthsElapsed & 7); + int day = ((gDateMonthTicks * days_in_month[month]) >> 16) & 0xFF; rct_string_id stringId = DateFormatStringFormatIds[gConfigGeneral.date_format]; RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS, short) = STR_DATE_DAY_1 + day; diff --git a/src/windows/ride.c b/src/windows/ride.c index 8d5fbdb1b2..07bd14263c 100644 --- a/src/windows/ride.c +++ b/src/windows/ride.c @@ -28,6 +28,7 @@ #include "../interface/viewport.h" #include "../interface/widget.h" #include "../interface/window.h" +#include "../localisation/date.h" #include "../localisation/localisation.h" #include "../peep/staff.h" #include "../ride/ride.h" @@ -6119,7 +6120,7 @@ static void window_ride_customer_paint(rct_window *w, rct_drawpixelinfo *dpi) // Age //If the ride has a build date that is in the future, show it as built this year. - age = max((RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) - ride->build_date) / 8, 0); + age = max((gDateMonthsElapsed - ride->build_date) / 8, 0); stringId = age == 0 ? STR_BUILT_THIS_YEAR : age == 1 ? diff --git a/src/windows/ride_list.c b/src/windows/ride_list.c index 18af63d894..8b651e561d 100644 --- a/src/windows/ride_list.c +++ b/src/windows/ride_list.c @@ -577,7 +577,7 @@ static void window_ride_list_scrollpaint(rct_window *w, rct_drawpixelinfo *dpi, RCT2_GLOBAL(RCT2_ADDRESS_COMMON_FORMAT_ARGS + 2, uint32) = ride_customers_per_hour(ride); break; case INFORMATION_TYPE_AGE:; - sint16 age = date_get_year(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16) - ride->build_date); + sint16 age = date_get_year(gDateMonthsElapsed - ride->build_date); switch (age) { case 0: formatSecondary = STR_RIDE_LIST_BUILT_THIS_YEAR_LABEL; break; case 1: formatSecondary = STR_RIDE_LIST_BUILT_LAST_YEAR_LABEL; break; diff --git a/src/world/climate.c b/src/world/climate.c index 0ec1d8d281..23a98863c6 100644 --- a/src/world/climate.c +++ b/src/world/climate.c @@ -76,7 +76,7 @@ void climate_reset(int climate) { gClimate = climate; - sint8 month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7; + sint8 month = gDateMonthsElapsed & 7; const rct_weather_transition* climate_table = climate_transitions[climate]; rct_weather_transition transition = climate_table[month]; sint8 weather = WEATHER_PARTIALLY_CLOUDY; @@ -198,7 +198,7 @@ static void climate_determine_future_weather(int randomDistribution) { sint8 climate = gClimate; const rct_weather_transition* climate_table = climate_transitions[climate]; - sint8 month = RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, sint16) & 7; + sint8 month = gDateMonthsElapsed & 7; rct_weather_transition transition = climate_table[month]; // Generate a random variable with values 0 upto distribution_size-1 and chose weather from the distribution table accordingly diff --git a/src/world/duck.c b/src/world/duck.c index 8bfc2d9acd..251de2081b 100644 --- a/src/world/duck.c +++ b/src/world/duck.c @@ -185,7 +185,7 @@ static void duck_update_swim(rct_duck *duck) return; } - int currentMonth = date_get_month(RCT2_GLOBAL(RCT2_ADDRESS_CURRENT_MONTH_YEAR, uint16)); + int currentMonth = date_get_month(gDateMonthsElapsed); if (currentMonth >= MONTH_SEPTEMBER && (randomNumber >> 16) < 218) { duck->state = DUCK_STATE_FLY_AWAY; duck_update_fly_away(duck);