Fix #23508: RideConstruction and Footpath windows racing to set the VirtualFloor

This commit is contained in:
Severin Paul Höfer 2025-01-10 15:13:17 +01:00 committed by GitHub
parent 20f191cf1f
commit 8a84f225e1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 19 additions and 16 deletions

View file

@ -5,6 +5,7 @@
- Improved: [#23540] The file browser now optionally shows a file size column.
- Change: [#23328] All RCT2 entertainer costumes are now available in legacy parks.
- Fix: [#21794] Lay-down coaster cars reverse on first frames of downwards corkscrew.
- Fix: [#23508] Simultaneous virtual floors shown for ride and footpath.
- Fix: [#23581] [Plugin] Food/drink items given to guests have no consumption duration set.
0.4.18 (2025-01-08)

View file

@ -51,6 +51,7 @@
#include <openrct2/windows/Intent.h>
#include <openrct2/world/ConstructionClearance.h>
#include <openrct2/world/Entrance.h>
#include <openrct2/world/Map.h>
#include <openrct2/world/Park.h>
#include <openrct2/world/tile_element/EntranceElement.h>
#include <openrct2/world/tile_element/PathElement.h>
@ -1051,13 +1052,13 @@ namespace OpenRCT2::Ui::Windows
case WIDX_NEXT_SECTION:
VirtualFloorInvalidate();
RideSelectNextSection();
if (!isToolActive(WindowClass::Scenery))
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
VirtualFloorSetHeight(_currentTrackBegin.z);
break;
case WIDX_PREVIOUS_SECTION:
VirtualFloorInvalidate();
RideSelectPreviousSection();
if (!isToolActive(WindowClass::Scenery))
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
VirtualFloorSetHeight(_currentTrackBegin.z);
break;
case WIDX_LEFT_CURVE:
@ -3163,7 +3164,7 @@ namespace OpenRCT2::Ui::Windows
// Invalidate previous track piece (we may not be changing height!)
VirtualFloorInvalidate();
if (!isToolActive(WindowClass::Scenery))
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
{
// Set height to where the next track piece would begin
VirtualFloorSetHeight(_currentTrackBegin.z);
@ -4766,7 +4767,7 @@ namespace OpenRCT2::Ui::Windows
// Invalidate previous track piece (we may not be changing height!)
VirtualFloorInvalidate();
if (!isToolActive(WindowClass::Scenery))
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
{
// Set height to where the next track piece would begin
VirtualFloorSetHeight(trackPos.z - zBegin + zEnd);

View file

@ -30,7 +30,8 @@
using namespace OpenRCT2;
static uint16_t _virtualFloorBaseSize = 5 * 32;
static constexpr uint16_t kVirtualFloorBaseSize = 5 * kCoordsXYStep;
static constexpr CoordsXY kVirtualFloorBaseSizeXY = { kVirtualFloorBaseSize, kVirtualFloorBaseSize };
static uint16_t _virtualFloorHeight = 0;
static CoordsXYZ _virtualFloorLastMinPos;
static CoordsXYZ _virtualFloorLastMaxPos;
@ -130,10 +131,10 @@ void VirtualFloorInvalidate()
&& max_position.y != std::numeric_limits<int32_t>::lowest());
// Apply the virtual floor size to the computed invalidation area.
min_position.x -= _virtualFloorBaseSize + 16;
min_position.y -= _virtualFloorBaseSize + 16;
max_position.x += _virtualFloorBaseSize + 16;
max_position.y += _virtualFloorBaseSize + 16;
min_position.x -= kVirtualFloorBaseSize + 16;
min_position.y -= kVirtualFloorBaseSize + 16;
max_position.x += kVirtualFloorBaseSize + 16;
max_position.y += kVirtualFloorBaseSize + 16;
// Invalidate previous region if appropriate.
if (_virtualFloorLastMinPos.x != std::numeric_limits<int32_t>::max()
@ -187,12 +188,12 @@ bool VirtualFloorTileIsFloor(const CoordsXY& loc)
}
// Check if map selection (usually single tiles) are enabled
// and if the current tile is near or on them
if ((gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) && loc.x >= gMapSelectPositionA.x - _virtualFloorBaseSize
&& loc.y >= gMapSelectPositionA.y - _virtualFloorBaseSize && loc.x <= gMapSelectPositionB.x + _virtualFloorBaseSize
&& loc.y <= gMapSelectPositionB.y + _virtualFloorBaseSize)
// and if the current tile is near or on them
// (short-circuit to false otherwise - we don't want to show a second
// virtual floor from e. g. an open ride construction window)
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)
{
return true;
return loc >= gMapSelectPositionA - kVirtualFloorBaseSizeXY && loc <= gMapSelectPositionB + kVirtualFloorBaseSizeXY;
}
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT)
@ -200,8 +201,8 @@ bool VirtualFloorTileIsFloor(const CoordsXY& loc)
// Check if we are anywhere near the selection tiles (larger scenery / rides)
for (const auto& tile : gMapSelectionTiles)
{
if (loc.x >= tile.x - _virtualFloorBaseSize && loc.y >= tile.y - _virtualFloorBaseSize
&& loc.x <= tile.x + _virtualFloorBaseSize && loc.y <= tile.y + _virtualFloorBaseSize)
if (loc.x >= tile.x - kVirtualFloorBaseSize && loc.y >= tile.y - kVirtualFloorBaseSize
&& loc.x <= tile.x + kVirtualFloorBaseSize && loc.y <= tile.y + kVirtualFloorBaseSize)
{
return true;
}