mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Fix #23508: RideConstruction and Footpath windows racing to set the VirtualFloor
This commit is contained in:
committed by
GitHub
parent
20f191cf1f
commit
8a84f225e1
@@ -5,6 +5,7 @@
|
|||||||
- Improved: [#23540] The file browser now optionally shows a file size column.
|
- Improved: [#23540] The file browser now optionally shows a file size column.
|
||||||
- Change: [#23328] All RCT2 entertainer costumes are now available in legacy parks.
|
- 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: [#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.
|
- Fix: [#23581] [Plugin] Food/drink items given to guests have no consumption duration set.
|
||||||
|
|
||||||
0.4.18 (2025-01-08)
|
0.4.18 (2025-01-08)
|
||||||
|
|||||||
@@ -51,6 +51,7 @@
|
|||||||
#include <openrct2/windows/Intent.h>
|
#include <openrct2/windows/Intent.h>
|
||||||
#include <openrct2/world/ConstructionClearance.h>
|
#include <openrct2/world/ConstructionClearance.h>
|
||||||
#include <openrct2/world/Entrance.h>
|
#include <openrct2/world/Entrance.h>
|
||||||
|
#include <openrct2/world/Map.h>
|
||||||
#include <openrct2/world/Park.h>
|
#include <openrct2/world/Park.h>
|
||||||
#include <openrct2/world/tile_element/EntranceElement.h>
|
#include <openrct2/world/tile_element/EntranceElement.h>
|
||||||
#include <openrct2/world/tile_element/PathElement.h>
|
#include <openrct2/world/tile_element/PathElement.h>
|
||||||
@@ -1051,13 +1052,13 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
case WIDX_NEXT_SECTION:
|
case WIDX_NEXT_SECTION:
|
||||||
VirtualFloorInvalidate();
|
VirtualFloorInvalidate();
|
||||||
RideSelectNextSection();
|
RideSelectNextSection();
|
||||||
if (!isToolActive(WindowClass::Scenery))
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
||||||
VirtualFloorSetHeight(_currentTrackBegin.z);
|
VirtualFloorSetHeight(_currentTrackBegin.z);
|
||||||
break;
|
break;
|
||||||
case WIDX_PREVIOUS_SECTION:
|
case WIDX_PREVIOUS_SECTION:
|
||||||
VirtualFloorInvalidate();
|
VirtualFloorInvalidate();
|
||||||
RideSelectPreviousSection();
|
RideSelectPreviousSection();
|
||||||
if (!isToolActive(WindowClass::Scenery))
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
||||||
VirtualFloorSetHeight(_currentTrackBegin.z);
|
VirtualFloorSetHeight(_currentTrackBegin.z);
|
||||||
break;
|
break;
|
||||||
case WIDX_LEFT_CURVE:
|
case WIDX_LEFT_CURVE:
|
||||||
@@ -3163,7 +3164,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
// Invalidate previous track piece (we may not be changing height!)
|
// Invalidate previous track piece (we may not be changing height!)
|
||||||
VirtualFloorInvalidate();
|
VirtualFloorInvalidate();
|
||||||
|
|
||||||
if (!isToolActive(WindowClass::Scenery))
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
||||||
{
|
{
|
||||||
// Set height to where the next track piece would begin
|
// Set height to where the next track piece would begin
|
||||||
VirtualFloorSetHeight(_currentTrackBegin.z);
|
VirtualFloorSetHeight(_currentTrackBegin.z);
|
||||||
@@ -4766,7 +4767,7 @@ namespace OpenRCT2::Ui::Windows
|
|||||||
// Invalidate previous track piece (we may not be changing height!)
|
// Invalidate previous track piece (we may not be changing height!)
|
||||||
VirtualFloorInvalidate();
|
VirtualFloorInvalidate();
|
||||||
|
|
||||||
if (!isToolActive(WindowClass::Scenery))
|
if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
||||||
{
|
{
|
||||||
// Set height to where the next track piece would begin
|
// Set height to where the next track piece would begin
|
||||||
VirtualFloorSetHeight(trackPos.z - zBegin + zEnd);
|
VirtualFloorSetHeight(trackPos.z - zBegin + zEnd);
|
||||||
|
|||||||
@@ -30,7 +30,8 @@
|
|||||||
|
|
||||||
using namespace OpenRCT2;
|
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 uint16_t _virtualFloorHeight = 0;
|
||||||
static CoordsXYZ _virtualFloorLastMinPos;
|
static CoordsXYZ _virtualFloorLastMinPos;
|
||||||
static CoordsXYZ _virtualFloorLastMaxPos;
|
static CoordsXYZ _virtualFloorLastMaxPos;
|
||||||
@@ -130,10 +131,10 @@ void VirtualFloorInvalidate()
|
|||||||
&& max_position.y != std::numeric_limits<int32_t>::lowest());
|
&& max_position.y != std::numeric_limits<int32_t>::lowest());
|
||||||
|
|
||||||
// Apply the virtual floor size to the computed invalidation area.
|
// Apply the virtual floor size to the computed invalidation area.
|
||||||
min_position.x -= _virtualFloorBaseSize + 16;
|
min_position.x -= kVirtualFloorBaseSize + 16;
|
||||||
min_position.y -= _virtualFloorBaseSize + 16;
|
min_position.y -= kVirtualFloorBaseSize + 16;
|
||||||
max_position.x += _virtualFloorBaseSize + 16;
|
max_position.x += kVirtualFloorBaseSize + 16;
|
||||||
max_position.y += _virtualFloorBaseSize + 16;
|
max_position.y += kVirtualFloorBaseSize + 16;
|
||||||
|
|
||||||
// Invalidate previous region if appropriate.
|
// Invalidate previous region if appropriate.
|
||||||
if (_virtualFloorLastMinPos.x != std::numeric_limits<int32_t>::max()
|
if (_virtualFloorLastMinPos.x != std::numeric_limits<int32_t>::max()
|
||||||
@@ -188,11 +189,11 @@ bool VirtualFloorTileIsFloor(const CoordsXY& loc)
|
|||||||
|
|
||||||
// Check if map selection (usually single tiles) are enabled
|
// Check if map selection (usually single tiles) are enabled
|
||||||
// and if the current tile is near or on them
|
// and if the current tile is near or on them
|
||||||
if ((gMapSelectFlags & MAP_SELECT_FLAG_ENABLE) && loc.x >= gMapSelectPositionA.x - _virtualFloorBaseSize
|
// (short-circuit to false otherwise - we don't want to show a second
|
||||||
&& loc.y >= gMapSelectPositionA.y - _virtualFloorBaseSize && loc.x <= gMapSelectPositionB.x + _virtualFloorBaseSize
|
// virtual floor from e. g. an open ride construction window)
|
||||||
&& loc.y <= gMapSelectPositionB.y + _virtualFloorBaseSize)
|
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE)
|
||||||
{
|
{
|
||||||
return true;
|
return loc >= gMapSelectPositionA - kVirtualFloorBaseSizeXY && loc <= gMapSelectPositionB + kVirtualFloorBaseSizeXY;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT)
|
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)
|
// Check if we are anywhere near the selection tiles (larger scenery / rides)
|
||||||
for (const auto& tile : gMapSelectionTiles)
|
for (const auto& tile : gMapSelectionTiles)
|
||||||
{
|
{
|
||||||
if (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 + _virtualFloorBaseSize && loc.y <= tile.y + _virtualFloorBaseSize)
|
&& loc.x <= tile.x + kVirtualFloorBaseSize && loc.y <= tile.y + kVirtualFloorBaseSize)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user