1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-26 08:14:38 +01:00

Fix desync caused by provisional ride entrance/exit peep interaction

This commit is contained in:
zsilencer
2016-10-26 12:02:09 -06:00
parent 5699b9e4ed
commit 24bd56af02
4 changed files with 38 additions and 11 deletions

View File

@@ -373,9 +373,12 @@ void game_logic_update()
map_update_tiles();
// Temporarily remove provisional paths to prevent peep from interacting with them
map_remove_provisional_elements();
ride_remove_provisional_entrance_or_exit();
map_update_path_wide_flags();
peep_update_all();
ride_restore_provisional_entrance_or_exit();
map_restore_provisional_elements();
//
vehicle_update_all();
sprite_misc_update_all();
ride_update_all();

View File

@@ -1344,17 +1344,24 @@ int sub_6C683D(int* x, int* y, int* z, int direction, int type, uint16 extra_par
return 0;
}
/**
*
* rct2: 0x006C96C0
*/
void sub_6C96C0()
void ride_restore_provisional_entrance_or_exit()
{
rct_ride *ride;
int rideIndex, x, y, z, direction;
if (_currentTrackSelectionFlags & (1 << 2)) {
money32 result = game_do_command(
_unkF440BF.x,
(GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_GHOST) | (_unkF440BF.direction << 8),
_unkF440BF.y,
_currentRideIndex | (gRideEntranceExitPlaceType << 8),
GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT,
_unkF440C4,
0
);
}
}
if (_currentTrackSelectionFlags & 4) {
_currentTrackSelectionFlags &= ~4;
void ride_remove_provisional_entrance_or_exit()
{
if (_currentTrackSelectionFlags & (1 << 2)) {
game_do_command(
_unkF440BF.x,
(GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_APPLY),
@@ -1365,6 +1372,21 @@ void sub_6C96C0()
0
);
}
}
/**
*
* rct2: 0x006C96C0
*/
void sub_6C96C0()
{
rct_ride *ride;
int rideIndex, x, y, z, direction;
if (_currentTrackSelectionFlags & (1 << 2)) {
ride_remove_provisional_entrance_or_exit();
_currentTrackSelectionFlags &= ~(1 << 2);
}
if (_currentTrackSelectionFlags & 2) {
_currentTrackSelectionFlags &= ~2;
@@ -7047,7 +7069,7 @@ money32 ride_get_entrance_or_exit_price(int rideIndex, int x, int y, int directi
sub_6C96C0();
money32 result = game_do_command(
x,
105 | (direction << 8),
(GAME_COMMAND_FLAG_APPLY | GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED | GAME_COMMAND_FLAG_5 | GAME_COMMAND_FLAG_GHOST) | (direction << 8),
y,
rideIndex | (dh << 8),
GAME_COMMAND_PLACE_RIDE_ENTRANCE_OR_EXIT,

View File

@@ -1058,6 +1058,8 @@ void game_command_set_ride_price(int *eax, int *ebx, int *ecx, int *edx, int *es
money32 ride_create_command(int type, int subType, int flags, uint8 *outRideIndex, uint8 *outRideColour);
void ride_clear_for_construction(int rideIndex);
void ride_restore_provisional_entrance_or_exit();
void ride_remove_provisional_entrance_or_exit();
void set_vehicle_type_image_max_sizes(rct_ride_entry_vehicle* vehicle_type, int num_images);
void invalidate_test_results(int rideIndex);

View File

@@ -3746,7 +3746,7 @@ void ride_construction_toolupdate_entrance_exit(int screenX, int screenY)
direction = gRideEntranceExitPlaceDirection ^ 2;
unk = gRideEntranceExitPlaceStationIndex;
if (
!(_currentTrackSelectionFlags & 4) ||
!(_currentTrackSelectionFlags & (1 << 2)) ||
x != _unkF440BF.x ||
y != _unkF440BF.y ||
direction != _unkF440BF.direction ||