From aeeca2454a0fb4410e65d3505c69cfcfbc91f630 Mon Sep 17 00:00:00 2001 From: zsilencer Date: Mon, 6 Jul 2015 19:07:47 -0600 Subject: [PATCH] fixed source of non-deterministicness --- src/peep/peep.c | 2 +- src/world/climate.c | 2 +- src/world/map.c | 15 ++++++--------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/src/peep/peep.c b/src/peep/peep.c index 6ccebd3711..0f504260bf 100644 --- a/src/peep/peep.c +++ b/src/peep/peep.c @@ -4380,7 +4380,7 @@ void peep_problem_warnings_update() uint16 guests_in_park = RCT2_GLOBAL(RCT2_ADDRESS_GUESTS_IN_PARK, uint16); int hunger_counter = 0, lost_counter = 0, noexit_counter = 0, thirst_counter = 0, litter_counter = 0, disgust_counter = 0, bathroom_counter = 0 ,vandalism_counter = 0; - static int warning_throttle[7] = { 0, 0, 0, 0, 0, 0, 0 }; + uint8* warning_throttle = RCT2_ADDRESS(0x01358750, uint8); RCT2_GLOBAL(RCT2_ADDRESS_RIDE_COUNT, sint16) = ride_get_count(); // refactor this to somewhere else diff --git a/src/world/climate.c b/src/world/climate.c index 79e231c2da..51ac92409a 100644 --- a/src/world/climate.c +++ b/src/world/climate.c @@ -223,7 +223,7 @@ static void climate_determine_future_weather() 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 - sint8 next_weather = transition.distribution[ ((rand() & 0xFF) * transition.distribution_size) >> 8 ]; + sint8 next_weather = transition.distribution[ ((scenario_rand() & 0xFF) * transition.distribution_size) >> 8 ]; gClimateNextWeather = next_weather; _climateNextTemperature = transition.base_temperature + climate_weather_data[next_weather].temp_delta; diff --git a/src/world/map.c b/src/world/map.c index 845554e4b2..f445517151 100644 --- a/src/world/map.c +++ b/src/world/map.c @@ -57,9 +57,6 @@ bool gClearSmallScenery; bool gClearLargeScenery; bool gClearFootpath; -int _sub_6A876D_save_x; -int _sub_6A876D_save_y; - static void tiles_init(); static void sub_6A87BB(int x, int y); static void map_update_grass_length(int x, int y, rct_map_element *mapElement); @@ -296,8 +293,8 @@ void map_init(int size) } RCT2_GLOBAL(RCT2_ADDRESS_GRASS_SCENERY_TILEPOS, sint16) = 0; - _sub_6A876D_save_x = 0; - _sub_6A876D_save_y = 0; + RCT2_GLOBAL(0x013CE774, sint16) = 0; + RCT2_GLOBAL(0x013CE776, sint16) = 0; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_UNITS, sint16) = size * 32 - 32; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE_MINUS_2, sint16) = size * 32 - 2; RCT2_GLOBAL(RCT2_ADDRESS_MAP_SIZE, sint16) = size; @@ -572,8 +569,8 @@ void sub_6A876D() // Presumebly sub_6A87BB is too computationally expensive to call for every // tile every update, so word_13CE774 and word_13CE776 store the x and y // progress. A maximum of 128 calls is done per update. - x = _sub_6A876D_save_x; - y = _sub_6A876D_save_y; + x = RCT2_GLOBAL(0x013CE774, sint16); + y = RCT2_GLOBAL(0x013CE776, sint16); for (i = 0; i < 128; i++) { sub_6A87BB(x, y); @@ -586,8 +583,8 @@ void sub_6A876D() y = 0; } } - _sub_6A876D_save_x = x; - _sub_6A876D_save_y = y; + RCT2_GLOBAL(0x013CE774, sint16) = x; + RCT2_GLOBAL(0x013CE776, sint16) = y; } /**