Move and refactor shop interact with path code to prevent possible desync

This commit is contained in:
duncanspumpkin 2019-02-19 13:00:14 +00:00
parent 09bb99d9e8
commit 6375d2537a
2 changed files with 25 additions and 26 deletions

View File

@ -1673,7 +1673,7 @@ static void CloseConstructWindowOnCompletion(Ride* ride)
}
static void RideConstructPlacedForwardGameActionCallback(const GameAction* ga, const GameActionResult* result)
{
{
if (result->Error != GA_ERROR::OK)
{
window_ride_construction_update_active_elements();

View File

@ -404,31 +404,7 @@ public:
GA_ERROR::UNKNOWN, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, gGameCommandErrorText);
}
}
// 6c55be
if (entranceDirections & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)
{
entranceDirections &= 0x0F;
if (entranceDirections != 0)
{
// ???? Eh?
if (!(GetFlags() & GAME_COMMAND_FLAG_APPLY) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST)
&& !gCheatsDisableClearanceChecks)
{
uint8_t availableDirections = entranceDirections;
for (int32_t chosenDirection = bitscanforward(availableDirections); chosenDirection != -1;
chosenDirection = bitscanforward(availableDirections))
{
availableDirections &= ~(1 << chosenDirection);
int32_t temp_x = mapLoc.x, temp_y = mapLoc.y;
int32_t temp_direction = (_origin.direction + chosenDirection) & 3;
temp_x += CoordsDirectionDelta[temp_direction].x;
temp_y += CoordsDirectionDelta[temp_direction].y;
temp_direction = direction_reverse(temp_direction);
wall_remove_intersecting_walls(temp_x, temp_y, baseZ, clearanceZ, temp_direction & 3);
}
}
}
}
// 6c5648 12 push
tileElement = map_get_surface_element_at({ mapLoc.x, mapLoc.y });
if (!gCheatsDisableSupportLimits)
@ -714,6 +690,7 @@ public:
}
}
}
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN || ride->overall_view.xy == RCT_XY8_UNDEFINED)
{
ride->overall_view.x = mapLoc.x / 32;
@ -777,6 +754,28 @@ public:
entranceDirections = TrackSequenceProperties[_trackType][0];
}
if (entranceDirections & TRACK_SEQUENCE_FLAG_CONNECTS_TO_PATH)
{
uint8_t availableDirections = entranceDirections & 0x0F;
if (availableDirections != 0)
{
if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST) && !gCheatsDisableClearanceChecks)
{
for (int32_t chosenDirection = bitscanforward(availableDirections); chosenDirection != -1;
chosenDirection = bitscanforward(availableDirections))
{
availableDirections &= ~(1 << chosenDirection);
CoordsXY tempLoc{ mapLoc.x, mapLoc.y };
int32_t temp_direction = (_origin.direction + chosenDirection) & 3;
tempLoc.x += CoordsDirectionDelta[temp_direction].x;
tempLoc.y += CoordsDirectionDelta[temp_direction].y;
temp_direction = direction_reverse(temp_direction);
wall_remove_intersecting_walls(tempLoc.x, tempLoc.y, baseZ, clearanceZ, temp_direction & 3);
}
}
}
}
if (entranceDirections & TRACK_SEQUENCE_FLAG_ORIGIN)
{
if (trackBlock->index == 0)