Fix #7002: Always invalidate virtual floor regardless of selection.

This commit is contained in:
ZehMatt 2018-03-03 12:34:27 +01:00 committed by Aaron van Geffen
parent 72114ec6e8
commit fdf7adecd9
3 changed files with 12 additions and 15 deletions

View File

@ -1653,6 +1653,10 @@ void ride_select_next_section()
window_ride_construction_update_active_elements();
return;
}
// Invalidate previous track piece (we may not be changing height!)
map_invalidate_virtual_floor_tiles();
CoordsXYE inputElement, outputElement;
inputElement.x = x;
inputElement.y = y;
@ -1663,9 +1667,6 @@ void ride_select_next_section()
tileElement = outputElement.element;
if (!scenery_tool_is_active())
{
// Invalidate previous track piece (we may not be changing height!)
map_invalidate_virtual_floor_tiles();
// Set next element's height.
map_set_virtual_floor_height(tileElement->base_height << 3);
}
@ -1717,6 +1718,10 @@ void ride_select_previous_section()
window_ride_construction_update_active_elements();
return;
}
// Invalidate previous track piece (we may not be changing height!)
map_invalidate_virtual_floor_tiles();
track_begin_end trackBeginEnd;
if (track_block_get_previous(x, y, tileElement, &trackBeginEnd)) {
_currentTrackBeginX = trackBeginEnd.begin_x;
@ -1728,9 +1733,6 @@ void ride_select_previous_section()
_rideConstructionArrowPulseTime = 0;
if (!scenery_tool_is_active())
{
// Invalidate previous track piece (we may not be changing height!)
map_invalidate_virtual_floor_tiles();
// Set previous element's height.
map_set_virtual_floor_height(trackBeginEnd.begin_element->base_height << 3);
}

View File

@ -746,11 +746,11 @@ money32 footpath_provisional_set(sint32 type, sint32 x, sint32 y, sint32 z, sint
}
}
// Invalidate previous footpath piece.
map_invalidate_virtual_floor_tiles();
if (!scenery_tool_is_active())
{
// Invalidate previous footpath piece.
map_invalidate_virtual_floor_tiles();
if (cost == MONEY32_UNDEFINED)
{
// If we can't build this, don't show a virtual floor.

View File

@ -3264,7 +3264,7 @@ sint32 map_can_construct_with_clear_at(sint32 x, sint32 y, sint32 zLow, sint32 z
sint32 al, ah, bh, cl, ch, water_height;
al = ah = bh = cl = ch = water_height = 0;
uint8 slope = 0;
gMapGroundFlags = ELEMENT_IS_ABOVE_GROUND;
bool canBuildCrossing = false;
if (x >= gMapSizeUnits || y >= gMapSizeUnits || x < 32 || y < 32) {
@ -4819,11 +4819,6 @@ void map_invalidate_virtual_floor_tiles()
}
}
// Do not invalidate if we're between ticks.
if (min_position.x == std::numeric_limits<sint16>::max() || min_position.y == std::numeric_limits<sint16>::max() ||
max_position.x == std::numeric_limits<sint16>::lowest() || max_position.y == std::numeric_limits<sint16>::lowest())
return;
// Apply the virtual floor size to the computed invalidation area.
min_position.x -= gMapVirtualFloorBaseSize + 1;
min_position.y -= gMapVirtualFloorBaseSize + 1;