Create enum class for EntranceType

This commit is contained in:
Gymnasiast committed 2026-08-12 16:16:07 +02:00
1 parent 34e8149e93
commit d943171fae
34 files changed
+149 -129

No files matched your search

@@ -333,7 +333,7 @@ namespace OpenRCT2::Ui
if (tileElement->getType() == TileElementType::entrance)
{
StringId stringId;
if (tileElement->asEntrance()->getEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
if (tileElement->asEntrance()->getEntranceType() == EntranceType::rideEntrance)
{
if (ride->numStations > 1)
{
+1 -1
View File
@@ -922,7 +922,7 @@ namespace OpenRCT2::Ui::Windows
break;
case TileElementType::entrance:
{
if (tileElement->asEntrance()->getEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE)
if (tileElement->asEntrance()->getEntranceType() == EntranceType::parkEntrance)
break;
Ride* targetRide = GetRide(tileElement->asEntrance()->getRideIndex());
if (targetRide != nullptr)
+15 -8
View File
@@ -315,8 +315,8 @@ namespace OpenRCT2::Ui::Windows
if (ToolSet(*this, widgetIndex, Tool::crosshair))
return;
gRideEntranceExitPlaceType = widgetIndex == WIDX_MAZE_ENTRANCE ? ENTRANCE_TYPE_RIDE_ENTRANCE
: ENTRANCE_TYPE_RIDE_EXIT;
gRideEntranceExitPlaceType = widgetIndex == WIDX_MAZE_ENTRANCE ? EntranceType::rideEntrance
: EntranceType::rideExit;
gRideEntranceExitPlaceRideIndex = rideId;
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
@@ -360,7 +360,7 @@ namespace OpenRCT2::Ui::Windows
auto rideEntranceExitPlaceAction = GameActions::RideEntranceExitPlaceAction(
entranceOrExitCoords, DirectionReverse(entranceOrExitCoords.direction), rideIndex,
gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT);
gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == EntranceType::rideExit);
rideEntranceExitPlaceAction.SetCallback([=, this](
const GameActions::GameAction* ga, const GameActions::Result* result) {
@@ -382,12 +382,19 @@ namespace OpenRCT2::Ui::Windows
}
else
{
gRideEntranceExitPlaceType = gRideEntranceExitPlaceType ^ 1;
WidgetIndex newToolWidgetIndex;
if (gRideEntranceExitPlaceType == EntranceType::rideEntrance)
{
gRideEntranceExitPlaceType = EntranceType::rideExit;
newToolWidgetIndex = WIDX_MAZE_EXIT;
}
else
{
gRideEntranceExitPlaceType = EntranceType::rideEntrance;
newToolWidgetIndex = WIDX_MAZE_ENTRANCE;
}
windowMgr->InvalidateByClass(WindowClass::rideConstruction);
auto newToolWidgetIndex = (gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_ENTRANCE) ? WIDX_MAZE_ENTRANCE
: WIDX_MAZE_EXIT;
ToolCancel();
ToolSet(*this, newToolWidgetIndex, Tool::crosshair);
+15 -9
View File
@@ -2443,7 +2443,7 @@ namespace OpenRCT2::Ui::Windows
}
else
{
gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_ENTRANCE;
gRideEntranceExitPlaceType = EntranceType::rideEntrance;
gRideEntranceExitPlaceRideIndex = _currentRideIndex;
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
@@ -2469,7 +2469,7 @@ namespace OpenRCT2::Ui::Windows
}
else
{
gRideEntranceExitPlaceType = ENTRANCE_TYPE_RIDE_EXIT;
gRideEntranceExitPlaceType = EntranceType::rideExit;
gRideEntranceExitPlaceRideIndex = _currentRideIndex;
gRideEntranceExitPlaceStationIndex = StationIndex::FromUnderlying(0);
gInputFlags.set(InputFlag::allowRightMouseRemoval);
@@ -2599,7 +2599,7 @@ namespace OpenRCT2::Ui::Windows
auto rideEntranceExitPlaceAction = GameActions::RideEntranceExitPlaceAction(
entranceOrExitCoords, DirectionReverse(gRideEntranceExitPlaceDirection), gRideEntranceExitPlaceRideIndex,
gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT);
gRideEntranceExitPlaceStationIndex, gRideEntranceExitPlaceType == EntranceType::rideExit);
rideEntranceExitPlaceAction.SetCallback(
[=, this](const GameActions::GameAction* ga, const GameActions::Result* result) {
@@ -2621,13 +2621,19 @@ namespace OpenRCT2::Ui::Windows
}
else
{
gRideEntranceExitPlaceType = gRideEntranceExitPlaceType ^ 1;
WidgetIndex newToolWidgetIndex;
if (gRideEntranceExitPlaceType == EntranceType::rideEntrance)
{
gRideEntranceExitPlaceType = EntranceType::rideExit;
newToolWidgetIndex = WC_RIDE_CONSTRUCTION__WIDX_EXIT;
}
else
{
gRideEntranceExitPlaceType = EntranceType::rideEntrance;
newToolWidgetIndex = WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE;
}
windowMgr->InvalidateByClass(WindowClass::rideConstruction);
auto newToolWidgetIndex = (gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_ENTRANCE)
? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE
: WC_RIDE_CONSTRUCTION__WIDX_EXIT;
ToolCancel();
ToolSet(*this, newToolWidgetIndex, Tool::crosshair);
}
+5 -5
View File
@@ -1389,10 +1389,10 @@ namespace OpenRCT2::Ui::Windows
// Details
// Entrance type
auto ft = Formatter();
ft.Add<StringId>(kEntranceTypeStringIds[entranceEl.getEntranceType()]);
ft.Add<StringId>(kEntranceTypeStringIds[EnumValue(entranceEl.getEntranceType())]);
drawText(rt, screenCoords, STR_TILE_INSPECTOR_ENTRANCE_TYPE, ft, { colours[1] });
if (entranceEl.getEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE)
if (entranceEl.getEntranceType() == EntranceType::parkEntrance)
{
// TODO: Make this work with Left/Right park entrance parts
ft = Formatter();
@@ -1404,7 +1404,7 @@ namespace OpenRCT2::Ui::Windows
{
ft = Formatter();
ft.Add<int16_t>(entranceEl.getStationIndex().ToUnderlying());
if (entranceEl.getEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
if (entranceEl.getEntranceType() == EntranceType::rideEntrance)
{
// Ride entrance ID
drawText(
@@ -1419,7 +1419,7 @@ namespace OpenRCT2::Ui::Windows
}
}
if (entranceEl.getEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE)
if (entranceEl.getEntranceType() == EntranceType::parkEntrance)
{
// Entrance part
ft = Formatter();
@@ -2343,7 +2343,7 @@ namespace OpenRCT2::Ui::Windows
setWidgetDisabled(
WIDX_ENTRANCE_BUTTON_MAKE_USABLE,
tileElement->asEntrance()->getEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE);
tileElement->asEntrance()->getEntranceType() == EntranceType::parkEntrance);
break;
case TileElementType::wall:
@@ -162,7 +162,7 @@ namespace OpenRCT2::GameActions
for (auto* entranceElement : TileElementsView<EntranceElement>(loc))
{
if (entranceElement->getEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)
if (entranceElement->getEntranceType() != EntranceType::parkEntrance)
continue;
// Do not allow ownership of park entrance.
@@ -161,7 +161,7 @@ namespace OpenRCT2::GameActions
entranceElement->setGhost(flags.has(CommandFlag::ghost));
entranceElement->setDirection(_loc.direction);
entranceElement->setSequenceIndex(index);
entranceElement->setEntranceType(ENTRANCE_TYPE_PARK_ENTRANCE);
entranceElement->setEntranceType(EntranceType::parkEntrance);
entranceElement->setEntryIndex(_entranceType);
if (!_pathTypeIsLegacy)
{
@@ -206,7 +206,7 @@ namespace OpenRCT2::GameActions
entranceElement->setDirection(_direction);
entranceElement->setClearanceZ(clear_z);
entranceElement->setEntranceType(_isExit ? ENTRANCE_TYPE_RIDE_EXIT : ENTRANCE_TYPE_RIDE_ENTRANCE);
entranceElement->setEntranceType(_isExit ? EntranceType::rideExit : EntranceType::rideEntrance);
entranceElement->setStationIndex(_stationNum);
entranceElement->setRideIndex(_rideIndex);
entranceElement->setGhost(GetFlags().has(CommandFlag::ghost));
@@ -48,7 +48,7 @@ namespace OpenRCT2::GameActions
}
static TileElement* FindEntranceElement(
const CoordsXY& loc, RideId rideIndex, StationIndex stationNum, int32_t entranceType)
const CoordsXY& loc, RideId rideIndex, StationIndex stationNum, EntranceType entranceType)
{
for (auto* entranceElement : TileElementsView<EntranceElement>(loc))
{
@@ -91,7 +91,7 @@ namespace OpenRCT2::GameActions
}
auto* entranceElement = FindEntranceElement(
_loc, _rideIndex, _stationNum, _isExit ? ENTRANCE_TYPE_RIDE_EXIT : ENTRANCE_TYPE_RIDE_ENTRANCE);
_loc, _rideIndex, _stationNum, _isExit ? EntranceType::rideExit : EntranceType::rideEntrance);
// If we are trying to remove a ghost and the element we found is real, return an error, but don't log a warning
if (entranceElement != nullptr && (GetFlags().has(CommandFlag::ghost)) && !(entranceElement->isGhost()))
@@ -127,7 +127,7 @@ namespace OpenRCT2::GameActions
}
auto* entranceElement = FindEntranceElement(
_loc, _rideIndex, _stationNum, _isExit ? ENTRANCE_TYPE_RIDE_EXIT : ENTRANCE_TYPE_RIDE_ENTRANCE);
_loc, _rideIndex, _stationNum, _isExit ? EntranceType::rideExit : EntranceType::rideEntrance);
// If we are trying to remove a ghost and the element we found is real, return an error, but don't log a warning
if (entranceElement != nullptr && isGhost && !(entranceElement->isGhost()))
+1 -1
View File
@@ -4953,7 +4953,7 @@ namespace OpenRCT2
}
if (tileElement->getType() == TileElementType::entrance
&& tileElement->asEntrance()->getEntranceType() == ENTRANCE_TYPE_RIDE_EXIT)
&& tileElement->asEntrance()->getEntranceType() == EntranceType::rideExit)
{
mazeType = MazeType::entranceOrExit;
break;
+6 -6
View File
@@ -1622,10 +1622,10 @@ namespace OpenRCT2
static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_t& pathing_result)
{
auto tile_element = coords.element;
uint8_t entranceType = tile_element->asEntrance()->getEntranceType();
auto entranceType = tile_element->asEntrance()->getEntranceType();
auto rideIndex = tile_element->asEntrance()->getRideIndex();
if ((entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE) || (entranceType == ENTRANCE_TYPE_RIDE_EXIT))
if ((entranceType == EntranceType::rideEntrance) || (entranceType == EntranceType::rideExit))
{
// If an entrance or exit that doesn't belong to the ride we are queuing for ignore the entrance/exit
// This can happen when paths clip through entrance/exits
@@ -1637,18 +1637,18 @@ namespace OpenRCT2
// Store some details to determine when to override the default
// behaviour (defined below) for when staff attempt to enter a ride
// to fix/inspect it.
if (entranceType == ENTRANCE_TYPE_RIDE_EXIT)
if (entranceType == EntranceType::rideExit)
{
pathing_result |= PATHING_RIDE_EXIT;
_peepRideEntranceExitElement = tile_element;
}
else if (entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE)
else if (entranceType == EntranceType::rideEntrance)
{
pathing_result |= PATHING_RIDE_ENTRANCE;
_peepRideEntranceExitElement = tile_element;
}
if (entranceType == ENTRANCE_TYPE_RIDE_EXIT)
if (entranceType == EntranceType::rideExit)
{
// Default guest/staff behaviour attempting to enter a
// ride exit is to turn around.
@@ -1657,7 +1657,7 @@ namespace OpenRCT2
return true;
}
if (entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE)
if (entranceType == EntranceType::rideEntrance)
{
auto ride = GetRide(rideIndex);
if (ride == nullptr)
@@ -43,7 +43,7 @@ static void PaintRideEntranceExitScrollingText(
if (stationObj.ScrollingMode == kScrollingModeNone)
return;
if (entranceEl.getEntranceType() == ENTRANCE_TYPE_RIDE_EXIT)
if (entranceEl.getEntranceType() == EntranceType::rideExit)
return;
const auto* ride = GetRide(entranceEl.getRideIndex());
@@ -71,7 +71,7 @@ static void PaintRideEntranceExitLightEffects(PaintSession& session, int32_t hei
if (LightFx::IsAvailable())
{
if (entranceEl.getEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
if (entranceEl.getEntranceType() == EntranceType::rideEntrance)
{
LightFx::Add3DLightMagicFromDrawingTile(session.MapPosition, 0, 0, height + 45, LightType::lantern3);
}
@@ -157,7 +157,7 @@ static void PaintRideEntranceExit(PaintSession& session, uint8_t direction, int3
// Each entrance is split into 2 images for drawing
// Certain entrance styles have another 2 images to draw for coloured windows
auto isExit = entranceEl.getEntranceType() == ENTRANCE_TYPE_RIDE_EXIT;
auto isExit = entranceEl.getEntranceType() == EntranceType::rideExit;
// Back
ImageIndex backImageIndex = (isExit ? stationObj->exitBackIndex : stationObj->entranceBackIndex) + direction;
@@ -345,11 +345,11 @@ void PaintEntrance(PaintSession& session, uint8_t direction, int32_t height, con
PaintHeightMarkers(session, entranceElement, height);
switch (entranceElement.getEntranceType())
{
case ENTRANCE_TYPE_RIDE_ENTRANCE:
case ENTRANCE_TYPE_RIDE_EXIT:
case EntranceType::rideEntrance:
case EntranceType::rideExit:
PaintRideEntranceExit(session, direction, height, entranceElement);
break;
case ENTRANCE_TYPE_PARK_ENTRANCE:
case EntranceType::parkEntrance:
PaintParkEntrance(session, direction, height, entranceElement);
break;
}
+6 -6
View File
@@ -426,7 +426,7 @@ namespace OpenRCT2::PathFinding
continue;
switch (tileElement->asEntrance()->getEntranceType())
{
case ENTRANCE_TYPE_RIDE_ENTRANCE:
case EntranceType::rideEntrance:
direction = tileElement->getDirection();
if (direction == chosenDirection)
{
@@ -434,7 +434,7 @@ namespace OpenRCT2::PathFinding
return PathSearchResult::rideEntrance;
}
break;
case ENTRANCE_TYPE_RIDE_EXIT:
case EntranceType::rideExit:
direction = tileElement->getDirection();
if (direction == chosenDirection)
{
@@ -442,7 +442,7 @@ namespace OpenRCT2::PathFinding
return PathSearchResult::rideExit;
}
break;
case ENTRANCE_TYPE_PARK_ENTRANCE:
case EntranceType::parkEntrance:
return PathSearchResult::parkExit;
}
break;
@@ -797,7 +797,7 @@ namespace OpenRCT2::PathFinding
searchResult = PathSearchResult::other;
switch (tileElement->asEntrance()->getEntranceType())
{
case ENTRANCE_TYPE_RIDE_ENTRANCE:
case EntranceType::rideEntrance:
/* For peeps heading for a ride without a queue, the
* goal is the ride entrance tile.
* For mechanics heading for the ride entrance
@@ -814,13 +814,13 @@ namespace OpenRCT2::PathFinding
break;
}
continue; // Ride entrance is not facing the right direction.
case ENTRANCE_TYPE_PARK_ENTRANCE:
case EntranceType::parkEntrance:
/* For peeps leaving the park, the goal is the park
* entrance/exit tile. */
searchResult = PathSearchResult::parkExit;
found = true;
break;
case ENTRANCE_TYPE_RIDE_EXIT:
case EntranceType::rideExit:
/* For mechanics heading for the ride exit, the
* goal is the ride exit tile. */
direction = tileElement->getDirection();
+2 -2
View File
@@ -1823,7 +1823,7 @@ namespace OpenRCT2::RCT1
dst2->setStationIndex(StationIndex::FromUnderlying(src2->GetStationIndex()));
dst2->setSequenceIndex(src2->GetSequenceIndex());
if (src2->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE)
if (src2->GetEntranceType() == EntranceType::parkEntrance)
{
auto pathType = src2->GetPathType();
if (pathType == 0)
@@ -2537,7 +2537,7 @@ namespace OpenRCT2::RCT1
if (element->getType() != TileElementType::entrance)
continue;
if (element->asEntrance()->getEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)
if (element->asEntrance()->getEntranceType() != EntranceType::parkEntrance)
continue;
if ((element->asEntrance()->getSequenceIndex()) != 0)
continue;
+1 -1
View File
@@ -431,7 +431,7 @@ uint8_t RCT12WallElement::GetRCT1Slope() const
return EntryIndex & 0b00011111;
}
uint8_t RCT12EntranceElement::GetEntranceType() const
OpenRCT2::EntranceType RCT12EntranceElement::GetEntranceType() const
{
return EntranceType;
}
+6 -5
View File
@@ -29,6 +29,7 @@
namespace OpenRCT2
{
class ObjectList;
enum class EntranceType : uint8_t;
enum class TrackElemType : uint16_t;
} // namespace OpenRCT2
@@ -862,12 +863,12 @@ static_assert(sizeof(RCT12WallElement) == 8);
struct RCT12EntranceElement : RCT12TileElementBase
{
private:
uint8_t EntranceType; // 4
uint8_t Index; // 5. 0bUSSS????, S = station index.
uint8_t PathType; // 6
uint8_t RideIndex; // 7
OpenRCT2::EntranceType EntranceType; // 4
uint8_t Index; // 5. 0bUSSS????, S = station index.
uint8_t PathType; // 6
uint8_t RideIndex; // 7
public:
uint8_t GetEntranceType() const;
OpenRCT2::EntranceType GetEntranceType() const;
uint8_t GetRideIndex() const;
uint8_t GetStationIndex() const;
uint8_t GetSequenceIndex() const;
+2 -2
View File
@@ -512,9 +512,9 @@ static void SwapRideEntranceAndExit(RideId rideId)
station.Exit = exitCoords;
auto entranceElement = MapGetRideExitElementAt(entranceCoords.ToCoordsXYZD(), false);
entranceElement->setEntranceType(ENTRANCE_TYPE_RIDE_ENTRANCE);
entranceElement->setEntranceType(EntranceType::rideEntrance);
auto exitElement = MapGetRideEntranceElementAt(exitCoords.ToCoordsXYZD(), false);
exitElement->setEntranceType(ENTRANCE_TYPE_RIDE_EXIT);
exitElement->setEntranceType(EntranceType::rideExit);
// Trigger footpath update
FootpathQueueChainReset();
+7 -7
View File
@@ -2212,7 +2212,7 @@ namespace OpenRCT2
if (ride == nullptr)
return;
if (entranceElement.getEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
if (entranceElement.getEntranceType() == EntranceType::rideEntrance)
{
// Get the queue length
int32_t queueLength = 0;
@@ -2787,8 +2787,8 @@ namespace OpenRCT2
break;
if (tileElement->getType() != TileElementType::entrance)
continue;
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE
&& tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_RIDE_EXIT)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::rideEntrance
&& tileElement->asEntrance()->getEntranceType() != EntranceType::rideExit)
{
continue;
}
@@ -5402,7 +5402,7 @@ namespace OpenRCT2
// The expected height is where entrances and exit reside in non-hacked parks.
const uint8_t expectedHeight = station.Height;
if (fixEntrance && entranceElement->getEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
if (fixEntrance && entranceElement->getEntranceType() == EntranceType::rideEntrance)
{
if (alreadyFoundEntrance)
{
@@ -5420,7 +5420,7 @@ namespace OpenRCT2
"Fixed disconnected entrance of ride %d, station %d to x = %d, y = %d and z = %d.",
ride.id, stationIndex, x, y, entranceElement->baseHeight);
}
else if (fixExit && entranceElement->getEntranceType() == ENTRANCE_TYPE_RIDE_EXIT)
else if (fixExit && entranceElement->getEntranceType() == EntranceType::rideExit)
{
if (alreadyFoundExit)
{
@@ -5466,8 +5466,8 @@ namespace OpenRCT2
{
for (auto* entrance : TileElementsView<EntranceElement>(tilePos.ToCoordsXY()))
{
const bool isRideEntranceExit = entrance->getEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE
|| entrance->getEntranceType() == ENTRANCE_TYPE_RIDE_EXIT;
const bool isRideEntranceExit = entrance->getEntranceType() == EntranceType::rideEntrance
|| entrance->getEntranceType() == EntranceType::rideExit;
if (!isRideEntranceExit)
continue;
if (entrance->getRideIndex() != ride.id)
+3 -1
View File
@@ -47,6 +47,7 @@ namespace OpenRCT2
struct TileElement;
struct TrackElement;
enum class EntranceType : uint8_t;
enum class RideMode : uint8_t;
enum class RideStatus : uint8_t;
@@ -852,7 +853,8 @@ namespace OpenRCT2
void RideGetStartOfTrack(CoordsXYE* output);
money64 RideEntranceExitPlaceGhost(
const Ride& ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum);
const Ride& ride, const CoordsXY& entranceExitCoords, Direction direction, EntranceType placeType,
StationIndex stationNum);
ResultWithMessage RideAreAllPossibleEntrancesAndExitsBuilt(const Ride& ride);
void RideFixBreakdown(Ride& ride, int32_t reliabilityIncreaseFactor);
+9 -9
View File
@@ -286,7 +286,7 @@ namespace OpenRCT2
CoordsXYZD _unkF440C5;
uint8_t gRideEntranceExitPlaceType;
EntranceType gRideEntranceExitPlaceType;
RideId gRideEntranceExitPlaceRideIndex;
StationIndex gRideEntranceExitPlaceStationIndex;
RideConstructionState gRideEntranceExitPlacePreviousRideConstructionState;
@@ -1063,7 +1063,7 @@ namespace OpenRCT2
return false;
auto entranceType = entranceElement->getEntranceType();
if (entranceType != ENTRANCE_TYPE_RIDE_ENTRANCE && entranceType != ENTRANCE_TYPE_RIDE_EXIT)
if (entranceType != EntranceType::rideEntrance && entranceType != EntranceType::rideExit)
return false;
auto stationIndex = entranceElement->getStationIndex();
@@ -1087,8 +1087,8 @@ namespace OpenRCT2
// Replace entrance / exit
ToolSet(
*constructionWindow,
entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE ? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE
: WC_RIDE_CONSTRUCTION__WIDX_EXIT,
entranceType == EntranceType::rideEntrance ? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE
: WC_RIDE_CONSTRUCTION__WIDX_EXIT,
Tool::crosshair);
gRideEntranceExitPlaceType = entranceType;
gRideEntranceExitPlaceRideIndex = rideIndex;
@@ -1107,14 +1107,14 @@ namespace OpenRCT2
{
// Remove entrance / exit
auto rideEntranceExitRemove = GameActions::RideEntranceExitRemoveAction(
{ tileElement.x, tileElement.y }, rideIndex, stationIndex, entranceType == ENTRANCE_TYPE_RIDE_EXIT);
{ tileElement.x, tileElement.y }, rideIndex, stationIndex, entranceType == EntranceType::rideExit);
rideEntranceExitRemove.SetCallback([=](const GameActions::GameAction* ga, const GameActions::Result* result) {
gRideEntranceExitPlaceType = entranceType;
windowMgr->InvalidateByClass(WindowClass::rideConstruction);
auto newToolWidgetIndex = (entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE) ? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE
: WC_RIDE_CONSTRUCTION__WIDX_EXIT;
auto newToolWidgetIndex = (entranceType == EntranceType::rideEntrance) ? WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE
: WC_RIDE_CONSTRUCTION__WIDX_EXIT;
ToolCancel();
ToolSet(*constructionWindow, newToolWidgetIndex, Tool::crosshair);
@@ -1551,7 +1551,7 @@ namespace OpenRCT2
if (tileElement->asEntrance()->getRideIndex() != id)
continue;
// if it's a park entrance continue to the next tile element
if (tileElement->asEntrance()->getEntranceType() > ENTRANCE_TYPE_RIDE_EXIT)
if (tileElement->asEntrance()->getEntranceType() > EntranceType::rideExit)
continue;
// find the station that's connected to this ride entrance
@@ -1597,7 +1597,7 @@ namespace OpenRCT2
}
auto& station = getStation(stationId);
if (tileElement->asEntrance()->getEntranceType() == ENTRANCE_TYPE_RIDE_EXIT)
if (tileElement->asEntrance()->getEntranceType() == EntranceType::rideExit)
{
// if the location is already set for this station, big problem!
if (!station.Exit.IsNull())
+2 -1
View File
@@ -36,6 +36,7 @@ namespace OpenRCT2
struct TrackDrawerEntry;
struct TileElement;
enum class EntranceType : uint8_t;
enum class TrackElemType : uint16_t;
namespace TrackMetadata
@@ -125,7 +126,7 @@ namespace OpenRCT2
extern CoordsXYZD _unkF440C5;
extern uint8_t gRideEntranceExitPlaceType;
extern EntranceType gRideEntranceExitPlaceType;
extern RideId gRideEntranceExitPlaceRideIndex;
extern StationIndex gRideEntranceExitPlaceStationIndex;
extern RideConstructionState gRideEntranceExitPlacePreviousRideConstructionState;
+2 -2
View File
@@ -404,7 +404,7 @@ ResultWithMessage TrackDesign::CreateTrackDesignMaze(TrackDesignState& tds, cons
return { false, STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY };
if (tileElement->getType() != TileElementType::entrance)
continue;
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::rideEntrance)
continue;
if (tileElement->asEntrance()->getRideIndex() == ride.id)
break;
@@ -431,7 +431,7 @@ ResultWithMessage TrackDesign::CreateTrackDesignMaze(TrackDesignState& tds, cons
{
if (tileElement->getType() != TileElementType::entrance)
continue;
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_RIDE_EXIT)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::rideExit)
continue;
if (tileElement->asEntrance()->getRideIndex() == ride.id)
break;
+2 -2
View File
@@ -564,9 +564,9 @@ static bool TrackDesignSaveShouldSelectSceneryAround(RideId rideIndex, TileEleme
break;
case TileElementType::entrance:
// FIXME: This will always break and return false!
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::rideEntrance)
break;
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_RIDE_EXIT)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::rideExit)
break;
if (tileElement->asEntrance()->getRideIndex() == rideIndex)
return true;
@@ -393,7 +393,7 @@ namespace OpenRCT2::Editor
case TileElementType::entrance:
{
auto parkEntranceEl = iter.element->asEntrance();
if (parkEntranceEl->getEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)
if (parkEntranceEl->getEntranceType() != EntranceType::parkEntrance)
break;
type = iter.element->asEntrance()->getEntryIndex();
@@ -1286,7 +1286,7 @@ namespace OpenRCT2::Scripting
case TileElementType::entrance:
{
auto* el = element->asEntrance();
return JS_NewUint32(ctx, el->getEntranceType());
return JS_NewUint32(ctx, EnumValue(el->getEntranceType()));
}
case TileElementType::banner:
{
@@ -1349,7 +1349,8 @@ namespace OpenRCT2::Scripting
{
JS_UNPACK_UINT32(index, ctx, jsValue);
auto* el = element->asEntrance();
el->setEntranceType(index);
index = std::clamp<uint32_t>(index, 0, 2);
el->setEntranceType(static_cast<EntranceType>(index));
Invalidate(data);
break;
}
+3 -3
View File
@@ -365,13 +365,13 @@ void MapGetObstructionErrorText(TileElement* tileElement, GameActions::Result& r
case TileElementType::entrance:
switch (tileElement->asEntrance()->getEntranceType())
{
case ENTRANCE_TYPE_RIDE_ENTRANCE:
case EntranceType::rideEntrance:
res.errorMessage = STR_RIDE_ENTRANCE_IN_THE_WAY;
break;
case ENTRANCE_TYPE_RIDE_EXIT:
case EntranceType::rideExit:
res.errorMessage = STR_RIDE_EXIT_IN_THE_WAY;
break;
case ENTRANCE_TYPE_PARK_ENTRANCE:
case EntranceType::parkEntrance:
res.errorMessage = STR_PARK_ENTRANCE_IN_THE_WAY;
break;
}
+5 -5
View File
@@ -29,10 +29,10 @@ CoordsXYZD gRideEntranceExitGhostPosition;
StationIndex gRideEntranceExitGhostStationIndex;
static money64 RideEntranceExitPlaceGhost(
RideId rideIndex, const CoordsXY& entranceExitCoords, Direction direction, uint8_t placeType, StationIndex stationNum)
RideId rideIndex, const CoordsXY& entranceExitCoords, Direction direction, EntranceType placeType, StationIndex stationNum)
{
auto rideEntranceExitPlaceAction = GameActions::RideEntranceExitPlaceAction(
entranceExitCoords, direction, rideIndex, stationNum, placeType == ENTRANCE_TYPE_RIDE_EXIT);
entranceExitCoords, direction, rideIndex, stationNum, placeType == EntranceType::rideExit);
rideEntranceExitPlaceAction.SetFlags({ CommandFlag::allowDuringPaused, CommandFlag::ghost });
auto res = GameActions::Execute(&rideEntranceExitPlaceAction, getGameState());
@@ -89,7 +89,7 @@ void OpenRCT2::RideEntranceExitRemoveGhost()
{
auto rideEntranceExitRemove = GameActions::RideEntranceExitRemoveAction(
gRideEntranceExitGhostPosition, _currentRideIndex, gRideEntranceExitGhostStationIndex,
gRideEntranceExitPlaceType == ENTRANCE_TYPE_RIDE_EXIT);
gRideEntranceExitPlaceType == EntranceType::rideExit);
rideEntranceExitRemove.SetFlags({ CommandFlag::ghost, CommandFlag::allowDuringPaused });
GameActions::Execute(&rideEntranceExitRemove, getGameState());
@@ -101,7 +101,7 @@ void OpenRCT2::RideEntranceExitRemoveGhost()
* rct2: 0x006CA28C
*/
money64 OpenRCT2::RideEntranceExitPlaceGhost(
const Ride& ride, const CoordsXY& entranceExitCoords, Direction direction, int32_t placeType, StationIndex stationNum)
const Ride& ride, const CoordsXY& entranceExitCoords, Direction direction, EntranceType placeType, StationIndex stationNum)
{
RideConstructionRemoveGhosts();
money64 result = RideEntranceExitPlaceGhost(ride.id, entranceExitCoords, direction, placeType, stationNum);
@@ -217,7 +217,7 @@ void ParkEntranceUpdateLocations()
while (TileElementIteratorNext(&it))
{
auto entranceElement = it.element->asEntrance();
if (entranceElement != nullptr && entranceElement->getEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE
if (entranceElement != nullptr && entranceElement->getEntranceType() == EntranceType::parkEntrance
&& entranceElement->getSequenceIndex() == 0 && !entranceElement->isGhost())
{
auto entrance = TileCoordsXYZD(it.x, it.y, it.element->baseHeight, it.element->getDirection()).ToCoordsXYZD();
+3 -3
View File
@@ -631,7 +631,7 @@ namespace OpenRCT2
}
else
{
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::parkEntrance)
{
FootpathQueueChainPush(tileElement->asEntrance()->getRideIndex());
}
@@ -956,7 +956,7 @@ namespace OpenRCT2
{
if (tileElement->getType() != TileElementType::entrance)
continue;
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::rideEntrance)
continue;
if (tileElement->asEntrance()->getRideIndex() != rideIndex)
continue;
@@ -1564,7 +1564,7 @@ namespace OpenRCT2
}
else if (elementType == TileElementType::entrance)
{
if (tileElement->asEntrance()->getEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
if (tileElement->asEntrance()->getEntranceType() == EntranceType::rideEntrance)
{
FootpathQueueChainPush(tileElement->asEntrance()->getRideIndex());
FootpathChainRideQueue(
+5 -5
View File
@@ -1027,7 +1027,7 @@ namespace OpenRCT2
}
break;
case TileElementType::entrance:
if (it.element->asEntrance()->getEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE)
if (it.element->asEntrance()->getEntranceType() == EntranceType::parkEntrance)
break;
[[fallthrough]];
case TileElementType::track:
@@ -1547,7 +1547,7 @@ namespace OpenRCT2
if (tileElement->baseHeight != entranceTileCoords.z)
continue;
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::parkEntrance)
continue;
if (!ghost && tileElement->isGhost())
@@ -1573,7 +1573,7 @@ namespace OpenRCT2
if (tileElement->baseHeight != entranceTileCoords.z)
continue;
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::rideEntrance)
continue;
if (!ghost && tileElement->isGhost())
@@ -1599,7 +1599,7 @@ namespace OpenRCT2
if (tileElement->baseHeight != exitTileCoords.z)
continue;
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_RIDE_EXIT)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::rideExit)
continue;
if (!ghost && tileElement->isGhost())
@@ -2128,7 +2128,7 @@ namespace OpenRCT2
auto type = tileElement->getType();
if (type == TileElementType::path
|| (type == TileElementType::entrance
&& tileElement->asEntrance()->getEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE))
&& tileElement->asEntrance()->getEntranceType() == EntranceType::parkEntrance))
{
destOwnership = OWNERSHIP_CONSTRUCTION_RIGHTS_OWNED;
// Do not own construction rights if too high/below surface
+4 -4
View File
@@ -90,7 +90,7 @@ template<bool invalidate, bool invalidateAllViewports>
static bool UpdateEntranceAnimation(
const EntranceElement& entrance, const CoordsXYZ& loc, const int32_t baseZ, const Viewport* const viewport)
{
if (entrance.getEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
if (entrance.getEntranceType() == EntranceType::rideEntrance)
{
const auto* const ride = GetRide(entrance.getRideIndex());
if (ride != nullptr)
@@ -108,7 +108,7 @@ static bool UpdateEntranceAnimation(
}
}
}
else if (entrance.getEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE && entrance.getSequenceIndex() == 0)
else if (entrance.getEntranceType() == EntranceType::parkEntrance && entrance.getSequenceIndex() == 0)
{
if constexpr (invalidate)
{
@@ -559,11 +559,11 @@ static std::optional<UpdateType> IsElementAnimated(const TileElementBase& elemen
case TileElementType::entrance:
{
const auto* const entrance = element.asEntrance();
if (entrance->getEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE && entrance->getSequenceIndex() == 0)
if (entrance->getEntranceType() == EntranceType::parkEntrance && entrance->getSequenceIndex() == 0)
{
return std::optional(UpdateType::invalidate);
}
else if (entrance->getEntranceType() == ENTRANCE_TYPE_RIDE_ENTRANCE)
else if (entrance->getEntranceType() == EntranceType::rideEntrance)
{
return std::optional(UpdateType::invalidate);
}
+1 -1
View File
@@ -653,7 +653,7 @@ namespace OpenRCT2::Park
if (tileElement->getType() != TileElementType::entrance)
continue;
if (tileElement->asEntrance()->getEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)
if (tileElement->asEntrance()->getEntranceType() != EntranceType::parkEntrance)
continue;
if (!(tileElement->isGhost()))
+11 -9
View File
@@ -241,17 +241,17 @@ namespace OpenRCT2::TileInspector
auto& station = ride->getStation(stationIndex);
auto entrance = station.Entrance;
auto exit = station.Exit;
uint8_t entranceType = tileElement->asEntrance()->getEntranceType();
auto entranceType = tileElement->asEntrance()->getEntranceType();
uint8_t z = tileElement->baseHeight;
// Make sure this is the correct entrance or exit
if (entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE && entrance.x == loc.x / kCoordsXYStep
if (entranceType == EntranceType::rideEntrance && entrance.x == loc.x / kCoordsXYStep
&& entrance.y == loc.y / kCoordsXYStep && entrance.z == z)
{
station.Entrance = { entrance, newRotation };
}
else if (
entranceType == ENTRANCE_TYPE_RIDE_EXIT && exit.x == loc.x / kCoordsXYStep
entranceType == EntranceType::rideExit && exit.x == loc.x / kCoordsXYStep
&& exit.y == loc.y / kCoordsXYStep && exit.z == z)
{
station.Exit = { exit, newRotation };
@@ -460,8 +460,8 @@ namespace OpenRCT2::TileInspector
{
if (tileElement->getType() == TileElementType::entrance)
{
uint8_t entranceType = tileElement->asEntrance()->getEntranceType();
if (entranceType != ENTRANCE_TYPE_PARK_ENTRANCE)
auto entranceType = tileElement->asEntrance()->getEntranceType();
if (entranceType != EntranceType::parkEntrance)
{
// Update the ride's known entrance or exit height
auto ride = GetRide(tileElement->asEntrance()->getRideIndex());
@@ -474,9 +474,9 @@ namespace OpenRCT2::TileInspector
uint8_t z = tileElement->baseHeight;
// Make sure this is the correct entrance or exit
if (entranceType == ENTRANCE_TYPE_RIDE_ENTRANCE && entranceLoc == TileCoordsXYZ{ loc, z })
if (entranceType == EntranceType::rideEntrance && entranceLoc == TileCoordsXYZ{ loc, z })
station.Entrance = { entranceLoc, z + heightOffset, entranceLoc.direction };
else if (entranceType == ENTRANCE_TYPE_RIDE_EXIT && exitLoc == TileCoordsXYZ{ loc, z })
else if (entranceType == EntranceType::rideExit && exitLoc == TileCoordsXYZ{ loc, z })
station.Exit = { exitLoc, z + heightOffset, exitLoc.direction };
}
}
@@ -655,12 +655,14 @@ namespace OpenRCT2::TileInspector
switch (entranceElement->asEntrance()->getEntranceType())
{
case ENTRANCE_TYPE_RIDE_ENTRANCE:
case EntranceType::rideEntrance:
station.Entrance = { loc, entranceElement->baseHeight, entranceElement->getDirection() };
break;
case ENTRANCE_TYPE_RIDE_EXIT:
case EntranceType::rideExit:
station.Exit = { loc, entranceElement->baseHeight, entranceElement->getDirection() };
break;
default:
break;
}
}
@@ -17,18 +17,18 @@
namespace OpenRCT2
{
// rct2: 0x0097B974
static constexpr uint16_t kEntranceDirections[] = {
(4), 0, 0, 0, 0, 0, 0, 0, // ENTRANCE_TYPE_RIDE_ENTRANCE,
(4), 0, 0, 0, 0, 0, 0, 0, // ENTRANCE_TYPE_RIDE_EXIT,
(4 | 1), 0, 0, 0, 0, 0, 0, 0, // ENTRANCE_TYPE_PARK_ENTRANCE
};
static constexpr std::array<std::array<uint16_t, 8>, 3> kEntranceDirections = { {
{ (4), 0, 0, 0, 0, 0, 0, 0 }, // EntranceType::rideEntrance,
{ (4), 0, 0, 0, 0, 0, 0, 0 }, // EntranceType::rideExit,
{ (4 | 1), 0, 0, 0, 0, 0, 0, 0 }, // EntranceType::parkEntrance
} };
uint8_t EntranceElement::getEntranceType() const
EntranceType EntranceElement::getEntranceType() const
{
return entranceType;
}
void EntranceElement::setEntranceType(uint8_t newType)
void EntranceElement::setEntranceType(EntranceType newType)
{
entranceType = newType;
}
@@ -129,7 +129,7 @@ namespace OpenRCT2
int32_t EntranceElement::getDirections() const
{
return kEntranceDirections[(getEntranceType() * 8) + getSequenceIndex()];
return kEntranceDirections[EnumValue(getEntranceType())][getSequenceIndex()];
}
ObjectEntryIndex EntranceElement::getEntryIndex() const
@@ -21,11 +21,11 @@ namespace OpenRCT2
class FootpathSurfaceObject;
struct PathSurfaceDescriptor;
enum
enum class EntranceType : uint8_t
{
ENTRANCE_TYPE_RIDE_ENTRANCE,
ENTRANCE_TYPE_RIDE_EXIT,
ENTRANCE_TYPE_PARK_ENTRANCE
rideEntrance,
rideExit,
parkEntrance
};
enum
@@ -47,7 +47,7 @@ namespace OpenRCT2
static constexpr TileElementType kElementType = TileElementType::entrance;
private:
uint8_t entranceType; // 5
EntranceType entranceType; // 5
uint8_t sequenceIndex; // 6. Only uses the lower nibble.
StationIndex stationIndex; // 7
ObjectEntryIndex pathType; // 8
@@ -60,8 +60,8 @@ namespace OpenRCT2
#pragma clang diagnostic pop
public:
uint8_t getEntranceType() const;
void setEntranceType(uint8_t newType);
EntranceType getEntranceType() const;
void setEntranceType(EntranceType newType);
RideId getRideIndex() const;
void setRideIndex(RideId newRideIndex);