mirror of https://github.com/OpenRCT2/OpenRCT2.git
fix 2 sources of very common desyncs
This commit is contained in:
parent
c53ce355fa
commit
b23748c015
|
@ -853,6 +853,8 @@ int game_load_network(SDL_RWops* rw)
|
||||||
|
|
||||||
// Read other data not in normal save files
|
// Read other data not in normal save files
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32) = SDL_ReadLE32(rw);
|
RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32) = SDL_ReadLE32(rw);
|
||||||
|
_guestGenerationProbability = SDL_ReadLE32(rw);
|
||||||
|
_suggestedGuestMaximum = SDL_ReadLE32(rw);
|
||||||
|
|
||||||
if (!load_success){
|
if (!load_success){
|
||||||
set_load_objects_fail_reason();
|
set_load_objects_fail_reason();
|
||||||
|
|
|
@ -7206,7 +7206,7 @@ static uint16 sub_69A997(sint16 x, sint16 y, uint8 z, uint8 counter, uint16 scor
|
||||||
|
|
||||||
do {
|
do {
|
||||||
edges &= ~(1 << test_edge);
|
edges &= ~(1 << test_edge);
|
||||||
int saved_f1aedc = RCT2_GLOBAL(0x00F1AEDC, int);
|
sint8 saved_f1aedc = RCT2_GLOBAL(0x00F1AEDC, sint8);
|
||||||
uint8 height = z;
|
uint8 height = z;
|
||||||
RCT2_GLOBAL(0x00F1AEDE, sint16) = 0;
|
RCT2_GLOBAL(0x00F1AEDE, sint16) = 0;
|
||||||
if (footpath_element_is_sloped(path) &&
|
if (footpath_element_is_sloped(path) &&
|
||||||
|
@ -7214,7 +7214,7 @@ static uint16 sub_69A997(sint16 x, sint16 y, uint8 z, uint8 counter, uint16 scor
|
||||||
height += 2;
|
height += 2;
|
||||||
}
|
}
|
||||||
score = sub_69A997(x, y, height, counter, score, test_edge);
|
score = sub_69A997(x, y, height, counter, score, test_edge);
|
||||||
RCT2_GLOBAL(0x00F1AEDC, int) = saved_f1aedc;
|
RCT2_GLOBAL(0x00F1AEDC, sint8) = saved_f1aedc;
|
||||||
} while ((test_edge = bitscanforward(edges)) != -1);
|
} while ((test_edge = bitscanforward(edges)) != -1);
|
||||||
|
|
||||||
return score;
|
return score;
|
||||||
|
@ -7265,7 +7265,7 @@ static int guest_pathfind_choose_direction(sint16 x, sint16 y, uint8 z, rct_peep
|
||||||
for (int test_edge = chosen_edge; test_edge != -1; test_edge = bitscanforward(edges)) {
|
for (int test_edge = chosen_edge; test_edge != -1; test_edge = bitscanforward(edges)) {
|
||||||
edges &= ~(1 << test_edge);
|
edges &= ~(1 << test_edge);
|
||||||
uint8 height = z;
|
uint8 height = z;
|
||||||
int saved_f1aedc = RCT2_GLOBAL(0x00F1AEDC, int);
|
sint8 saved_f1aedc = RCT2_GLOBAL(0x00F1AEDC, sint8);
|
||||||
if (footpath_element_is_sloped(dest_map_element) &&
|
if (footpath_element_is_sloped(dest_map_element) &&
|
||||||
footpath_element_get_slope_direction(dest_map_element) == test_edge)
|
footpath_element_get_slope_direction(dest_map_element) == test_edge)
|
||||||
height += 0x2;
|
height += 0x2;
|
||||||
|
@ -7274,7 +7274,7 @@ static int guest_pathfind_choose_direction(sint16 x, sint16 y, uint8 z, rct_peep
|
||||||
RCT2_GLOBAL(0x00F1AED4, int) = RCT2_GLOBAL(0x00F1AED8, int);
|
RCT2_GLOBAL(0x00F1AED4, int) = RCT2_GLOBAL(0x00F1AED8, int);
|
||||||
RCT2_GLOBAL(0x00F1AEDE, uint16) = 0;
|
RCT2_GLOBAL(0x00F1AEDE, uint16) = 0;
|
||||||
uint16 score = sub_69A997(x, y, height, 0, 0xFFFF, test_edge);
|
uint16 score = sub_69A997(x, y, height, 0, 0xFFFF, test_edge);
|
||||||
RCT2_GLOBAL(0x00F1AEDC, int) = saved_f1aedc;
|
RCT2_GLOBAL(0x00F1AEDC, sint8) = saved_f1aedc;
|
||||||
|
|
||||||
if (score < best_score || (score == best_score && RCT2_GLOBAL(0x00F1AED3, uint8) < best_sub)) {
|
if (score < best_score || (score == best_score && RCT2_GLOBAL(0x00F1AED3, uint8) < best_sub)) {
|
||||||
chosen_edge = test_edge;
|
chosen_edge = test_edge;
|
||||||
|
|
|
@ -1091,6 +1091,8 @@ int scenario_save_network(SDL_RWops* rw)
|
||||||
|
|
||||||
// Write other data not in normal save files
|
// Write other data not in normal save files
|
||||||
SDL_WriteLE32(rw, RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32));
|
SDL_WriteLE32(rw, RCT2_GLOBAL(RCT2_ADDRESS_GAME_PAUSED, uint32));
|
||||||
|
SDL_WriteLE32(rw, _guestGenerationProbability);
|
||||||
|
SDL_WriteLE32(rw, _suggestedGuestMaximum);
|
||||||
|
|
||||||
gfx_invalidate_screen();
|
gfx_invalidate_screen();
|
||||||
return 1;
|
return 1;
|
||||||
|
|
|
@ -287,7 +287,7 @@ static void climate_update_thunder_sound()
|
||||||
climate_update_thunder();
|
climate_update_thunder();
|
||||||
} else if (_climateCurrentWeatherEffect == 2) {
|
} else if (_climateCurrentWeatherEffect == 2) {
|
||||||
// Create new thunder and lightning
|
// Create new thunder and lightning
|
||||||
unsigned int randomNumber = scenario_rand();
|
unsigned int randomNumber = util_rand();
|
||||||
if ((randomNumber & 0xFFFF) <= 0x1B4) {
|
if ((randomNumber & 0xFFFF) <= 0x1B4) {
|
||||||
randomNumber >>= 16;
|
randomNumber >>= 16;
|
||||||
_thunderTimer = 43 + (randomNumber % 64);
|
_thunderTimer = 43 + (randomNumber % 64);
|
||||||
|
@ -314,7 +314,7 @@ static void climate_update_lightning()
|
||||||
|
|
||||||
_lightningTimer--;
|
_lightningTimer--;
|
||||||
if (RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint16) == 0)
|
if (RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint16) == 0)
|
||||||
if ((scenario_rand() & 0xFFFF) <= 0x2000)
|
if ((util_rand() & 0xFFFF) <= 0x2000)
|
||||||
RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint16) = 1;
|
RCT2_GLOBAL(RCT2_ADDRESS_LIGHTNING_ACTIVE, uint16) = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -324,7 +324,7 @@ static void climate_update_thunder()
|
||||||
if (_thunderTimer != 0)
|
if (_thunderTimer != 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
unsigned int randomNumber = scenario_rand();
|
unsigned int randomNumber = util_rand();
|
||||||
if (randomNumber & 0x10000) {
|
if (randomNumber & 0x10000) {
|
||||||
if (_thunderStatus[0] == THUNDER_STATUS_NULL && _thunderStatus[1] == THUNDER_STATUS_NULL) {
|
if (_thunderStatus[0] == THUNDER_STATUS_NULL && _thunderStatus[1] == THUNDER_STATUS_NULL) {
|
||||||
// Play thunder on left side
|
// Play thunder on left side
|
||||||
|
|
|
@ -49,6 +49,8 @@ enum {
|
||||||
|
|
||||||
extern uint8 *gParkRatingHistory;
|
extern uint8 *gParkRatingHistory;
|
||||||
extern uint8 *gGuestsInParkHistory;
|
extern uint8 *gGuestsInParkHistory;
|
||||||
|
extern int _guestGenerationProbability;
|
||||||
|
extern int _suggestedGuestMaximum;
|
||||||
|
|
||||||
void set_forced_park_rating();
|
void set_forced_park_rating();
|
||||||
int get_forced_park_rating();
|
int get_forced_park_rating();
|
||||||
|
|
Loading…
Reference in New Issue