Close #21400: draw staff patrol area selector on the water (#27067)

This commit is contained in:
Sjoerd de Bruin authored and GitHub committed 2026-09-12 08:40:52 +00:00
1 parent 829dd93bd0
commit e93fa5342a
5 files changed
+17 -11

No files matched your search

+1
View File
@@ -1,5 +1,6 @@
0.5.6 (in development)
------------------------------------------------------------------------
- Improved: [#21400] The selector for setting staff patrol areas is now drawn on the water as well as on the surface under water.
- Fix: [#21320] RCT1 allows more cars per train on some rides than OpenRCT2.
- Fix: [#24457] Yellow is always rendered as third remap in Ride window.
- Fix: [#26754] Switching window tabs by touch could crash the game on some Linux builds.
+2 -2
View File
@@ -485,9 +485,9 @@ namespace OpenRCT2::Ui::Windows
state_changed++;
}
if (gMapSelectType != MapSelectType::fullLandRights)
if (gMapSelectType != MapSelectType::fullTerrainAndWater)
{
gMapSelectType = MapSelectType::fullLandRights;
gMapSelectType = MapSelectType::fullTerrainAndWater;
state_changed++;
}
+10 -6
View File
@@ -7,8 +7,6 @@
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#include "../interface/ViewportQuery.h"
#include <openrct2-ui/interface/LandTool.h>
#include <openrct2-ui/interface/Widget.h>
#include <openrct2-ui/interface/Window.h>
@@ -162,7 +160,7 @@ namespace OpenRCT2::Ui::Windows
if (!gMapSelectFlags.has(MapSelectFlag::enable))
stateChanged = true;
if (gMapSelectType != MapSelectType::full)
if (gMapSelectType != MapSelectType::fullTerrainAndWater)
stateChanged = true;
auto toolSize = std::max<uint16_t>(1, gLandToolSize);
@@ -182,7 +180,7 @@ namespace OpenRCT2::Ui::Windows
if (stateChanged)
{
gMapSelectFlags.set(MapSelectFlag::enable);
gMapSelectType = MapSelectType::full;
gMapSelectType = MapSelectType::fullTerrainAndWater;
gMapSelectPositionA = posA;
gMapSelectPositionB = posB;
}
@@ -279,8 +277,14 @@ namespace OpenRCT2::Ui::Windows
std::optional<CoordsXY> GetBestCoordsFromPos(const ScreenCoordsXY& pos)
{
auto coords = FootpathGetCoordinatesFromPos(pos, nullptr, nullptr);
return coords.isNull() ? std::nullopt : std::make_optional(coords);
auto info = GetMapCoordinatesFromPos(
pos,
EnumsToFlags(
ViewportInteractionItem::terrain, ViewportInteractionItem::water, ViewportInteractionItem::footpath));
if (info.interactionType == ViewportInteractionItem::none)
return std::nullopt;
return info.Loc;
}
};
@@ -806,7 +806,8 @@ static std::pair<int32_t, int32_t> SurfaceGetHeightAboveWater(
std::optional<OpenRCT2::Drawing::Colour> GetPatrolAreaTileColour(const CoordsXY& pos)
{
bool selected = gMapSelectFlags.has(MapSelectFlag::enable) && gMapSelectType == MapSelectType::full
bool selected = gMapSelectFlags.has(MapSelectFlag::enable)
&& (gMapSelectType == MapSelectType::full || gMapSelectType == MapSelectType::fullTerrainAndWater)
&& pos.x >= gMapSelectPositionA.x && pos.x <= gMapSelectPositionB.x && pos.y >= gMapSelectPositionA.y
&& pos.y <= gMapSelectPositionB.y;
@@ -1131,7 +1132,7 @@ void PaintSurface(PaintSession& session, uint8_t direction, uint16_t height, con
const auto image_id = ImageId(SPR_TERRAIN_SELECTION_CORNER + Byte97B444[surfaceShape], fpId);
PaintAttachToPreviousPS(session, image_id, 0, 0);
}
else if (mapSelectionType == MapSelectType::fullLandRights)
else if (mapSelectionType == MapSelectType::fullTerrainAndWater)
{
auto [waterHeight, waterSurfaceShape] = SurfaceGetHeightAboveWater(tileElement, height, surfaceShape);
+1 -1
View File
@@ -35,7 +35,7 @@ enum class MapSelectType : uint8_t
corner3,
full,
fullWater,
fullLandRights,
fullTerrainAndWater,
quarter0,
quarter1,
quarter2,