mirror of https://github.com/OpenRCT2/OpenRCT2.git
Use strong enum for ViewportSetVisibility (#20230)
This commit is contained in:
parent
fe2d1e2372
commit
4a79af7b20
|
@ -181,7 +181,7 @@ public:
|
|||
void OnClose() override
|
||||
{
|
||||
FootpathProvisionalUpdate();
|
||||
ViewportSetVisibility(0);
|
||||
ViewportSetVisibility(ViewportVisibility::Default);
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
WindowInvalidateByClass(WindowClass::TopToolbar);
|
||||
|
@ -1048,7 +1048,7 @@ private:
|
|||
|
||||
if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||
{
|
||||
ViewportSetVisibility(1);
|
||||
ViewportSetVisibility(ViewportVisibility::UndergroundViewOn);
|
||||
}
|
||||
|
||||
gFootpathConstructFromPosition = footpathLoc;
|
||||
|
|
|
@ -107,7 +107,7 @@ public:
|
|||
void OnClose() override
|
||||
{
|
||||
RideConstructionInvalidateCurrentTrack();
|
||||
ViewportSetVisibility(0);
|
||||
ViewportSetVisibility(ViewportVisibility::Default);
|
||||
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
|
|
|
@ -249,7 +249,7 @@ public:
|
|||
void OnClose() override
|
||||
{
|
||||
RideConstructionInvalidateCurrentTrack();
|
||||
ViewportSetVisibility(0);
|
||||
ViewportSetVisibility(ViewportVisibility::Default);
|
||||
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
|
@ -2236,14 +2236,14 @@ private:
|
|||
const auto resultData = res.GetData<TrackPlaceActionResult>();
|
||||
if (resultData.GroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||
{
|
||||
ViewportSetVisibility(1);
|
||||
ViewportSetVisibility(ViewportVisibility::UndergroundViewOn);
|
||||
}
|
||||
|
||||
const bool helixSelected = (_currentTrackCurve & RideConstructionSpecialPieceSelected)
|
||||
&& TrackTypeIsHelix(_currentTrackCurve & ~RideConstructionSpecialPieceSelected);
|
||||
if (helixSelected || (_currentTrackSlopeEnd != TRACK_SLOPE_NONE))
|
||||
{
|
||||
ViewportSetVisibility(2);
|
||||
ViewportSetVisibility(ViewportVisibility::TrackHeights);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -216,7 +216,7 @@ public:
|
|||
{
|
||||
SceneryRemoveGhostToolPlacement();
|
||||
HideGridlines();
|
||||
ViewportSetVisibility(0);
|
||||
ViewportSetVisibility(ViewportVisibility::Default);
|
||||
|
||||
if (gWindowSceneryScatterEnabled)
|
||||
WindowCloseByClass(WindowClass::SceneryScatter);
|
||||
|
|
|
@ -1338,12 +1338,12 @@ private:
|
|||
if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||
{
|
||||
// Set underground on
|
||||
ViewportSetVisibility(4);
|
||||
ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOn);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set underground off
|
||||
ViewportSetVisibility(5);
|
||||
ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOff);
|
||||
}
|
||||
|
||||
gSceneryGhostType |= SCENERY_GHOST_FLAG_0;
|
||||
|
@ -1420,12 +1420,12 @@ private:
|
|||
if (placementData.GroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||
{
|
||||
// Set underground on
|
||||
ViewportSetVisibility(4);
|
||||
ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOn);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Set underground off
|
||||
ViewportSetVisibility(5);
|
||||
ViewportSetVisibility(ViewportVisibility::UndergroundViewGhostOff);
|
||||
}
|
||||
|
||||
gSceneryGhostType |= SCENERY_GHOST_FLAG_3;
|
||||
|
|
|
@ -92,7 +92,7 @@ public:
|
|||
void OnClose() override
|
||||
{
|
||||
ClearProvisional();
|
||||
ViewportSetVisibility(0);
|
||||
ViewportSetVisibility(ViewportVisibility::Default);
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT;
|
||||
gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW;
|
||||
|
|
|
@ -1315,7 +1315,7 @@ void HideConstructionRights()
|
|||
*
|
||||
* rct2: 0x006CB70A
|
||||
*/
|
||||
void ViewportSetVisibility(uint8_t mode)
|
||||
void ViewportSetVisibility(ViewportVisibility mode)
|
||||
{
|
||||
WindowBase* window = WindowGetMain();
|
||||
|
||||
|
@ -1326,7 +1326,7 @@ void ViewportSetVisibility(uint8_t mode)
|
|||
|
||||
switch (mode)
|
||||
{
|
||||
case 0:
|
||||
case ViewportVisibility::Default:
|
||||
{ // Set all these flags to 0, and invalidate if any were active
|
||||
uint32_t mask = VIEWPORT_FLAG_UNDERGROUND_INSIDE | VIEWPORT_FLAG_HIDE_RIDES | VIEWPORT_FLAG_HIDE_SCENERY
|
||||
| VIEWPORT_FLAG_HIDE_PATHS | VIEWPORT_FLAG_LAND_HEIGHTS | VIEWPORT_FLAG_TRACK_HEIGHTS
|
||||
|
@ -1338,19 +1338,19 @@ void ViewportSetVisibility(uint8_t mode)
|
|||
vp->flags &= ~mask;
|
||||
break;
|
||||
}
|
||||
case 1: // 6CB79D
|
||||
case 4: // 6CB7C4
|
||||
case ViewportVisibility::UndergroundViewOn: // 6CB79D
|
||||
case ViewportVisibility::UndergroundViewGhostOn: // 6CB7C4
|
||||
// Set underground on, invalidate if it was off
|
||||
invalidate += !(vp->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE);
|
||||
vp->flags |= VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
||||
break;
|
||||
case 2: // 6CB7EB
|
||||
case ViewportVisibility::TrackHeights: // 6CB7EB
|
||||
// Set track heights on, invalidate if off
|
||||
invalidate += !(vp->flags & VIEWPORT_FLAG_TRACK_HEIGHTS);
|
||||
vp->flags |= VIEWPORT_FLAG_TRACK_HEIGHTS;
|
||||
break;
|
||||
case 3: // 6CB7B1
|
||||
case 5: // 6CB7D8
|
||||
case ViewportVisibility::UndergroundViewOff: // 6CB7B1
|
||||
case ViewportVisibility::UndergroundViewGhostOff: // 6CB7D8
|
||||
// Set underground off, invalidate if it was on
|
||||
invalidate += vp->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE;
|
||||
vp->flags &= ~(static_cast<uint16_t>(VIEWPORT_FLAG_UNDERGROUND_INSIDE));
|
||||
|
|
|
@ -89,6 +89,16 @@ enum class ViewportInteractionItem : uint8_t
|
|||
Banner
|
||||
};
|
||||
|
||||
enum class ViewportVisibility : uint8_t
|
||||
{
|
||||
Default = 0,
|
||||
UndergroundViewOn = 1,
|
||||
TrackHeights = 2,
|
||||
UndergroundViewOff = 3,
|
||||
UndergroundViewGhostOn = 4,
|
||||
UndergroundViewGhostOff = 5,
|
||||
};
|
||||
|
||||
constexpr uint16_t ViewportInteractionItemAll = std::numeric_limits<uint16_t>::max();
|
||||
|
||||
struct InteractionInfo
|
||||
|
@ -148,7 +158,7 @@ void ShowLandRights();
|
|||
void HideLandRights();
|
||||
void ShowConstructionRights();
|
||||
void HideConstructionRights();
|
||||
void ViewportSetVisibility(uint8_t mode);
|
||||
void ViewportSetVisibility(ViewportVisibility mode);
|
||||
|
||||
InteractionInfo GetMapCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32_t flags);
|
||||
InteractionInfo GetMapCoordinatesFromPosWindow(WindowBase* window, const ScreenCoordsXY& screenCoords, int32_t flags);
|
||||
|
|
|
@ -60,9 +60,9 @@ money64 PlaceProvisionalTrackPiece(
|
|||
|
||||
_unkF440C5 = { trackPos, static_cast<Direction>(trackDirection) };
|
||||
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK;
|
||||
ViewportSetVisibility(3);
|
||||
ViewportSetVisibility(ViewportVisibility::UndergroundViewOff);
|
||||
if (_currentTrackSlopeEnd != 0)
|
||||
ViewportSetVisibility(2);
|
||||
ViewportSetVisibility(ViewportVisibility::TrackHeights);
|
||||
|
||||
// Invalidate previous track piece (we may not be changing height!)
|
||||
VirtualFloorInvalidate();
|
||||
|
@ -102,9 +102,11 @@ money64 PlaceProvisionalTrackPiece(
|
|||
_currentTrackSelectionFlags |= TRACK_SELECTION_FLAG_TRACK;
|
||||
|
||||
const auto resultData = res.GetData<TrackPlaceActionResult>();
|
||||
ViewportSetVisibility((resultData.GroundFlags & ELEMENT_IS_UNDERGROUND) ? 1 : 3);
|
||||
const auto visiblity = (resultData.GroundFlags & ELEMENT_IS_UNDERGROUND) ? ViewportVisibility::UndergroundViewOn
|
||||
: ViewportVisibility::UndergroundViewOff;
|
||||
ViewportSetVisibility(visiblity);
|
||||
if (_currentTrackSlopeEnd != 0)
|
||||
ViewportSetVisibility(2);
|
||||
ViewportSetVisibility(ViewportVisibility::TrackHeights);
|
||||
|
||||
// Invalidate previous track piece (we may not be changing height!)
|
||||
VirtualFloorInvalidate();
|
||||
|
|
|
@ -160,11 +160,11 @@ money64 FootpathProvisionalSet(
|
|||
|
||||
if (gFootpathGroundFlags & ELEMENT_IS_UNDERGROUND)
|
||||
{
|
||||
ViewportSetVisibility(1);
|
||||
ViewportSetVisibility(ViewportVisibility::UndergroundViewOn);
|
||||
}
|
||||
else
|
||||
{
|
||||
ViewportSetVisibility(3);
|
||||
ViewportSetVisibility(ViewportVisibility::UndergroundViewOff);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue