Rename Location.hpp members to camelCase (#27085)

This commit is contained in:
Harry Hopkinson authored and GitHub committed 2026-09-07 22:58:24 +02:00
1 parent b8a5e2431c
commit 092783cc11
122 files changed
+599 -599

No files matched your search

+1 -1
View File
@@ -523,7 +523,7 @@ static void ShortcutToggleWallSlope()
extern TileCoordsXY windowTileInspectorTile;
auto modifyTile = GameActions::TileModifyAction(
windowTileInspectorTile.ToCoordsXY(), GameActions::TileModifyType::wallSetSlope, windowTileInspectorSelectedIndex,
windowTileInspectorTile.toCoordsXY(), GameActions::TileModifyType::wallSetSlope, windowTileInspectorSelectedIndex,
newSlopeValue);
GameActions::Execute(&modifyTile, getGameState());
}
@@ -395,7 +395,7 @@ namespace OpenRCT2::Ui
stationIndex = tileElement->asTrack()->getStationIndex().ToUnderlying();
for (int32_t i = stationIndex; i >= 0; i--)
if (ride->getStations()[i].start.IsNull())
if (ride->getStations()[i].start.isNull())
stationIndex--;
stationIndex++;
ft.Add<uint16_t>(stationIndex);
@@ -793,7 +793,7 @@ namespace OpenRCT2::Ui
if (window == nullptr || window->viewport == nullptr)
{
CoordsXY ret{};
ret.SetNull();
ret.setNull();
return ret;
}
auto viewport = window->viewport;
@@ -803,7 +803,7 @@ namespace OpenRCT2::Ui
if (info.interactionType == ViewportInteractionItem::none)
{
initialPos.SetNull();
initialPos.setNull();
return initialPos;
}
@@ -828,6 +828,6 @@ namespace OpenRCT2::Ui
mapPos.y = std::clamp(mapPos.y, initialPos.y, initialPos.y + 31);
}
return mapPos.ToTileStart();
return mapPos.toTileStart();
}
} // namespace OpenRCT2::Ui
+5 -5
View File
@@ -41,7 +41,7 @@ namespace OpenRCT2::Ui
if (window == nullptr || window->viewport == nullptr)
{
CoordsXY position{};
position.SetNull();
position.setNull();
return position;
}
auto viewport = window->viewport;
@@ -54,7 +54,7 @@ namespace OpenRCT2::Ui
if (info.interactionType == ViewportInteractionItem::none)
{
auto position = info.Loc;
position.SetNull();
position.setNull();
return position;
}
}
@@ -62,7 +62,7 @@ namespace OpenRCT2::Ui
auto minPosition = info.Loc;
auto maxPosition = info.Loc + CoordsXY{ 31, 31 };
auto myTileElement = info.Element;
auto position = info.Loc.ToTileCentre();
auto position = info.Loc.toTileCentre();
auto z = 0;
if (info.interactionType == ViewportInteractionItem::footpath)
{
@@ -112,7 +112,7 @@ namespace OpenRCT2::Ui
}
}
position = position.ToTileStart();
position = position.toTileStart();
if (direction != nullptr)
*direction = myDirection;
@@ -140,7 +140,7 @@ namespace OpenRCT2::Ui
if (window == nullptr || window->viewport == nullptr)
{
CoordsXY ret{};
ret.SetNull();
ret.setNull();
return ret;
}
auto viewport = window->viewport;
+6 -6
View File
@@ -401,7 +401,7 @@ namespace OpenRCT2
auto ride = GetRide(gRideEntranceExitPlaceRideIndex);
if (ride == nullptr)
{
entranceExitCoords.SetNull();
entranceExitCoords.setNull();
return entranceExitCoords;
}
@@ -410,22 +410,22 @@ namespace OpenRCT2
auto coordsAtHeight = ScreenGetMapXYWithZ(screenCoords, stationBaseZ);
if (!coordsAtHeight.has_value())
{
entranceExitCoords.SetNull();
entranceExitCoords.setNull();
return entranceExitCoords;
}
entranceExitCoords = { coordsAtHeight->ToTileStart(), stationBaseZ, kInvalidDirection };
entranceExitCoords = { coordsAtHeight->toTileStart(), stationBaseZ, kInvalidDirection };
if (ride->type == kRideTypeNull)
{
entranceExitCoords.SetNull();
entranceExitCoords.setNull();
return entranceExitCoords;
}
auto stationStart = ride->getStation(gRideEntranceExitPlaceStationIndex).start;
if (stationStart.IsNull())
if (stationStart.isNull())
{
entranceExitCoords.SetNull();
entranceExitCoords.setNull();
return entranceExitCoords;
}
+2 -2
View File
@@ -134,7 +134,7 @@ namespace OpenRCT2::Ui::Windows
if (bannerElement == nullptr)
return;
_bannerViewPos = CoordsXYZ{ banner->position.ToCoordsXY().ToTileCentre(), bannerElement->getBaseZ() };
_bannerViewPos = CoordsXYZ{ banner->position.toCoordsXY().toTileCentre(), bannerElement->getBaseZ() };
createViewport();
}
@@ -195,7 +195,7 @@ namespace OpenRCT2::Ui::Windows
break;
auto bannerRemoveAction = GameActions::BannerRemoveAction(
{ banner->position.ToCoordsXY(), bannerElement->getBaseZ(), bannerElement->getPosition() });
{ banner->position.toCoordsXY(), bannerElement->getBaseZ(), bannerElement->getPosition() });
GameActions::Execute(&bannerRemoveAction, gameState);
break;
}
+1 -1
View File
@@ -270,7 +270,7 @@ namespace OpenRCT2::Ui::Windows
// Move to tool bottom left
mapTile->x -= (tool_size - 1) * 16;
mapTile->y -= (tool_size - 1) * 16;
mapTile = mapTile->ToTileStart();
mapTile = mapTile->toTileStart();
if (gMapSelectPositionA.x != mapTile->x)
{
@@ -145,13 +145,13 @@ namespace OpenRCT2::Ui::Windows
CoordsXYZD parkEntranceMapPosition{ 0, 0, 0, kInvalidDirection };
const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords);
parkEntranceMapPosition = { mapCoords.x, mapCoords.y, 0, kInvalidDirection };
if (parkEntranceMapPosition.IsNull())
if (parkEntranceMapPosition.isNull())
return parkEntranceMapPosition;
auto surfaceElement = MapGetSurfaceElementAt(mapCoords);
if (surfaceElement == nullptr)
{
parkEntranceMapPosition.SetNull();
parkEntranceMapPosition.setNull();
return parkEntranceMapPosition;
}
@@ -181,7 +181,7 @@ namespace OpenRCT2::Ui::Windows
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow, MapSelectFlag::enableConstruct);
CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords);
if (parkEntrancePosition.IsNull())
if (parkEntrancePosition.isNull())
{
ParkEntranceRemoveGhost();
return;
@@ -229,7 +229,7 @@ namespace OpenRCT2::Ui::Windows
ParkEntranceRemoveGhost();
CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords);
if (!parkEntrancePosition.IsNull())
if (!parkEntrancePosition.isNull())
{
bool isLegacyPath = (gFootpathSelection.legacyPath != kObjectEntryIndexNull);
auto pathIndex = isLegacyPath ? gFootpathSelection.legacyPath : gFootpathSelection.normalSurface;
+5 -5
View File
@@ -1019,7 +1019,7 @@ namespace OpenRCT2::Ui::Windows
if (mapCoords.x == kLocationNull)
return std::nullopt;
return mapCoords.ToTileStart();
return mapCoords.toTileStart();
}
FootpathPlacementResult FootpathGetPlacementFromInfo(const InteractionInfo& info)
@@ -1224,7 +1224,7 @@ namespace OpenRCT2::Ui::Windows
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow);
auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement);
if (mapCoords.IsNull())
if (mapCoords.isNull())
{
return;
}
@@ -1278,7 +1278,7 @@ namespace OpenRCT2::Ui::Windows
gMapSelectFlags.set(MapSelectFlag::enable);
gMapSelectType = MapSelectType::full;
auto correctedPosition = mapPos->ToTileStart();
auto correctedPosition = mapPos->toTileStart();
setMapSelectRange(correctedPosition);
_dragStartPos = correctedPosition;
WindowFootpathSetProvisionalPathDragArea(getMapSelectRange(), placement.baseZ);
@@ -1302,7 +1302,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
auto correctedPos = mapPos->ToTileStart();
auto correctedPos = mapPos->toTileStart();
// For queues, only allow selecting a single line.
if (gFootpathSelection.isQueueSelected)
@@ -1503,7 +1503,7 @@ namespace OpenRCT2::Ui::Windows
TileElement* tileElement;
auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement);
if (mapCoords.IsNull())
if (mapCoords.isNull())
{
return;
}
+3 -3
View File
@@ -647,7 +647,7 @@ namespace OpenRCT2::Ui::Windows
}
_pickedPeepX = peep->x;
CoordsXYZ nullLoc{};
nullLoc.SetNull();
nullLoc.setNull();
GameActions::PeepPickupAction pickupAction{ GameActions::PeepPickupType::pickup,
EntityId::FromUnderlying(number), nullLoc,
Network::GetCurrentPlayerId() };
@@ -979,7 +979,7 @@ namespace OpenRCT2::Ui::Windows
gMapSelectFlags.unset(MapSelectFlag::enable);
auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr);
if (!mapCoords.IsNull())
if (!mapCoords.isNull())
{
gMapSelectFlags.set(MapSelectFlag::enable);
gMapSelectType = MapSelectType::full;
@@ -1017,7 +1017,7 @@ namespace OpenRCT2::Ui::Windows
TileElement* tileElement;
auto destCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, &tileElement);
if (destCoords.IsNull())
if (destCoords.isNull())
return;
GameActions::PeepPickupAction pickupAction{ GameActions::PeepPickupType::place,
+1 -1
View File
@@ -335,7 +335,7 @@ namespace OpenRCT2::Ui::Windows
screenPos.y += 4;
if (!td.statistics.spaceRequired.IsNull())
if (!td.statistics.spaceRequired.isNull())
{
// Space required
auto ft = Formatter();
+4 -4
View File
@@ -483,7 +483,7 @@ namespace OpenRCT2::Ui::Windows
// Move to tool bottom left
mapTile->x -= (tool_size - 1) * 16;
mapTile->y -= (tool_size - 1) * 16;
mapTile = mapTile->ToTileStart();
mapTile = mapTile->toTileStart();
if (gMapSelectPositionA.x != mapTile->x)
{
@@ -772,19 +772,19 @@ namespace OpenRCT2::Ui::Windows
case MapSelectType::edge2:
// Line
mapTile->y -= (tool_size - 1) * 16;
mapTile->y = mapTile->ToTileStart().y;
mapTile->y = mapTile->toTileStart().y;
break;
case MapSelectType::edge1:
case MapSelectType::edge3:
// Line
mapTile->x -= (tool_size - 1) * 16;
mapTile->x = mapTile->ToTileStart().x;
mapTile->x = mapTile->toTileStart().x;
break;
default:
// Move to tool bottom left
mapTile->x -= (tool_size - 1) * 16;
mapTile->y -= (tool_size - 1) * 16;
mapTile = mapTile->ToTileStart();
mapTile = mapTile->toTileStart();
break;
}
+1 -1
View File
@@ -500,7 +500,7 @@ namespace OpenRCT2::Ui::Windows
// Move to tool bottom left
mapTile.x -= (tool_size - 1) * 16;
mapTile.y -= (tool_size - 1) * 16;
mapTile = mapTile.ToTileStart();
mapTile = mapTile.toTileStart();
if (gMapSelectPositionA.x != mapTile.x)
{
+3 -3
View File
@@ -458,7 +458,7 @@ namespace OpenRCT2::Ui::Windows
TileElement* tileElement;
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow);
auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement);
if (mapCoords.IsNull())
if (mapCoords.isNull())
return;
int32_t mapZ = tileElement->getBaseZ();
@@ -484,7 +484,7 @@ namespace OpenRCT2::Ui::Windows
TileElement* tileElement;
int32_t direction;
auto mapCoords = FootpathGetCoordinatesFromPos(screenCoords, &direction, &tileElement);
if (mapCoords.IsNull())
if (mapCoords.isNull())
return;
int32_t mapZ = tileElement->getBaseZ();
@@ -1138,7 +1138,7 @@ namespace OpenRCT2::Ui::Windows
{
screenCoords.x = ((screenCoords.x + 8) - getPracticalMapSize()) / 2;
screenCoords.y = ((screenCoords.y + 8)) / 2;
auto location = TileCoordsXY(screenCoords.y - screenCoords.x, screenCoords.x + screenCoords.y).ToCoordsXY();
auto location = TileCoordsXY(screenCoords.y - screenCoords.x, screenCoords.x + screenCoords.y).toCoordsXY();
switch (GetCurrentRotation())
{
+2 -2
View File
@@ -137,7 +137,7 @@ namespace OpenRCT2::Ui::Windows
auto currentRide = GetRide(_currentRideIndex);
if (currentRide != nullptr)
{
if (currentRide->overallView.IsNull())
if (currentRide->overallView.isNull())
{
auto gameAction = GameActions::RideDemolishAction(currentRide->id, GameActions::RideModifyType::demolish);
gameAction.SetFlags({ CommandFlag::allowDuringPaused });
@@ -350,7 +350,7 @@ namespace OpenRCT2::Ui::Windows
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
CoordsXYZD entranceOrExitCoords = RideGetEntranceOrExitPositionFromScreenPosition(screenCoords);
if (entranceOrExitCoords.IsNull())
if (entranceOrExitCoords.isNull())
return;
if (gRideEntranceExitPlaceDirection == kInvalidDirection)
+2 -2
View File
@@ -171,7 +171,7 @@ namespace OpenRCT2::Ui::Windows
// Move to tool bottom left
mapTile->x -= (toolSize - 1) * 16;
mapTile->y -= (toolSize - 1) * 16;
mapTile = mapTile->ToTileStart();
mapTile = mapTile->toTileStart();
auto posA = *mapTile;
mapTile->x += toolLength;
mapTile->y += toolLength;
@@ -280,7 +280,7 @@ 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);
return coords.isNull() ? std::nullopt : std::make_optional(coords);
}
};
+1 -1
View File
@@ -230,7 +230,7 @@ namespace OpenRCT2::Ui::Windows
{
if (viewport == nullptr)
{
const auto viewportFocus = Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ());
const auto viewportFocus = Focus(TileCoordsXYZ(128, 128, 0).toCoordsXYZ());
ViewportCreate(*this, windowPos, width, height, viewportFocus);
flags |= WindowFlag::noScrolling;
onPrepareDraw();
+7 -7
View File
@@ -1471,7 +1471,7 @@ namespace OpenRCT2::Ui::Windows
if (it.element->asTrack()->getRideIndex() != ride.id)
continue;
auto location = TileCoordsXY(it.x, it.y).ToCoordsXY();
auto location = TileCoordsXY(it.x, it.y).toCoordsXY();
int32_t baseZ = it.element->getBaseZ();
int32_t clearZ = it.element->getClearanceZ();
@@ -1528,7 +1528,7 @@ namespace OpenRCT2::Ui::Windows
for (const auto& station : ride->getStations())
{
if (!station.start.IsNull() && viewSelectionIndex-- == 0)
if (!station.start.isNull() && viewSelectionIndex-- == 0)
{
const auto stationIndex = ride->getStationIndex(&station);
return std::make_optional(stationIndex);
@@ -1613,7 +1613,7 @@ namespace OpenRCT2::Ui::Windows
focus = newFocus;
// rct2: 0x006aec9c only used here so brought it into the function
if (viewport == nullptr && !ride->overallView.IsNull() && focus.has_value())
if (viewport == nullptr && !ride->overallView.isNull() && focus.has_value())
{
const auto& viewWidget = widgets[WIDX_VIEWPORT];
@@ -2563,14 +2563,14 @@ namespace OpenRCT2::Ui::Windows
// Entrance / exit
if (ride->status == RideStatus::closed)
{
if (station.entrance.IsNull())
if (station.entrance.isNull())
stringId = STR_NO_ENTRANCE;
else if (station.exit.IsNull())
else if (station.exit.isNull())
stringId = STR_NO_EXIT;
}
else
{
if (station.entrance.IsNull())
if (station.entrance.isNull())
stringId = STR_EXIT_ONLY;
}
// Queue length
@@ -7288,7 +7288,7 @@ namespace OpenRCT2::Ui::Windows
// View
for (int32_t i = stationIndex.ToUnderlying(); i >= 0; i--)
{
if (ride.getStations()[i].start.IsNull())
if (ride.getStations()[i].start.isNull())
{
stationIndex = StationIndex::FromUnderlying(stationIndex.ToUnderlying() - 1);
}
+6 -6
View File
@@ -2234,7 +2234,7 @@ namespace OpenRCT2::Ui::Windows
for (uint8_t i = 0; i < ted.sequenceData.numSequences; i++)
{
CoordsXY offsets = { ted.sequenceData.sequences[i].clearance.x, ted.sequenceData.sequences[i].clearance.y };
CoordsXY currentTileCoords = tileCoords + offsets.Rotate(trackDirection);
CoordsXY currentTileCoords = tileCoords + offsets.rotate(trackDirection);
MapSelection::addSelectedTile(currentTileCoords);
}
@@ -2664,7 +2664,7 @@ namespace OpenRCT2::Ui::Windows
mapCoords.y = 0;
}
auto rotatedMapCoords = mapCoords.Rotate(trackDirection);
auto rotatedMapCoords = mapCoords.rotate(trackDirection);
// this is actually case 0, but the other cases all jump to it
mapCoords.x = 4112 + (rotatedMapCoords.x / 2);
mapCoords.y = 4112 + (rotatedMapCoords.y / 2);
@@ -2731,7 +2731,7 @@ namespace OpenRCT2::Ui::Windows
auto quarterTile = trackBlock.quarterTile.Rotate(trackDirection);
CoordsXY offsets = { trackBlock.x, trackBlock.y };
CoordsXY coords = originCoords + offsets.Rotate(trackDirection);
CoordsXY coords = originCoords + offsets.rotate(trackDirection);
int32_t baseZ = originZ + trackBlock.z;
int32_t clearanceZ = trackBlock.clearanceZ + clearanceHeight + baseZ + (4 * kCoordsZStep);
@@ -3063,7 +3063,7 @@ namespace OpenRCT2::Ui::Windows
if (!_trackPlaceCtrlState)
{
mapCoords = ViewportInteractionGetTileStartAtCursor(screenCoords);
if (mapCoords.IsNull())
if (mapCoords.isNull())
return std::nullopt;
_trackPlaceZ = 0;
@@ -3101,7 +3101,7 @@ namespace OpenRCT2::Ui::Windows
if (mapCoords.x == kLocationNull)
return std::nullopt;
return mapCoords.ToTileStart();
return mapCoords.toTileStart();
}
/**
@@ -4918,7 +4918,7 @@ namespace OpenRCT2::Ui::Windows
CoordsXY offsets = { trackCoordinates.x, trackCoordinates.y };
CoordsXY coords = { x, y };
coords += offsets.Rotate(DirectionReverse(trackDirection));
coords += offsets.rotate(DirectionReverse(trackDirection));
x = static_cast<uint16_t>(coords.x);
y = static_cast<uint16_t>(coords.y);
}
+34 -34
View File
@@ -1784,7 +1784,7 @@ namespace OpenRCT2::Ui::Windows
updatePlacementSmallScenery(screenPos, selection.EntryIndex, mapTile, &quadrant, &rotation);
if (mapTile.IsNull())
if (mapTile.isNull())
{
SceneryRemoveGhostToolPlacement();
return;
@@ -1861,7 +1861,7 @@ namespace OpenRCT2::Ui::Windows
updatePlacementPathItem(screenPos, selection.EntryIndex, mapTile, &z);
if (mapTile.IsNull())
if (mapTile.isNull())
{
SceneryRemoveGhostToolPlacement();
return;
@@ -1901,7 +1901,7 @@ namespace OpenRCT2::Ui::Windows
updatePlacementWall(screenPos, selection.EntryIndex, mapTile, &edge);
if (mapTile.IsNull())
if (mapTile.isNull())
{
SceneryRemoveGhostToolPlacement();
return;
@@ -1951,7 +1951,7 @@ namespace OpenRCT2::Ui::Windows
updatePlacementLargeScenery(screenPos, selection.EntryIndex, mapTile, &direction);
if (mapTile.IsNull())
if (mapTile.isNull())
{
SceneryRemoveGhostToolPlacement();
return;
@@ -1972,7 +1972,7 @@ namespace OpenRCT2::Ui::Windows
MapSelection::clearSelectedTiles();
for (auto& tile : sceneryEntry->tiles)
{
MapSelection::addSelectedTile(mapTile + tile.offset.Rotate(direction));
MapSelection::addSelectedTile(mapTile + tile.offset.rotate(direction));
}
SceneryRemoveGhostToolPlacement();
@@ -2010,7 +2010,7 @@ namespace OpenRCT2::Ui::Windows
updatePlacementBanner(screenPos, selection.EntryIndex, mapTile, &z, &direction);
if (mapTile.IsNull())
if (mapTile.isNull())
{
SceneryRemoveGhostToolPlacement();
return;
@@ -2475,7 +2475,7 @@ namespace OpenRCT2::Ui::Windows
const auto* sceneryEntry = ObjectEntryManager::GetObjectEntry<SmallSceneryEntry>(sceneryIndex);
if (sceneryEntry == nullptr)
{
gridPos.SetNull();
gridPos.setNull();
return;
}
@@ -2498,7 +2498,7 @@ namespace OpenRCT2::Ui::Windows
auto gridCoords = ScreenGetMapXYQuadrant(screenPos, &quadrant);
if (!gridCoords.has_value())
{
gridPos.SetNull();
gridPos.setNull();
return;
}
gridPos = gridCoords.value();
@@ -2512,7 +2512,7 @@ namespace OpenRCT2::Ui::Windows
if (surfaceElement == nullptr)
{
gridPos.SetNull();
gridPos.setNull();
return;
}
@@ -2531,7 +2531,7 @@ namespace OpenRCT2::Ui::Windows
auto mapCoords = ScreenGetMapXYQuadrantWithZ(screenPos, z, &quadrant);
if (!mapCoords.has_value())
{
gridPos.SetNull();
gridPos.setNull();
return;
}
gridPos = mapCoords.value();
@@ -2547,7 +2547,7 @@ namespace OpenRCT2::Ui::Windows
gSceneryPlaceZ = z;
}
if (gridPos.IsNull())
if (gridPos.isNull())
return;
uint8_t rotation = gWindowSceneryRotation;
@@ -2581,7 +2581,7 @@ namespace OpenRCT2::Ui::Windows
if (info.interactionType == ViewportInteractionItem::none)
{
gridPos.SetNull();
gridPos.setNull();
return;
}
@@ -2595,7 +2595,7 @@ namespace OpenRCT2::Ui::Windows
if (surfaceElement == nullptr)
{
gridPos.SetNull();
gridPos.setNull();
return;
}
@@ -2617,7 +2617,7 @@ namespace OpenRCT2::Ui::Windows
}
else
{
gridPos.SetNull();
gridPos.setNull();
}
// If SHIFT pressed
if (gSceneryShiftPressed)
@@ -2630,10 +2630,10 @@ namespace OpenRCT2::Ui::Windows
gSceneryPlaceZ = z;
}
if (gridPos.IsNull())
if (gridPos.isNull())
return;
gridPos = gridPos.ToTileStart();
gridPos = gridPos.toTileStart();
uint8_t rotation = gWindowSceneryRotation;
if (!sceneryEntry->flags.has(SmallSceneryFlag::isRotatable))
@@ -2666,7 +2666,7 @@ namespace OpenRCT2::Ui::Windows
if (info.interactionType == ViewportInteractionItem::none)
{
gridPos.SetNull();
gridPos.setNull();
return;
}
@@ -2701,7 +2701,7 @@ namespace OpenRCT2::Ui::Windows
auto gridCoords = ScreenGetMapXYSide(screenPos, &edge);
if (!gridCoords.has_value())
{
gridPos.SetNull();
gridPos.setNull();
return;
}
gridPos = gridCoords.value();
@@ -2715,7 +2715,7 @@ namespace OpenRCT2::Ui::Windows
if (surfaceElement == nullptr)
{
gridPos.SetNull();
gridPos.setNull();
return;
}
@@ -2733,7 +2733,7 @@ namespace OpenRCT2::Ui::Windows
auto mapCoords = ScreenGetMapXYSideWithZ(screenPos, z, &edge);
if (!mapCoords.has_value())
{
gridPos.SetNull();
gridPos.setNull();
return;
}
gridPos = mapCoords.value();
@@ -2749,10 +2749,10 @@ namespace OpenRCT2::Ui::Windows
gSceneryPlaceZ = z;
}
if (gridPos.IsNull())
if (gridPos.isNull())
return;
gridPos = gridPos.ToTileStart();
gridPos = gridPos.toTileStart();
if (Config::Get().general.virtualFloorStyle != VirtualFloorStyles::off)
{
@@ -2789,7 +2789,7 @@ namespace OpenRCT2::Ui::Windows
const CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(screenPos);
gridPos = mapCoords;
if (gridPos.IsNull())
if (gridPos.isNull())
return;
gSceneryPlaceZ = 0;
@@ -2801,7 +2801,7 @@ namespace OpenRCT2::Ui::Windows
if (surfaceElement == nullptr)
{
gridPos.SetNull();
gridPos.setNull();
return;
}
@@ -2823,7 +2823,7 @@ namespace OpenRCT2::Ui::Windows
}
else
{
gridPos.SetNull();
gridPos.setNull();
}
// If SHIFT pressed
@@ -2837,10 +2837,10 @@ namespace OpenRCT2::Ui::Windows
gSceneryPlaceZ = z;
}
if (gridPos.IsNull())
if (gridPos.isNull())
return;
gridPos = gridPos.ToTileStart();
gridPos = gridPos.toTileStart();
Direction rotation = gWindowSceneryRotation;
rotation -= GetCurrentRotation();
@@ -2868,7 +2868,7 @@ namespace OpenRCT2::Ui::Windows
if (info.interactionType == ViewportInteractionItem::none)
{
gridPos.SetNull();
gridPos.setNull();
return;
}
@@ -2902,7 +2902,7 @@ namespace OpenRCT2::Ui::Windows
Direction rotation;
updatePlacementSmallScenery(screenCoords, selectedScenery, gridPos, &quadrant, &rotation);
if (gridPos.IsNull())
if (gridPos.isNull())
return;
int32_t quantity = 1;
@@ -3029,7 +3029,7 @@ namespace OpenRCT2::Ui::Windows
int32_t z;
updatePlacementPathItem(screenCoords, selectedScenery, gridPos, &z);
if (gridPos.IsNull())
if (gridPos.isNull())
return;
auto footpathAdditionPlaceAction = GameActions::FootpathAdditionPlaceAction({ gridPos, z }, selectedScenery);
@@ -3067,7 +3067,7 @@ namespace OpenRCT2::Ui::Windows
coords = info.Loc;
}
coords = coords.ToTileStart();
coords = coords.toTileStart();
return coords;
}
@@ -3076,7 +3076,7 @@ namespace OpenRCT2::Ui::Windows
CoordsXY gridPos;
uint8_t edges;
updatePlacementWall(screenCoords, selectedScenery, gridPos, &edges);
if (gridPos.IsNull())
if (gridPos.isNull())
return;
uint8_t zAttemptRange = 1;
@@ -3347,7 +3347,7 @@ namespace OpenRCT2::Ui::Windows
CoordsXY gridPos;
Direction direction;
updatePlacementLargeScenery(screenCoords, selectedScenery, gridPos, &direction);
if (gridPos.IsNull())
if (gridPos.isNull())
return;
uint8_t zAttemptRange = 1;
@@ -3409,7 +3409,7 @@ namespace OpenRCT2::Ui::Windows
int32_t z;
Direction direction;
updatePlacementBanner(screenCoords, selectedScenery, gridPos, &z, &direction);
if (gridPos.IsNull())
if (gridPos.isNull())
return;
CoordsXYZD loc{ gridPos, z, direction };
+3 -3
View File
@@ -100,7 +100,7 @@ namespace OpenRCT2::Ui::Windows
return false;
}
auto signViewPosition = banner->position.ToCoordsXY().ToTileCentre();
auto signViewPosition = banner->position.toCoordsXY().toTileCentre();
auto* tileElement = BannerGetTileElement(GetBannerIndex());
if (tileElement == nullptr)
return false;
@@ -166,7 +166,7 @@ namespace OpenRCT2::Ui::Windows
close();
return;
}
auto bannerCoords = banner->position.ToCoordsXY();
auto bannerCoords = banner->position.toCoordsXY();
if (_isSmall)
{
@@ -312,7 +312,7 @@ namespace OpenRCT2::Ui::Windows
return;
}
auto signViewPos = CoordsXYZ{ banner->position.ToCoordsXY().ToTileCentre(), currentFrame };
auto signViewPos = CoordsXYZ{ banner->position.toCoordsXY().toTileCentre(), currentFrame };
// Create viewport
Widget* viewportWidget = &widgets[WIDX_VIEWPORT];
+3 -3
View File
@@ -381,7 +381,7 @@ namespace OpenRCT2::Ui::Windows
{
_pickedPeepOldX = staff->x;
CoordsXYZ nullLoc{};
nullLoc.SetNull();
nullLoc.setNull();
GameActions::PeepPickupAction pickupAction{ GameActions::PeepPickupType::pickup,
EntityId::FromUnderlying(number), nullLoc,
Network::GetCurrentPlayerId() };
@@ -670,7 +670,7 @@ namespace OpenRCT2::Ui::Windows
gMapSelectFlags.unset(MapSelectFlag::enable);
auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr);
if (!mapCoords.IsNull())
if (!mapCoords.isNull())
{
gMapSelectFlags.set(MapSelectFlag::enable);
gMapSelectType = MapSelectType::full;
@@ -709,7 +709,7 @@ namespace OpenRCT2::Ui::Windows
TileElement* tileElement;
auto destCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, &tileElement);
if (destCoords.IsNull())
if (destCoords.isNull())
return;
GameActions::PeepPickupAction pickupAction{ GameActions::PeepPickupType::place,
+2 -2
View File
@@ -556,7 +556,7 @@ namespace OpenRCT2::Ui::Windows
if (staff->state == PeepState::picked)
{
CoordsXYZ nullLoc{};
nullLoc.SetNull();
nullLoc.setNull();
GameActions::PeepPickupAction pickupAction{ GameActions::PeepPickupType::pickup, staff->id, nullLoc,
Network::GetCurrentPlayerId() };
@@ -653,7 +653,7 @@ namespace OpenRCT2::Ui::Windows
int32_t direction{};
TileElement* tileElement{};
auto footpathCoords = FootpathGetCoordinatesFromPos(screenCoords, &direction, &tileElement);
if (footpathCoords.IsNull())
if (footpathCoords.isNull())
return nullptr;
auto isPatrolAreaSet = IsPatrolAreaSetForStaffType(GetSelectedStaffType(), footpathCoords);
+1 -1
View File
@@ -1822,7 +1822,7 @@ namespace OpenRCT2::Ui::Windows
// Invalidate the previous selection
if (auto* elem = OpenRCT2::TileInspector::GetSelectedElement(); elem != nullptr)
{
MapInvalidateElement(windowTileInspectorTile.ToCoordsXY(), elem);
MapInvalidateElement(windowTileInspectorTile.toCoordsXY(), elem);
}
_tileSelected = true;
+9 -9
View File
@@ -122,7 +122,7 @@ namespace OpenRCT2::Ui::Windows
ShowGridlines();
_miniPreview.resize(kTrackMiniPreviewSize.width * kTrackMiniPreviewSize.height);
_placementCost = kMoney64Undefined;
_placementLoc.SetNull();
_placementLoc.setNull();
_currentTrackPieceDirection = (2 - GetCurrentRotation()) & 3;
}
@@ -149,14 +149,14 @@ namespace OpenRCT2::Ui::Windows
clearProvisional();
_currentTrackPieceDirection = (_currentTrackPieceDirection + 1) & 3;
invalidate();
_placementLoc.SetNull();
_placementLoc.setNull();
DrawMiniPreview(*_trackDesign);
break;
case WIDX_MIRROR:
TrackDesignMirror(*_trackDesign);
_currentTrackPieceDirection = (0 - _currentTrackPieceDirection) & 3;
invalidate();
_placementLoc.SetNull();
_placementLoc.setNull();
DrawMiniPreview(*_trackDesign);
break;
case WIDX_SELECT_DIFFERENT_DESIGN:
@@ -196,7 +196,7 @@ namespace OpenRCT2::Ui::Windows
// Get the tool map position
CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(targetScreenCoords);
if (mapCoords.IsNull())
if (mapCoords.isNull())
{
clearProvisional();
return;
@@ -276,7 +276,7 @@ namespace OpenRCT2::Ui::Windows
// Get the tool map position
CoordsXY mapCoords = ViewportInteractionGetTileStartAtCursor(targetScreenCoords);
if (mapCoords.IsNull())
if (mapCoords.isNull())
{
clearProvisional();
return;
@@ -603,7 +603,7 @@ namespace OpenRCT2::Ui::Windows
{
for (const auto& entrance : td.entranceElements)
{
auto rotatedAndOffsetEntrance = origin + entrance.location.ToCoordsXY().Rotate(rotation);
auto rotatedAndOffsetEntrance = origin + entrance.location.toCoordsXY().rotate(rotation);
if (pass == 0)
{
@@ -645,7 +645,7 @@ namespace OpenRCT2::Ui::Windows
{
const auto& trackBlock = ted.sequenceData.sequences[sequenceIndex].clearance;
auto rotatedAndOffsetTrackBlock = curTrackStart
+ CoordsXY{ trackBlock.x, trackBlock.y }.Rotate(curTrackRotation);
+ CoordsXY{ trackBlock.x, trackBlock.y }.rotate(curTrackRotation);
if (pass == 0)
{
@@ -688,7 +688,7 @@ namespace OpenRCT2::Ui::Windows
const TrackCoordinates* track_coordinate = &ted.coordinates;
curTrackStart += CoordsXY{ track_coordinate->x, track_coordinate->y }.Rotate(curTrackRotation);
curTrackStart += CoordsXY{ track_coordinate->x, track_coordinate->y }.rotate(curTrackRotation);
curTrackRotation += track_coordinate->rotationEnd - track_coordinate->rotationBegin;
curTrackRotation &= 3;
if (track_coordinate->rotationEnd & 4)
@@ -709,7 +709,7 @@ namespace OpenRCT2::Ui::Windows
uint8_t rotation = (_currentTrackPieceDirection + GetCurrentRotation()) & 3;
for (const auto& mazeElement : td.mazeElements)
{
auto rotatedMazeCoords = origin + mazeElement.location.ToCoordsXY().Rotate(rotation);
auto rotatedMazeCoords = origin + mazeElement.location.toCoordsXY().rotate(rotation);
if (pass == 0)
{
+1 -1
View File
@@ -651,7 +651,7 @@ namespace OpenRCT2::Ui::Windows
screenPos.y += 4;
}
if (!_loadedTrackDesign->statistics.spaceRequired.IsNull())
if (!_loadedTrackDesign->statistics.spaceRequired.isNull())
{
// Space required
ft = Formatter();
+1 -1
View File
@@ -78,7 +78,7 @@ namespace OpenRCT2::Ui::Windows
setWidgets(_viewportWidgets);
// Create viewport
ViewportCreate(*this, windowPos, width, height, Focus(TileCoordsXYZ(128, 128, 0).ToCoordsXYZ()));
ViewportCreate(*this, windowPos, width, height, Focus(TileCoordsXYZ(128, 128, 0).toCoordsXYZ()));
if (viewport == nullptr)
{
close();
+1 -1
View File
@@ -362,7 +362,7 @@ namespace OpenRCT2::Ui::Windows
// Move to tool bottom left
mapTile.x -= tool_length / 2;
mapTile.y -= tool_length / 2;
mapTile = mapTile.ToTileStart();
mapTile = mapTile.toTileStart();
if (gMapSelectPositionA.x != mapTile.x)
{
+1 -1
View File
@@ -280,7 +280,7 @@ static void FixInvalidSurfaces()
if (surfaceElement == nullptr)
{
LOG_ERROR("Null map element at x = %d and y = %d. Fixing...", x, y);
surfaceElement = TileElementInsert<SurfaceElement>(TileCoordsXYZ{ x, y, 14 }.ToCoordsXYZ(), 0b0000);
surfaceElement = TileElementInsert<SurfaceElement>(TileCoordsXYZ{ x, y, 14 }.toCoordsXYZ(), 0b0000);
if (surfaceElement == nullptr)
{
LOG_ERROR("Unable to fix: Map element limit reached.");
+1 -1
View File
@@ -860,7 +860,7 @@ namespace OpenRCT2
}
// Focus camera on event.
if (!gSilentReplays && isPositionValid && !result.position.IsNull())
if (!gSilentReplays && isPositionValid && !result.position.isNull())
{
auto* mainWindow = WindowGetMain();
if (mainWindow != nullptr)
+1 -1
View File
@@ -379,7 +379,7 @@ namespace OpenRCT2::GameActions
Network::AddPlayerMoneySpent(playerIndex, result.cost);
}
if (!result.position.IsNull())
if (!result.position.isNull())
{
Network::SetPlayerLastActionCoord(playerIndex, result.position);
}
@@ -69,7 +69,7 @@ namespace OpenRCT2::GameActions
auto res = Result();
res.cost = 0;
res.expenditure = ExpenditureType::landscaping;
res.position = _loc.ToTileCentre();
res.position = _loc.toTileCentre();
gFootpathGroundFlags = 0;
@@ -101,7 +101,7 @@ namespace OpenRCT2::GameActions
auto res = Result();
res.cost = 0;
res.expenditure = ExpenditureType::landscaping;
res.position = _loc.ToTileCentre();
res.position = _loc.toTileCentre();
if (!GetFlags().has(CommandFlag::ghost))
{
@@ -75,7 +75,7 @@ namespace OpenRCT2::GameActions
auto res = Result();
res.cost = 0;
res.expenditure = ExpenditureType::landscaping;
res.position = _loc.ToTileCentre();
res.position = _loc.toTileCentre();
gFootpathGroundFlags = 0;
@@ -126,7 +126,7 @@ namespace OpenRCT2::GameActions
auto res = Result();
res.cost = 0;
res.expenditure = ExpenditureType::landscaping;
res.position = _loc.ToTileCentre();
res.position = _loc.toTileCentre();
if (!GetFlags().has(CommandFlag::ghost))
{
@@ -108,7 +108,7 @@ namespace OpenRCT2::GameActions
gameState.peepSpawns.begin(), gameState.peepSpawns.end(),
[this](const CoordsXYZ& spawn) {
{
return spawn.ToTileStart() == _loc.ToTileStart();
return spawn.toTileStart() == _loc.toTileStart();
}
}),
gameState.peepSpawns.end());
@@ -65,7 +65,7 @@ namespace OpenRCT2::GameActions
{
auto res = Result();
MapRange normRange = _range.Normalise();
MapRange normRange = _range.normalise();
// Keep big coordinates within map boundaries
auto mapSizeMaxXY = GetMapSizeMaxXY();
auto aX = std::max<decltype(normRange.GetX1())>(32, normRange.GetX1());
@@ -73,7 +73,7 @@ namespace OpenRCT2::GameActions
{
auto res = Result();
auto validRange = ClampRangeWithinMap(_range.Normalise());
auto validRange = ClampRangeWithinMap(_range.normalise());
CoordsXYZ centre{ (validRange.GetX1() + validRange.GetX2()) / 2 + 16,
(validRange.GetY1() + validRange.GetY2()) / 2 + 16, 0 };
centre.z = TileElementHeight(centre);
@@ -56,7 +56,7 @@ namespace OpenRCT2::GameActions
return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
}
if (!_loc.IsNull() && !LocationValid(_loc))
if (!_loc.isNull() && !LocationValid(_loc))
{
return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
}
@@ -89,7 +89,7 @@ namespace OpenRCT2::GameActions
res.position = _location;
// Shift the spawn point to the edge of the tile
auto spawnPos = CoordsXY{ _location.ToTileCentre() }
auto spawnPos = CoordsXY{ _location.toTileCentre() }
+ CoordsXY{ DirectionOffsets[_location.direction].x * 15, DirectionOffsets[_location.direction].y * 15 };
PeepSpawn spawn;
@@ -106,7 +106,7 @@ namespace OpenRCT2::GameActions
auto foundSpawn = std::find_if(
gameState.peepSpawns.begin(), gameState.peepSpawns.end(), [spawn](const CoordsXYZ& existingSpawn) {
{
return existingSpawn.ToTileStart() == spawn.ToTileStart();
return existingSpawn.toTileStart() == spawn.toTileStart();
}
});
@@ -109,7 +109,7 @@ namespace OpenRCT2::GameActions
}
auto canBuild = MapCanConstructWithClearAt(
{ _loc.ToTileStart(), baseHeight, clearanceHeight }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags());
{ _loc.toTileStart(), baseHeight, clearanceHeight }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags());
if (canBuild.error != Status::ok)
{
canBuild.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
@@ -166,14 +166,14 @@ namespace OpenRCT2::GameActions
if (!flags.has(CommandFlag::ghost))
{
FootpathRemoveLitter(_loc);
WallRemoveAt({ _loc.ToTileStart(), _loc.z, _loc.z + 32 });
WallRemoveAt({ _loc.toTileStart(), _loc.z, _loc.z + 32 });
}
auto baseHeight = _loc.z;
auto clearanceHeight = _loc.z + kMazeClearanceHeight;
auto canBuild = MapCanConstructWithClearAt(
{ _loc.ToTileStart(), baseHeight, clearanceHeight }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 },
{ _loc.toTileStart(), baseHeight, clearanceHeight }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 },
GetFlags().with(CommandFlag::apply));
if (canBuild.error != Status::ok)
{
@@ -183,7 +183,7 @@ namespace OpenRCT2::GameActions
res.cost = MazeCalculateCost(canBuild.cost, *ride, _loc);
auto startLoc = _loc.ToTileStart();
auto startLoc = _loc.toTileStart();
auto* trackElement = TileElementInsert<TrackElement>(_loc, 0b1111);
Guard::Assert(trackElement != nullptr);
@@ -150,7 +150,7 @@ namespace OpenRCT2::GameActions
return res;
}
auto constructResult = MapCanConstructWithClearAt(
{ _loc.ToTileStart(), baseHeight, clearanceHeight }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags());
{ _loc.toTileStart(), baseHeight, clearanceHeight }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 }, GetFlags());
if (constructResult.error != Status::ok)
{
constructResult.errorTitle = STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE;
@@ -210,7 +210,7 @@ namespace OpenRCT2::GameActions
if (!flags.has(CommandFlag::ghost))
{
FootpathRemoveLitter(_loc);
WallRemoveAt({ _loc.ToTileStart(), _loc.z, _loc.z + 32 });
WallRemoveAt({ _loc.toTileStart(), _loc.z, _loc.z + 32 });
}
auto tileElement = MapGetTrackElementAtOfTypeFromRide(_loc, TrackElemType::maze, _rideIndex);
@@ -220,7 +220,7 @@ namespace OpenRCT2::GameActions
auto clearanceHeight = _loc.z + kMazeClearanceHeight;
auto canBuild = MapCanConstructWithClearAt(
{ _loc.ToTileStart(), baseHeight, clearanceHeight }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 },
{ _loc.toTileStart(), baseHeight, clearanceHeight }, MapPlaceNonSceneryClearFunc, { 0b1111, 0 },
GetFlags().with(CommandFlag::apply));
if (canBuild.error != Status::ok)
{
@@ -230,7 +230,7 @@ namespace OpenRCT2::GameActions
res.cost = MazeCalculateCost(canBuild.cost, *ride, _loc);
auto startLoc = _loc.ToTileStart();
auto startLoc = _loc.toTileStart();
auto* trackElement = TileElementInsert<TrackElement>(_loc, 0b1111);
Guard::Assert(trackElement != nullptr);
@@ -272,7 +272,7 @@ namespace OpenRCT2::GameActions
uint8_t temp_edx = kByte993CFC[segmentOffset];
if (temp_edx != 0xFF)
{
auto previousElementLoc = CoordsXY{ _loc }.ToTileStart() - CoordsDirectionDelta[_loc.direction];
auto previousElementLoc = CoordsXY{ _loc }.toTileStart() - CoordsDirectionDelta[_loc.direction];
TileElement* previousTileElement = MapGetTrackElementAtOfTypeFromRide(
{ previousElementLoc, _loc.z }, TrackElemType::maze, _rideIndex);
@@ -303,7 +303,7 @@ namespace OpenRCT2::GameActions
tileElement = MapGetTrackElementAtOfTypeFromRide(
{ previousSegment, _loc.z }, TrackElemType::maze, _rideIndex);
MapInvalidateTileFull(previousSegment.ToTileStart());
MapInvalidateTileFull(previousSegment.toTileStart());
if (tileElement == nullptr)
{
LOG_ERROR("No surface found");
@@ -326,7 +326,7 @@ namespace OpenRCT2::GameActions
tileElement->asTrack()->mazeEntryAdd(1 << segmentBit);
uint32_t direction1 = kByte993D0C[segmentBit];
auto nextElementLoc = previousSegment.ToTileStart() + CoordsDirectionDelta[direction1];
auto nextElementLoc = previousSegment.toTileStart() + CoordsDirectionDelta[direction1];
TileElement* tmp_tileElement = MapGetTrackElementAtOfTypeFromRide(
{ nextElementLoc, _loc.z }, TrackElemType::maze, _rideIndex);
@@ -343,7 +343,7 @@ namespace OpenRCT2::GameActions
break;
}
MapInvalidateTile({ _loc.ToTileStart(), tileElement->getBaseZ(), tileElement->getClearanceZ() });
MapInvalidateTile({ _loc.toTileStart(), tileElement->getBaseZ(), tileElement->getClearanceZ() });
if ((tileElement->asTrack()->getMazeEntry() & 0x8888) == 0x8888)
{
@@ -145,14 +145,14 @@ namespace OpenRCT2::GameActions
ride->type = _rideType;
ride->subtype = rideEntryIndex;
ride->setColourPreset(_trackColourPreset, _vehicleColourPreset);
ride->overallView.SetNull();
ride->overallView.setNull();
ride->setNameToDefault();
// Default initialize all stations.
RideStation station{};
station.start.SetNull();
station.entrance.SetNull();
station.exit.SetNull();
station.start.setNull();
station.entrance.setNull();
station.exit.setNull();
std::ranges::fill(ride->getStations(), station);
ride->status = RideStatus::closed;
@@ -148,9 +148,9 @@ namespace OpenRCT2::GameActions
res.expenditure = ExpenditureType::rideConstruction;
res.cost = refundPrice;
if (!ride.overallView.IsNull())
if (!ride.overallView.isNull())
{
auto xy = ride.overallView.ToTileCentre();
auto xy = ride.overallView.toTileCentre();
res.position = { xy, TileElementHeight(xy) };
}
@@ -200,7 +200,7 @@ namespace OpenRCT2::GameActions
{
for (tilePos.y = 0; tilePos.y < gameState.mapSize.y; ++tilePos.y)
{
const auto tileCoords = tilePos.ToCoordsXY();
const auto tileCoords = tilePos.toCoordsXY();
// Loop over all elements of the tile until there are no more items to remove
int offset = -1;
bool lastForTileReached = false;
@@ -279,9 +279,9 @@ namespace OpenRCT2::GameActions
ride.windowInvalidateFlags.set(RideInvalidateFlag::maintenance, RideInvalidateFlag::customers);
if (!ride.overallView.IsNull())
if (!ride.overallView.isNull())
{
auto location = ride.overallView.ToTileCentre();
auto location = ride.overallView.toTileCentre();
res.position = { location, TileElementHeight(location) };
}
@@ -90,9 +90,9 @@ namespace OpenRCT2::GameActions
const auto& station = ride->getStation(_stationNum);
const auto location = _isExit ? station.exit : station.entrance;
if (!location.IsNull())
if (!location.isNull())
{
auto rideEntranceExitRemove = RideEntranceExitRemoveAction(location.ToCoordsXY(), _rideIndex, _stationNum, _isExit);
auto rideEntranceExitRemove = RideEntranceExitRemoveAction(location.toCoordsXY(), _rideIndex, _stationNum, _isExit);
rideEntranceExitRemove.SetFlags(GetFlags());
auto result = QueryNested(&rideEntranceExitRemove, gameState);
@@ -138,7 +138,7 @@ namespace OpenRCT2::GameActions
}
auto res = Result();
res.position = { _loc.ToTileCentre(), z };
res.position = { _loc.toTileCentre(), z };
res.expenditure = ExpenditureType::rideConstruction;
res.cost += canBuild.cost;
return res;
@@ -165,9 +165,9 @@ namespace OpenRCT2::GameActions
auto& station = ride->getStation(_stationNum);
const auto location = _isExit ? station.exit : station.entrance;
if (!location.IsNull())
if (!location.isNull())
{
auto rideEntranceExitRemove = RideEntranceExitRemoveAction(location.ToCoordsXY(), _rideIndex, _stationNum, _isExit);
auto rideEntranceExitRemove = RideEntranceExitRemoveAction(location.toCoordsXY(), _rideIndex, _stationNum, _isExit);
rideEntranceExitRemove.SetFlags(GetFlags());
auto result = ExecuteNested(&rideEntranceExitRemove, gameState);
@@ -196,7 +196,7 @@ namespace OpenRCT2::GameActions
}
auto res = Result();
res.position = { _loc.ToTileCentre(), z };
res.position = { _loc.toTileCentre(), z };
res.expenditure = ExpenditureType::rideConstruction;
res.cost += canBuild.cost;
@@ -272,7 +272,7 @@ namespace OpenRCT2::GameActions
return Result(Status::disallowed, errorTitle, STR_TOO_HIGH);
}
auto res = Result();
res.position = { loc.ToTileCentre(), TileElementHeight(loc) };
res.position = { loc.toTileCentre(), TileElementHeight(loc) };
res.expenditure = ExpenditureType::rideConstruction;
res.cost += canBuild.cost;
return res;
@@ -156,11 +156,11 @@ namespace OpenRCT2::GameActions
auto& station = ride->getStation(_stationNum);
if (_isExit)
{
station.exit.SetNull();
station.exit.setNull();
}
else
{
station.entrance.SetNull();
station.entrance.setNull();
}
FootpathUpdateQueueChains();
@@ -143,9 +143,9 @@ namespace OpenRCT2::GameActions
windowMgr->InvalidateByNumber(WindowClass::ride, _rideIndex.ToUnderlying());
auto res = Result();
if (!ride->overallView.IsNull())
if (!ride->overallView.isNull())
{
auto location = ride->overallView.ToTileCentre();
auto location = ride->overallView.toTileCentre();
res.position = { location, TileElementHeight(location) };
}
@@ -88,7 +88,7 @@ namespace OpenRCT2::GameActions
windowManager->BroadcastIntent(Intent(INTENT_ACTION_REFRESH_GUEST_LIST));
auto res = Result();
auto location = ride->overallView.ToTileCentre();
auto location = ride->overallView.toTileCentre();
res.position = { location, TileElementHeight(location) };
return res;
@@ -97,9 +97,9 @@ namespace OpenRCT2::GameActions
return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, kStringIdEmpty);
}
if (!ride->overallView.IsNull())
if (!ride->overallView.isNull())
{
auto location = ride->overallView.ToTileCentre();
auto location = ride->overallView.toTileCentre();
res.position = { location, TileElementHeight(location) };
}
@@ -242,9 +242,9 @@ namespace OpenRCT2::GameActions
}
auto res = Result();
if (!ride->overallView.IsNull())
if (!ride->overallView.isNull())
{
auto location = ride->overallView.ToTileCentre();
auto location = ride->overallView.toTileCentre();
res.position = { location, TileElementHeight(location) };
}
auto* windowMgr = Ui::GetWindowManager();
@@ -134,9 +134,9 @@ namespace OpenRCT2::GameActions
Formatter ft(res.errorMessageArgs.data());
ft.Increment(6);
ride->formatNameTo(ft);
if (!ride->overallView.IsNull())
if (!ride->overallView.isNull())
{
auto location = ride->overallView.ToTileCentre();
auto location = ride->overallView.toTileCentre();
res.position = { location, TileElementHeight(location) };
}
@@ -212,9 +212,9 @@ namespace OpenRCT2::GameActions
}
auto res = Result();
if (!ride->overallView.IsNull())
if (!ride->overallView.isNull())
{
auto location = ride->overallView.ToTileCentre();
auto location = ride->overallView.toTileCentre();
res.position = { location, TileElementHeight(res.position) };
}
@@ -63,7 +63,7 @@ namespace OpenRCT2::GameActions
if (trackElement->getRideIndex() == _rideIndex)
{
trackElement->setInvisible(_visibility == RideSetVisibilityType::invisible);
MapInvalidateTileFull(tileCoords.ToCoordsXY());
MapInvalidateTileFull(tileCoords.toCoordsXY());
}
}
}
@@ -63,7 +63,7 @@ namespace OpenRCT2::GameActions
}
BannerElement* bannerElement = tileElement->asBanner();
CoordsXYZD loc = { banner->position.ToCoordsXY(), bannerElement->getBaseZ(), bannerElement->getPosition() };
CoordsXYZD loc = { banner->position.toCoordsXY(), bannerElement->getBaseZ(), bannerElement->getPosition() };
if (!LocationValid(loc))
{
@@ -66,7 +66,7 @@ namespace OpenRCT2::GameActions
}
res.expenditure = ExpenditureType::landscaping;
auto location = banner->position.ToCoordsXY().ToTileCentre();
auto location = banner->position.toCoordsXY().toTileCentre();
res.position = { location, TileElementHeight(location) };
TileElement* tileElement = BannerGetTileElement(_bannerIndex);
@@ -78,7 +78,7 @@ namespace OpenRCT2::GameActions
}
BannerElement* bannerElement = tileElement->asBanner();
CoordsXYZ loc = { banner->position.ToCoordsXY(), bannerElement->getBaseZ() };
CoordsXYZ loc = { banner->position.toCoordsXY(), bannerElement->getBaseZ() };
if (!LocationValid(loc))
{
@@ -132,7 +132,7 @@ namespace OpenRCT2::GameActions
}
res.expenditure = ExpenditureType::landscaping;
auto location = banner->position.ToCoordsXY().ToTileCentre();
auto location = banner->position.toCoordsXY().toTileCentre();
res.position = { location, TileElementHeight(location) };
TileElement* tileElement = BannerGetTileElement(_bannerIndex);
@@ -128,7 +128,7 @@ namespace OpenRCT2::GameActions
for (auto& tile : sceneryEntry->tiles)
{
auto curTile = CoordsXY{ tile.offset }.Rotate(_loc.direction);
auto curTile = CoordsXY{ tile.offset }.rotate(_loc.direction);
curTile.x += _loc.x;
curTile.y += _loc.y;
@@ -259,7 +259,7 @@ namespace OpenRCT2::GameActions
for (auto& tile : sceneryEntry->tiles)
{
auto curTile = CoordsXY{ tile.offset }.Rotate(_loc.direction);
auto curTile = CoordsXY{ tile.offset }.rotate(_loc.direction);
curTile.x += _loc.x;
curTile.y += _loc.y;
@@ -328,7 +328,7 @@ namespace OpenRCT2::GameActions
{
for (auto& tile : tiles)
{
auto curTile = CoordsXY{ tile.offset }.Rotate(_loc.direction);
auto curTile = CoordsXY{ tile.offset }.rotate(_loc.direction);
curTile.x += _loc.x;
curTile.y += _loc.y;
@@ -345,7 +345,7 @@ namespace OpenRCT2::GameActions
int16_t maxHeight = -1;
for (auto& tile : tiles)
{
auto curTile = CoordsXY{ tile.offset }.Rotate(_loc.direction);
auto curTile = CoordsXY{ tile.offset }.rotate(_loc.direction);
curTile.x += _loc.x;
curTile.y += _loc.y;
@@ -73,7 +73,7 @@ namespace OpenRCT2::GameActions
return Result(Status::unknown, STR_CANT_REMOVE_THIS, STR_UNKNOWN_OBJECT_TYPE);
}
auto rotatedOffsets = CoordsXYZ{ CoordsXY{ sceneryEntry->tiles[_tileIndex].offset }.Rotate(_loc.direction),
auto rotatedOffsets = CoordsXYZ{ CoordsXY{ sceneryEntry->tiles[_tileIndex].offset }.rotate(_loc.direction),
sceneryEntry->tiles[_tileIndex].offset.z };
auto firstTile = CoordsXYZ{ _loc.x, _loc.y, _loc.z } - rotatedOffsets;
@@ -81,7 +81,7 @@ namespace OpenRCT2::GameActions
bool calculate_cost = true;
for (auto& tile : sceneryEntry->tiles)
{
auto currentTileRotatedOffset = CoordsXYZ{ CoordsXY{ tile.offset }.Rotate(_loc.direction), tile.offset.z };
auto currentTileRotatedOffset = CoordsXYZ{ CoordsXY{ tile.offset }.rotate(_loc.direction), tile.offset.z };
auto currentTile = CoordsXYZ{ firstTile.x, firstTile.y, firstTile.z } + currentTileRotatedOffset;
@@ -153,14 +153,14 @@ namespace OpenRCT2::GameActions
tileElement->removeBannerEntry();
auto rotatedFirstTile = CoordsXYZ{ CoordsXY{ sceneryEntry->tiles[_tileIndex].offset }.Rotate(_loc.direction),
auto rotatedFirstTile = CoordsXYZ{ CoordsXY{ sceneryEntry->tiles[_tileIndex].offset }.rotate(_loc.direction),
sceneryEntry->tiles[_tileIndex].offset.z };
auto firstTile = CoordsXYZ{ _loc.x, _loc.y, _loc.z } - rotatedFirstTile;
for (auto& tile : sceneryEntry->tiles)
{
auto rotatedCurrentTile = CoordsXYZ{ CoordsXY{ tile.offset }.Rotate(_loc.direction), tile.offset.z };
auto rotatedCurrentTile = CoordsXYZ{ CoordsXY{ tile.offset }.rotate(_loc.direction), tile.offset.z };
auto currentTile = CoordsXYZ{ firstTile.x, firstTile.y, firstTile.z } + rotatedCurrentTile;
@@ -117,7 +117,7 @@ namespace OpenRCT2::GameActions
return Result(Status::unknown, STR_CANT_REPAINT_THIS, kStringIdNone);
}
// Work out the base tile coordinates (Tile with index 0)
auto rotatedBaseCoordsOffset = CoordsXYZ{ CoordsXY{ sceneryEntry->tiles[_tileIndex].offset }.Rotate(_loc.direction),
auto rotatedBaseCoordsOffset = CoordsXYZ{ CoordsXY{ sceneryEntry->tiles[_tileIndex].offset }.rotate(_loc.direction),
sceneryEntry->tiles[_tileIndex].offset.z };
auto baseTile = CoordsXYZ{ _loc.x, _loc.y, _loc.z } - rotatedBaseCoordsOffset;
@@ -125,7 +125,7 @@ namespace OpenRCT2::GameActions
for (auto& tile : sceneryEntry->tiles)
{
// Work out the current tile coordinates
auto rotatedTileCoords = CoordsXYZ{ CoordsXY{ tile.offset }.Rotate(_loc.direction), tile.offset.z };
auto rotatedTileCoords = CoordsXYZ{ CoordsXY{ tile.offset }.rotate(_loc.direction), tile.offset.z };
auto currentTile = CoordsXYZ{ baseTile.x, baseTile.y, baseTile.z } + rotatedTileCoords;
if (gLegacyScene != LegacyScene::scenarioEditor && !gameState.cheats.sandboxMode)
@@ -60,7 +60,7 @@ namespace OpenRCT2::GameActions
return Result(Status::invalidParameters, STR_CANT_RENAME_BANNER, STR_ERR_BANNER_ELEMENT_NOT_FOUND);
}
CoordsXYZ loc = { banner->position.ToCoordsXY(), tileElement->getBaseZ() };
CoordsXYZ loc = { banner->position.toCoordsXY(), tileElement->getBaseZ() };
if (!LocationValid(loc))
{
@@ -92,7 +92,7 @@ namespace OpenRCT2::GameActions
else
{
// If empty name take closest ride name.
RideId rideIndex = BannerGetClosestRideIndex({ banner->position.ToCoordsXY(), 16 });
RideId rideIndex = BannerGetClosestRideIndex({ banner->position.toCoordsXY(), 16 });
if (rideIndex.IsNull())
{
banner->flags.unset(BannerFlag::linkedToRide);
@@ -74,7 +74,7 @@ namespace OpenRCT2::GameActions
TileElementType::largeScenery);
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, kStringIdNone);
}
loc = { banner->position.ToCoordsXY(), tileElement->getBaseZ() };
loc = { banner->position.toCoordsXY(), tileElement->getBaseZ() };
}
else
{
@@ -85,7 +85,7 @@ namespace OpenRCT2::GameActions
LOG_ERROR("Wall element not found for bannerIndex", _bannerIndex);
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, kStringIdNone);
}
loc = { banner->position.ToCoordsXY(), wallElement->getBaseZ() };
loc = { banner->position.toCoordsXY(), wallElement->getBaseZ() };
}
if (!LocationValid(loc))
@@ -109,7 +109,7 @@ namespace OpenRCT2::GameActions
return Result(Status::invalidParameters, STR_CANT_REPAINT_THIS, kStringIdNone);
}
CoordsXY coords = banner->position.ToCoordsXY();
CoordsXY coords = banner->position.toCoordsXY();
if (_isLarge)
{
@@ -92,7 +92,7 @@ namespace OpenRCT2::GameActions
surfaceHeight = waterHeight;
}
auto res = Result();
auto centre = _loc.ToTileCentre();
auto centre = _loc.toTileCentre();
res.position.x = centre.x;
res.position.y = centre.y;
res.position.z = surfaceHeight;
@@ -139,7 +139,7 @@ namespace OpenRCT2::GameActions
auto loc2 = _loc;
if (sceneryEntry->flags.has(SmallSceneryFlag::occupiesFullTile))
{
loc2 = loc2.ToTileCentre();
loc2 = loc2.toTileCentre();
}
else
{
@@ -299,7 +299,7 @@ namespace OpenRCT2::GameActions
surfaceHeight = waterHeight;
}
auto res = Result();
auto centre = _loc.ToTileCentre();
auto centre = _loc.toTileCentre();
res.position.x = centre.x;
res.position.y = centre.y;
res.position.z = surfaceHeight;
@@ -335,7 +335,7 @@ namespace OpenRCT2::GameActions
const auto selectionType = _selectionType;
const int32_t heightOffset = raiseLand ? 2 : -2;
auto normRange = _range.Normalise();
auto normRange = _range.normalise();
// Cap bounds to map
auto l = std::max(normRange.GetX1(), 32);
auto t = std::max(normRange.GetY1(), 32);
@@ -50,7 +50,7 @@ namespace OpenRCT2::GameActions
res.errorTitle = STR_CANT_CHANGE_LAND_TYPE;
res.expenditure = ExpenditureType::landscaping;
auto validRange = ClampRangeWithinMap(_range.Normalise());
auto validRange = ClampRangeWithinMap(_range.normalise());
auto& objManager = GetContext()->GetObjectManager();
if (_surfaceStyle != kObjectEntryIndexNull)
{
@@ -147,7 +147,7 @@ namespace OpenRCT2::GameActions
res.errorTitle = STR_CANT_CHANGE_LAND_TYPE;
res.expenditure = ExpenditureType::landscaping;
auto validRange = ClampRangeWithinMap(_range.Normalise());
auto validRange = ClampRangeWithinMap(_range.normalise());
auto xMid = (validRange.GetX1() + validRange.GetX2()) / 2 + 16;
auto yMid = (validRange.GetY1() + validRange.GetY2()) / 2 + 16;
auto heightMid = TileElementHeight({ xMid, yMid });
@@ -187,7 +187,7 @@ namespace OpenRCT2::GameActions
for (uint8_t i = 0; i < ted.sequenceData.numSequences; i++)
{
const auto& trackBlock = ted.sequenceData.sequences[i].clearance;
auto rotatedTrack = CoordsXYZ{ CoordsXY{ trackBlock.x, trackBlock.y }.Rotate(_origin.direction), 0 };
auto rotatedTrack = CoordsXYZ{ CoordsXY{ trackBlock.x, trackBlock.y }.rotate(_origin.direction), 0 };
auto tileCoords = CoordsXYZ{ _origin.x, _origin.y, _origin.z } + rotatedTrack;
if (!LocationValid(tileCoords))
@@ -236,7 +236,7 @@ namespace OpenRCT2::GameActions
for (int32_t blockIndex = 0; blockIndex < ted.sequenceData.numSequences; blockIndex++)
{
const auto& trackBlock = ted.sequenceData.sequences[blockIndex].clearance;
auto rotatedTrack = CoordsXYZ{ CoordsXY{ trackBlock.x, trackBlock.y }.Rotate(_origin.direction), trackBlock.z };
auto rotatedTrack = CoordsXYZ{ CoordsXY{ trackBlock.x, trackBlock.y }.rotate(_origin.direction), trackBlock.z };
auto mapLoc = CoordsXYZ{ _origin.x, _origin.y, _origin.z } + rotatedTrack;
auto quarterTile = trackBlock.quarterTile.Rotate(_origin.direction);
@@ -452,11 +452,11 @@ namespace OpenRCT2::GameActions
const auto& block0 = ted.sequenceData.sequences[0].clearance;
auto clearanceHeight = rideEntry->Clearance;
CoordsXYZ originLocation = CoordsXYZ{ _origin.x, _origin.y, _origin.z }
+ CoordsXYZ{ CoordsXY{ block0.x, block0.y }.Rotate(_origin.direction), block0.z };
+ CoordsXYZ{ CoordsXY{ block0.x, block0.y }.rotate(_origin.direction), block0.z };
for (int32_t blockIndex = 0; blockIndex < ted.sequenceData.numSequences; blockIndex++)
{
const auto& trackBlock = ted.sequenceData.sequences[blockIndex].clearance;
auto rotatedTrack = CoordsXYZ{ CoordsXY{ trackBlock.x, trackBlock.y }.Rotate(_origin.direction), trackBlock.z };
auto rotatedTrack = CoordsXYZ{ CoordsXY{ trackBlock.x, trackBlock.y }.rotate(_origin.direction), trackBlock.z };
auto mapLoc = CoordsXYZ{ _origin.x, _origin.y, _origin.z } + rotatedTrack;
auto quarterTile = trackBlock.quarterTile.Rotate(_origin.direction);
@@ -554,7 +554,7 @@ namespace OpenRCT2::GameActions
supportCosts += (supportHeight / (2 * kCoordsZStep)) * rtd.BuildCosts.SupportPrice;
bool isOrigin = false;
if (!ride->overallView.IsNull())
if (!ride->overallView.isNull())
{
if (!GetFlags().has(CommandFlag::noSpend))
{
@@ -562,7 +562,7 @@ namespace OpenRCT2::GameActions
}
}
if (isOrigin || ride->overallView.IsNull())
if (isOrigin || ride->overallView.isNull())
{
ride->overallView = mapLoc;
}
@@ -746,7 +746,7 @@ namespace OpenRCT2::GameActions
for (uint8_t i = 0; i < ted.sequenceData.numSequences; i++)
{
const auto& trackBlock = ted.sequenceData.sequences[i].clearance;
auto rotatedTrack = CoordsXY{ trackBlock.x, trackBlock.y }.Rotate(_origin.direction);
auto rotatedTrack = CoordsXY{ trackBlock.x, trackBlock.y }.rotate(_origin.direction);
auto tileCoords = CoordsXY{ _origin.x, _origin.y } + rotatedTrack;
if (!MapCheckCapacityAndReorganise(tileCoords, numTiles))
@@ -146,7 +146,7 @@ namespace OpenRCT2::GameActions
auto startLoc = _origin;
startLoc.direction = foundElement->getDirection();
auto rotatedTrack = CoordsXYZ{ CoordsXY{ currentTrackBlock.x, currentTrackBlock.y }.Rotate(startLoc.direction),
auto rotatedTrack = CoordsXYZ{ CoordsXY{ currentTrackBlock.x, currentTrackBlock.y }.rotate(startLoc.direction),
currentTrackBlock.z };
startLoc.x -= rotatedTrack.x;
startLoc.y -= rotatedTrack.y;
@@ -160,7 +160,7 @@ namespace OpenRCT2::GameActions
for (uint8_t i = 0; i < ted.sequenceData.numSequences; i++)
{
const auto& trackBlock = ted.sequenceData.sequences[i].clearance;
rotatedTrack = CoordsXYZ{ CoordsXY{ trackBlock.x, trackBlock.y }.Rotate(startLoc.direction), trackBlock.z };
rotatedTrack = CoordsXYZ{ CoordsXY{ trackBlock.x, trackBlock.y }.rotate(startLoc.direction), trackBlock.z };
auto mapLoc = CoordsXYZ{ startLoc.x, startLoc.y, startLoc.z } + rotatedTrack;
if (!LocationValid(mapLoc))
@@ -304,7 +304,7 @@ namespace OpenRCT2::GameActions
startLoc.direction = foundElement->getDirection();
const auto& currentTrackBlock = ted.sequenceData.sequences[sequenceIndex].clearance;
auto rotatedTrackLoc = CoordsXYZ{ CoordsXY{ currentTrackBlock.x, currentTrackBlock.y }.Rotate(startLoc.direction),
auto rotatedTrackLoc = CoordsXYZ{ CoordsXY{ currentTrackBlock.x, currentTrackBlock.y }.rotate(startLoc.direction),
currentTrackBlock.z };
startLoc.x -= rotatedTrackLoc.x;
startLoc.y -= rotatedTrackLoc.y;
@@ -319,7 +319,7 @@ namespace OpenRCT2::GameActions
{
const auto& trackBlock = ted.sequenceData.sequences[i].clearance;
rotatedTrackLoc = CoordsXYZ{ CoordsXY{ trackBlock.x, trackBlock.y }.Rotate(startLoc.direction), trackBlock.z };
rotatedTrackLoc = CoordsXYZ{ CoordsXY{ trackBlock.x, trackBlock.y }.rotate(startLoc.direction), trackBlock.z };
auto mapLoc = CoordsXYZ{ startLoc.x, startLoc.y, startLoc.z } + rotatedTrackLoc;
MapInvalidateTileFull(mapLoc);
+9 -9
View File
@@ -793,8 +793,8 @@ namespace OpenRCT2::Drawing::LightFx
void AddKioskLights(const CoordsXY& mapPosition, const int32_t height, const uint8_t zOffset)
{
uint8_t relativeRotation = (4 - GetCurrentRotation()) % 4;
CoordsXY lanternOffset1 = CoordsXY(0, 16).Rotate(relativeRotation);
CoordsXY lanternOffset2 = CoordsXY(16, 0).Rotate(relativeRotation);
CoordsXY lanternOffset1 = CoordsXY(0, 16).rotate(relativeRotation);
CoordsXY lanternOffset2 = CoordsXY(16, 0).rotate(relativeRotation);
Add3DLightMagicFromDrawingTile(mapPosition, lanternOffset1.x, lanternOffset1.y, height + zOffset, LightType::lantern3);
Add3DLightMagicFromDrawingTile(mapPosition, lanternOffset2.x, lanternOffset2.y, height + zOffset, LightType::lantern3);
Add3DLightMagicFromDrawingTile(mapPosition, 8, 32, height, LightType::spot1);
@@ -811,23 +811,23 @@ namespace OpenRCT2::Drawing::LightFx
{
if (direction == (4 - GetCurrentRotation()) % 4) // Back Right Facing Stall
{
CoordsXY spotOffset1 = CoordsXY(-32, 8).Rotate(direction);
CoordsXY spotOffset2 = CoordsXY(-32, 4).Rotate(direction);
CoordsXY spotOffset1 = CoordsXY(-32, 8).rotate(direction);
CoordsXY spotOffset2 = CoordsXY(-32, 4).rotate(direction);
Add3DLightMagicFromDrawingTile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::spot1);
Add3DLightMagicFromDrawingTile(mapPosition, spotOffset2.x, spotOffset2.y, height, LightType::spot2);
}
else if (direction == (7 - GetCurrentRotation()) % 4) // Back left Facing Stall
{
CoordsXY spotOffset1 = CoordsXY(-32, -8).Rotate(direction);
CoordsXY spotOffset2 = CoordsXY(-32, -4).Rotate(direction);
CoordsXY spotOffset1 = CoordsXY(-32, -8).rotate(direction);
CoordsXY spotOffset2 = CoordsXY(-32, -4).rotate(direction);
Add3DLightMagicFromDrawingTile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::spot1);
Add3DLightMagicFromDrawingTile(mapPosition, spotOffset2.x, spotOffset2.y, height, LightType::spot2);
}
else // Forward Facing Stall
{
CoordsXY spotOffset1 = CoordsXY(-32, 8).Rotate(direction);
CoordsXY spotOffset2 = CoordsXY(-32, -8).Rotate(direction);
CoordsXY lanternOffset = CoordsXY(-16, 0).Rotate(direction);
CoordsXY spotOffset1 = CoordsXY(-32, 8).rotate(direction);
CoordsXY spotOffset2 = CoordsXY(-32, -8).rotate(direction);
CoordsXY lanternOffset = CoordsXY(-16, 0).rotate(direction);
Add3DLightMagicFromDrawingTile(
mapPosition, lanternOffset.x, lanternOffset.y, height + zOffset, LightType::lantern3);
Add3DLightMagicFromDrawingTile(mapPosition, spotOffset1.x, spotOffset1.y, height, LightType::spot1);
+1 -1
View File
@@ -40,7 +40,7 @@ namespace OpenRCT2
static constexpr uint32_t ComputeSpatialIndex(const CoordsXY& loc)
{
if (loc.IsNull())
if (loc.isNull())
return kSpatialIndexNullBucket;
// NOTE: The input coordinate is rotated and can have negative components.
+21 -21
View File
@@ -1183,7 +1183,7 @@ namespace OpenRCT2
guest.setState(PeepState::walking);
// Set destination to the centre of the tile.
const auto destination = guest.getLocation().ToTileCentre();
const auto destination = guest.getLocation().toTileCentre();
guest.setDestination(destination, 5);
guest.updateCurrentAnimationType();
}
@@ -1204,7 +1204,7 @@ namespace OpenRCT2
if (!(pathingResult & PATHING_DESTINATION_REACHED))
return;
auto loc = getLocation().ToTileStart() + CoordsXYZ{ BenchUseOffsets[var37 & 0x7], 0 };
auto loc = getLocation().toTileStart() + CoordsXYZ{ BenchUseOffsets[var37 & 0x7], 0 };
moveTo(loc);
@@ -1236,7 +1236,7 @@ namespace OpenRCT2
setState(PeepState::walking);
// Set destination to the centre of the tile
auto destination = getLocation().ToTileCentre();
auto destination = getLocation().toTileCentre();
setDestination(destination, 5);
updateCurrentAnimationType();
return;
@@ -2452,13 +2452,13 @@ namespace OpenRCT2
void Guest::goToRideEntrance(const Ride& ride)
{
const auto& station = ride.getStation(currentRideStation);
if (station.entrance.IsNull())
if (station.entrance.isNull())
{
removeFromQueue();
return;
}
auto location = station.entrance.ToCoordsXYZD().ToTileCentre();
auto location = station.entrance.toCoordsXYZD().toTileCentre();
int16_t x_shift = DirectionOffsets[location.direction].x;
int16_t y_shift = DirectionOffsets[location.direction].y;
@@ -3429,7 +3429,7 @@ namespace OpenRCT2
if (xy_distance < 16)
{
const auto& station = ride->getStation(currentRideStation);
auto entrance = station.entrance.ToCoordsXYZ();
auto entrance = station.entrance.toCoordsXYZ();
actionZ = entrance.z + 2;
}
moveTo({ loc.value(), actionZ });
@@ -3585,7 +3585,7 @@ namespace OpenRCT2
void Guest::updateRideLeaveEntranceWaypoints(const Ride& ride)
{
const auto& station = ride.getStation(currentRideStation);
if (station.entrance.IsNull())
if (station.entrance.isNull())
{
return;
}
@@ -3674,8 +3674,8 @@ namespace OpenRCT2
if (ride->getRideTypeDescriptor().flags.has(RtdFlag::noVehicles))
{
const auto& station = ride->getStation(currentRideStation);
auto entranceLocation = station.entrance.ToCoordsXYZD();
if (entranceLocation.IsNull())
auto entranceLocation = station.entrance.toCoordsXYZD();
if (entranceLocation.isNull())
{
return;
}
@@ -4256,8 +4256,8 @@ namespace OpenRCT2
return;
}
auto exitLocation = station.exit.ToCoordsXYZD();
if (exitLocation.IsNull())
auto exitLocation = station.exit.toCoordsXYZD();
if (exitLocation.isNull())
{
return;
}
@@ -4318,7 +4318,7 @@ namespace OpenRCT2
return;
auto exit = ride->getStation(currentRideStation).exit;
auto newDestination = exit.ToCoordsXY().ToTileCentre();
auto newDestination = exit.toCoordsXY().toTileCentre();
auto [xShift, yShift] = [exit]() {
if (exit.direction < DirectionOffsets.size())
@@ -4409,7 +4409,7 @@ namespace OpenRCT2
CoordsXY GetGuestWaypointLocationDefault(const Vehicle& vehicle, const Ride& ride, const StationIndex& CurrentRideStation)
{
return ride.getStation(CurrentRideStation).start.ToTileCentre();
return ride.getStation(CurrentRideStation).start.toTileCentre();
}
CoordsXY GetGuestWaypointLocationEnterprise(
@@ -4577,7 +4577,7 @@ namespace OpenRCT2
var37 |= 3;
auto targetLoc = ride->getStation(currentRideStation).exit.ToCoordsXYZD().ToTileCentre();
auto targetLoc = ride->getStation(currentRideStation).exit.toCoordsXYZD().toTileCentre();
uint8_t exit_direction = DirectionReverse(targetLoc.direction);
int16_t x_shift = DirectionOffsets[exit_direction].x;
@@ -4823,7 +4823,7 @@ namespace OpenRCT2
// Actually force the final waypoint
var37 |= 3;
auto targetLoc = ride->getStation(currentRideStation).exit.ToCoordsXYZD().ToTileCentre();
auto targetLoc = ride->getStation(currentRideStation).exit.toCoordsXYZD().toTileCentre();
int16_t xShift = DirectionOffsets[DirectionReverse(targetLoc.direction)].x;
int16_t yShift = DirectionOffsets[DirectionReverse(targetLoc.direction)].y;
@@ -4889,7 +4889,7 @@ namespace OpenRCT2
}
}
auto targetLoc = getDestination().ToTileStart();
auto targetLoc = getDestination().toTileStart();
auto stationBaseZ = ride->getStation().getBaseZ();
@@ -4969,11 +4969,11 @@ namespace OpenRCT2
targetLoc = getDestination();
if (chosenEdge & 1)
{
targetLoc.x = targetLoc.ToTileCentre().x;
targetLoc.x = targetLoc.toTileCentre().x;
}
else
{
targetLoc.y = targetLoc.ToTileCentre().y;
targetLoc.y = targetLoc.toTileCentre().y;
}
setDestination(targetLoc);
var37 = 16;
@@ -5120,7 +5120,7 @@ namespace OpenRCT2
const auto curLoc = getLocation();
moveTo({ loc.value(), curLoc.z });
const auto newLoc = getLocation().ToTileStart();
const auto newLoc = getLocation().toTileStart();
if (newLoc.x != nextLoc.x)
return;
if (newLoc.y != nextLoc.y)
@@ -5894,7 +5894,7 @@ namespace OpenRCT2
updateAnimationGroup();
// Send peep to the centre of current tile.
auto destination = getLocation().ToTileCentre();
auto destination = getLocation().toTileCentre();
setDestination(destination, 5);
updateCurrentAnimationType();
}
@@ -6869,7 +6869,7 @@ namespace OpenRCT2
if (Weather::isPrecipitating() && (hasItem(ShopItem::umbrella)) && x != kLocationNull)
{
CoordsXY loc = { x, y };
if (MapIsLocationValid(loc.ToTileStart()))
if (MapIsLocationValid(loc.toTileStart()))
{
TileElement* tileElement = MapGetFirstElementAt(loc);
while (true)
+1 -1
View File
@@ -62,7 +62,7 @@ namespace OpenRCT2
void MoneyEffect::create(money64 value, const CoordsXYZ& loc)
{
auto offsetLoc = loc;
if (loc.IsNull())
if (loc.isNull())
{
// If game actions return no valid location of the action we can not use the screen
// coordinates as every client will have different ones.
+10 -10
View File
@@ -667,7 +667,7 @@ namespace OpenRCT2
// Set the coordinate of destination to be exactly
// in the middle of a tile.
CoordsXYZ destination = { location.ToCoordsXY().ToTileCentre(), tileElement->getBaseZ() + 16 };
CoordsXYZ destination = { location.toCoordsXY().toTileCentre(), tileElement->getBaseZ() + 16 };
if (!MapIsLocationOwned(destination))
{
@@ -869,7 +869,7 @@ namespace OpenRCT2
moveTo({ x, y, saved_height });
nextLoc = { CoordsXY{ x, y }.ToTileStart(), saved_map->getBaseZ() };
nextLoc = { CoordsXY{ x, y }.toTileStart(), saved_map->getBaseZ() };
if (saved_map->getType() != TileElementType::path)
{
@@ -1612,7 +1612,7 @@ namespace OpenRCT2
static void PeepReturnToCentreOfTile(Peep* peep)
{
peep->peepDirection = DirectionReverse(peep->peepDirection);
auto destination = peep->getLocation().ToTileCentre();
auto destination = peep->getLocation().toTileCentre();
peep->setDestination(destination, 5);
}
@@ -1817,12 +1817,12 @@ namespace OpenRCT2
bool found = false;
auto entrance = std::find_if(
gameState.park.entrances.begin(), gameState.park.entrances.end(),
[coords](const auto& e) { return coords.ToTileStart() == e; });
[coords](const auto& e) { return coords.toTileStart() == e; });
if (entrance != gameState.park.entrances.end())
{
int16_t z = entrance->z / 8;
entranceDirection = entrance->direction;
auto nextLoc = coords.ToTileStart() + CoordsDirectionDelta[entranceDirection];
auto nextLoc = coords.toTileStart() + CoordsDirectionDelta[entranceDirection];
// Make sure there is a path right behind the entrance, otherwise turn around
TileElement* nextTileElement = MapGetFirstElementAt(nextLoc);
@@ -1934,7 +1934,7 @@ namespace OpenRCT2
const auto* pathElement = coords.element->asPath();
assert(pathElement != nullptr);
peep->nextLoc = { coords.ToTileStart(), pathElement->getBaseZ() };
peep->nextLoc = { coords.toTileStart(), pathElement->getBaseZ() };
peep->setNextFlags(pathElement->getSlopeDirection(), pathElement->isSloped(), false);
int16_t z = peep->getZOnSlope(coords.x, coords.y);
@@ -2190,7 +2190,7 @@ namespace OpenRCT2
// Force set centre of tile to prevent issues with guests accidentally skipping the queue
auto queueTileCentre = CoordsXY{ CoordsXY{ guest->nextLoc }
+ CoordsDirectionDelta[guest->peepDirection] }
.ToTileCentre();
.toTileCentre();
guest->setDestination(queueTileCentre);
PeepFootpathMoveForward(guest, coords, vandalismPresent);
@@ -2283,7 +2283,7 @@ namespace OpenRCT2
guest->spendMoney(cost, ExpenditureType::shopSales);
}
auto coordsCentre = coords.ToTileCentre();
auto coordsCentre = coords.toTileCentre();
guest->setDestination(coordsCentre, 3);
guest->currentRide = rideIndex;
guest->setState(PeepState::enteringRide);
@@ -2365,7 +2365,7 @@ namespace OpenRCT2
}
auto newLoc = *loc;
CoordsXY truncatedNewLoc = newLoc.ToTileStart();
CoordsXY truncatedNewLoc = newLoc.toTileStart();
if (truncatedNewLoc == CoordsXY{ nextLoc })
{
int16_t height = getZOnSlope(newLoc.x, newLoc.y);
@@ -2733,7 +2733,7 @@ namespace OpenRCT2
*/
void Peep::resetPathfindGoal()
{
pathfindGoal.SetNull();
pathfindGoal.setNull();
pathfindGoal.direction = kInvalidDirection;
}
} // namespace OpenRCT2
+25 -25
View File
@@ -339,16 +339,16 @@ namespace OpenRCT2
return kInvalidDirection;
}
auto litterTile = CoordsXY{ nearestLitter->x, nearestLitter->y }.ToTileStart();
auto litterTile = CoordsXY{ nearestLitter->x, nearestLitter->y }.toTileStart();
if (!isLocationInPatrol(litterTile))
{
return kInvalidDirection;
}
Direction nextDirection = DirectionFromTo(CoordsXY(x, y), litterTile.ToTileCentre());
Direction nextDirection = DirectionFromTo(CoordsXY(x, y), litterTile.toTileCentre());
CoordsXY nextTile = litterTile.ToTileStart() - CoordsDirectionDelta[nextDirection];
CoordsXY nextTile = litterTile.toTileStart() - CoordsDirectionDelta[nextDirection];
int16_t nextZ = ((z + kCoordsZStep) & 0xFFF0) / kCoordsZStep;
@@ -365,7 +365,7 @@ namespace OpenRCT2
}
} while (!(tileElement++)->isLastForTile());
nextTile = CoordsXY(x, y).ToTileStart() + CoordsDirectionDelta[nextDirection];
nextTile = CoordsXY(x, y).toTileStart() + CoordsDirectionDelta[nextDirection];
tileElement = MapGetFirstElementAt(nextTile);
if (tileElement == nullptr)
@@ -635,12 +635,12 @@ namespace OpenRCT2
&& (ScenarioRand() & 1))
{
auto location = ride->getStation(currentRideStation).exit;
if (location.IsNull())
if (location.isNull())
{
location = ride->getStation(currentRideStation).entrance;
}
direction = DirectionFromTo(CoordsXY(x, y), location.ToCoordsXY());
direction = DirectionFromTo(CoordsXY(x, y), location.toCoordsXY());
}
return directionSurface(direction);
@@ -716,12 +716,12 @@ namespace OpenRCT2
/* Find location of the exit for the target ride station
* or if the ride has no exit, the entrance. */
TileCoordsXYZD location = ride->getStation(currentRideStation).exit;
if (location.IsNull())
if (location.isNull())
{
location = ride->getStation(currentRideStation).entrance;
// If no entrance is present either. This is an incorrect state.
if (location.IsNull())
if (location.isNull())
{
return mechanicDirectionPathRand(pathDirections);
}
@@ -1269,7 +1269,7 @@ namespace OpenRCT2
return;
}
if (ride->getStation(currentRideStation).exit.IsNull())
if (ride->getStation(currentRideStation).exit.isNull())
{
ride->flags.unset(RideFlag::dueInspection);
setState(PeepState::falling);
@@ -1323,7 +1323,7 @@ namespace OpenRCT2
if (pathingResult & PATHING_RIDE_ENTRANCE)
{
if (!ride->getStation(exitIndex).exit.IsNull())
if (!ride->getStation(exitIndex).exit.isNull())
{
return;
}
@@ -1428,7 +1428,7 @@ namespace OpenRCT2
if (pathingResult & PATHING_RIDE_ENTRANCE)
{
if (!ride->getStation(exitIndex).exit.IsNull())
if (!ride->getStation(exitIndex).exit.isNull())
{
return;
}
@@ -1534,7 +1534,7 @@ namespace OpenRCT2
var37 = chosen_position;
subState = 0;
auto destination = kWateringUseOffsets[chosen_position] + getLocation().ToTileStart();
auto destination = kWateringUseOffsets[chosen_position] + getLocation().toTileStart();
setDestination(destination, 3);
return true;
@@ -1605,7 +1605,7 @@ namespace OpenRCT2
setState(PeepState::emptyingBin);
subState = 0;
auto destination = BinUseOffsets[chosen_position] + getLocation().ToTileStart();
auto destination = BinUseOffsets[chosen_position] + getLocation().toTileStart();
setDestination(destination, 3);
return true;
}
@@ -2277,7 +2277,7 @@ namespace OpenRCT2
}
auto stationPos = ride.getStation(currentRideStation).getStart();
if (stationPos.IsNull())
if (stationPos.isNull())
{
return true;
}
@@ -2364,7 +2364,7 @@ namespace OpenRCT2
}
auto stationPosition = ride.getStation(currentRideStation).getStart();
if (stationPosition.IsNull())
if (stationPosition.isNull())
{
return true;
}
@@ -2509,18 +2509,18 @@ namespace OpenRCT2
{
if (!firstRun)
{
auto stationPosition = ride.getStation(currentRideStation).exit.ToCoordsXY();
if (stationPosition.IsNull())
auto stationPosition = ride.getStation(currentRideStation).exit.toCoordsXY();
if (stationPosition.isNull())
{
stationPosition = ride.getStation(currentRideStation).entrance.ToCoordsXY();
stationPosition = ride.getStation(currentRideStation).entrance.toCoordsXY();
if (stationPosition.IsNull())
if (stationPosition.isNull())
{
return true;
}
}
stationPosition = stationPosition.ToTileCentre();
stationPosition = stationPosition.toTileCentre();
CoordsXY stationPlatformDirection = DirectionOffsets[peepDirection];
stationPosition.x += stationPlatformDirection.x * 20;
@@ -2589,19 +2589,19 @@ namespace OpenRCT2
{
if (!firstRun)
{
auto exitPosition = ride.getStation(currentRideStation).exit.ToCoordsXY();
if (exitPosition.IsNull())
auto exitPosition = ride.getStation(currentRideStation).exit.toCoordsXY();
if (exitPosition.isNull())
{
exitPosition = ride.getStation(currentRideStation).entrance.ToCoordsXY();
exitPosition = ride.getStation(currentRideStation).entrance.toCoordsXY();
if (exitPosition.IsNull())
if (exitPosition.isNull())
{
setState(PeepState::falling);
return false;
}
}
exitPosition = exitPosition.ToTileCentre();
exitPosition = exitPosition.toTileCentre();
CoordsXY ebx_direction = DirectionOffsets[peepDirection];
exitPosition.x -= ebx_direction.x * 19;
@@ -911,7 +911,7 @@ static void ConsoleCommandSet(InteractiveConsole& console, const arguments_t& ar
WindowBase* w = WindowGetMain();
if (w != nullptr)
{
auto location = TileCoordsXYZ(int_val[0], int_val[1], 0).ToCoordsXYZ().ToTileCentre();
auto location = TileCoordsXYZ(int_val[0], int_val[1], 0).toCoordsXYZ().toTileCentre();
location.z = TileElementHeight(location);
w->setViewportLocation(location);
console.Execute("get location");
+6 -6
View File
@@ -216,9 +216,9 @@ static int32_t GetTallestVisibleTileTop(
{
for (int32_t x = startCoords.x; x <= endCoords.x; x++)
{
auto location = TileCoordsXY(x, y).ToCoordsXY();
auto location = TileCoordsXY(x, y).toCoordsXY();
int32_t z = GetHighestBaseClearanceZ(location, useViewClipping);
int32_t viewY = Translate3DTo2DWithZ(rotation, CoordsXYZ(location.ToTileCentre(), z)).y;
int32_t viewY = Translate3DTo2DWithZ(rotation, CoordsXYZ(location.toTileCentre(), z)).y;
minViewY = std::min(minViewY, viewY);
}
}
@@ -287,10 +287,10 @@ static Viewport GetGiantViewport(int32_t rotation, ZoomLevel zoom)
// Calculate the viewport bounds
auto corners = cornerCoords[useViewClipping ? 1 : 0];
auto screenCoords1 = Translate3DTo2DWithZ(rotation, { corners[0].ToCoordsXY().ToTileCentre(), 0 });
auto screenCoords2 = Translate3DTo2DWithZ(rotation, { corners[1].ToCoordsXY().ToTileCentre(), 0 });
auto screenCoords3 = Translate3DTo2DWithZ(rotation, { corners[2].ToCoordsXY().ToTileCentre(), 0 });
auto screenCoords4 = Translate3DTo2DWithZ(rotation, { corners[3].ToCoordsXY().ToTileCentre(), 0 });
auto screenCoords1 = Translate3DTo2DWithZ(rotation, { corners[0].toCoordsXY().toTileCentre(), 0 });
auto screenCoords2 = Translate3DTo2DWithZ(rotation, { corners[1].toCoordsXY().toTileCentre(), 0 });
auto screenCoords3 = Translate3DTo2DWithZ(rotation, { corners[2].toCoordsXY().toTileCentre(), 0 });
auto screenCoords4 = Translate3DTo2DWithZ(rotation, { corners[3].toCoordsXY().toTileCentre(), 0 });
auto left = std::min({ screenCoords1.x, screenCoords2.x, screenCoords3.x, screenCoords4.x }) - 32;
auto top = GetTallestVisibleTileTop(rotation, corners[0], corners[1], useViewClipping);
+11 -11
View File
@@ -101,7 +101,7 @@ namespace OpenRCT2
// If the start location was invalid
// propagate the invalid location to the output.
// This fixes a bug that caused the game to enter an infinite loop.
if (loc.IsNull())
if (loc.isNull())
{
return std::nullopt;
}
@@ -716,7 +716,7 @@ namespace OpenRCT2
auto ride = GetRide(peep.currentRide);
if (ride != nullptr)
{
auto xy = ride->overallView.ToTileCentre();
auto xy = ride->overallView.toTileCentre();
CoordsXYZ coordFocus;
coordFocus.x = xy.x;
coordFocus.y = xy.y;
@@ -1060,12 +1060,12 @@ namespace OpenRCT2
if (direction != nullptr)
*direction = my_direction;
return { mapCoords->ToTileStart() };
return { mapCoords->toTileStart() };
}
[[nodiscard]] bool Viewport::ContainsTile(const TileCoordsXY coords) const noexcept
{
const auto centreCoords = coords.ToCoordsXY() + CoordsXY(kCoordsXYHalfTile, kCoordsXYHalfTile);
const auto centreCoords = coords.toCoordsXY() + CoordsXY(kCoordsXYHalfTile, kCoordsXYHalfTile);
const auto screenPos = Translate3DTo2DWithZ(rotation, CoordsXYZ{ centreCoords, 0 });
const auto left = screenPos.x - kScreenCoordsTileWidthHalf;
const auto top = screenPos.y - (kMaxTileElementHeight * kCoordsZStep) - kScreenCoordsTileHeightHalf;
@@ -1107,7 +1107,7 @@ namespace OpenRCT2
// Reverse of Translate3DTo2DWithZ
CoordsXY ret = { coords.y - coords.x / 2 + z, coords.y + coords.x / 2 + z };
auto inverseRotation = DirectionFlipXAxis(rotation);
return ret.Rotate(inverseRotation);
return ret.rotate(inverseRotation);
}
/**
@@ -1827,7 +1827,7 @@ namespace OpenRCT2
}
auto start_vp_pos = myViewport->ScreenToViewportCoord(screenCoords);
CoordsXY cursorMapPos = info.Loc.ToTileCentre();
CoordsXY cursorMapPos = info.Loc.toTileCentre();
// Iterates the cursor location to work out exactly where on the tile it is
for (int32_t i = 0; i < 5; i++)
@@ -1877,7 +1877,7 @@ namespace OpenRCT2
return std::nullopt;
*quadrant = MapGetTileQuadrant(*mapCoords);
return mapCoords->ToTileStart();
return mapCoords->toTileStart();
}
/**
@@ -1891,7 +1891,7 @@ namespace OpenRCT2
return std::nullopt;
*quadrant = MapGetTileQuadrant(*mapCoords);
return mapCoords->ToTileStart();
return mapCoords->toTileStart();
}
/**
@@ -1905,7 +1905,7 @@ namespace OpenRCT2
return std::nullopt;
*side = MapGetTileSide(*mapCoords);
return mapCoords->ToTileStart();
return mapCoords->toTileStart();
}
/**
@@ -1919,12 +1919,12 @@ namespace OpenRCT2
return std::nullopt;
*side = MapGetTileSide(*mapCoords);
return mapCoords->ToTileStart();
return mapCoords->toTileStart();
}
ScreenCoordsXY Translate3DTo2DWithZ(int32_t rotation, const CoordsXYZ& pos)
{
auto rotated = pos.Rotate(rotation);
auto rotated = pos.rotate(rotation);
// Use right shift to avoid issues like #9301
return ScreenCoordsXY{ rotated.y - rotated.x, ((rotated.x + rotated.y) >> 1) - pos.z };
}
+3 -3
View File
@@ -220,11 +220,11 @@ std::optional<CoordsXYZ> News::GetSubjectLocation(ItemType type, int32_t subject
case ItemType::ride:
{
Ride* ride = GetRide(RideId::FromUnderlying(subject));
if (ride == nullptr || ride->overallView.IsNull())
if (ride == nullptr || ride->overallView.isNull())
{
break;
}
auto rideViewCentre = ride->overallView.ToTileCentre();
auto rideViewCentre = ride->overallView.toTileCentre();
subjectLoc = CoordsXYZ{ rideViewCentre, TileElementHeight(rideViewCentre) };
break;
}
@@ -279,7 +279,7 @@ std::optional<CoordsXYZ> News::GetSubjectLocation(ItemType type, int32_t subject
auto subjectUnsigned = static_cast<uint32_t>(subject);
auto subjectXY = CoordsXY{ static_cast<int16_t>(subjectUnsigned & 0xFFFF),
static_cast<int16_t>(subjectUnsigned >> 16) };
if (!subjectXY.IsNull())
if (!subjectXY.isNull())
{
subjectLoc = CoordsXYZ{ subjectXY, TileElementHeight(subjectXY) };
}
+14 -14
View File
@@ -153,18 +153,18 @@ static constexpr CoordsXYZ RotateBoundBoxSize(const CoordsXYZ& bbSize, const uin
case 0:
output.x--;
output.y--;
output = { output.Rotate(0), output.z };
output = { output.rotate(0), output.z };
break;
case 1:
output.x--;
output = { output.Rotate(3), output.z };
output = { output.rotate(3), output.z };
break;
case 2:
output = { output.Rotate(2), output.z };
output = { output.rotate(2), output.z };
break;
case 3:
output.y--;
output = { output.Rotate(1), output.z };
output = { output.rotate(1), output.z };
break;
}
return output;
@@ -183,7 +183,7 @@ static PaintStruct* CreateNormalPaintStruct(
}
const auto swappedRotation = DirectionFlipXAxis(session.CurrentRotation);
auto swappedRotCoord = CoordsXYZ{ offset.Rotate(swappedRotation), offset.z };
auto swappedRotCoord = CoordsXYZ{ offset.rotate(swappedRotation), offset.z };
swappedRotCoord += session.SpritePosition;
const auto imagePos = Translate3DTo2DWithZ(session.CurrentRotation, swappedRotCoord);
@@ -193,7 +193,7 @@ static PaintStruct* CreateNormalPaintStruct(
return nullptr;
}
const auto rotBoundBoxOffset = CoordsXYZ{ boundBox.offset.Rotate(swappedRotation), boundBox.offset.z };
const auto rotBoundBoxOffset = CoordsXYZ{ boundBox.offset.rotate(swappedRotation), boundBox.offset.z };
const auto rotBoundBoxSize = RotateBoundBoxSize(boundBox.length, session.CurrentRotation);
auto* ps = session.AllocateNormalPaintEntry();
@@ -231,7 +231,7 @@ static PaintStruct* CreateNormalPaintStructHeight(
}
const auto swappedRotation = DirectionFlipXAxis(session.CurrentRotation);
auto swappedRotCoord = CoordsXYZ{ offset.Rotate(swappedRotation), offset.z + height };
auto swappedRotCoord = CoordsXYZ{ offset.rotate(swappedRotation), offset.z + height };
swappedRotCoord += session.SpritePosition;
const auto imagePos = Translate3DTo2DWithZ(session.CurrentRotation, swappedRotCoord);
@@ -241,7 +241,7 @@ static PaintStruct* CreateNormalPaintStructHeight(
return nullptr;
}
const auto rotBoundBoxOffset = CoordsXYZ{ boundBox.offset.Rotate(swappedRotation), boundBox.offset.z + height };
const auto rotBoundBoxOffset = CoordsXYZ{ boundBox.offset.rotate(swappedRotation), boundBox.offset.z + height };
const auto rotBoundBoxSize = RotateBoundBoxSize(boundBox.length, session.CurrentRotation);
auto* ps = session.AllocateNormalPaintEntry();
@@ -275,23 +275,23 @@ void PaintSessionGenerateRotate(PaintSession& session)
// Optimised modified version of ViewportPosToMapPos
ScreenCoordsXY screenCoord = { floor2(session.rt.WorldX(), 32), floor2((session.rt.WorldY() - 16), 32) };
CoordsXY mapTile = { screenCoord.y - screenCoord.x / 2, screenCoord.y + screenCoord.x / 2 };
mapTile = mapTile.Rotate(direction);
mapTile = mapTile.rotate(direction);
if constexpr (direction & 1)
{
mapTile.y -= 16;
}
mapTile = mapTile.ToTileStart();
mapTile = mapTile.toTileStart();
uint16_t numVerticalTiles = (session.rt.WorldHeight() + 2128) >> 5;
// Adjacent tiles to also check due to overlapping of sprites
constexpr CoordsXY adjacentTiles[] = {
CoordsXY{ -32, 32 }.Rotate(direction),
CoordsXY{ 0, 32 }.Rotate(direction),
CoordsXY{ 32, 0 }.Rotate(direction),
CoordsXY{ -32, 32 }.rotate(direction),
CoordsXY{ 0, 32 }.rotate(direction),
CoordsXY{ 32, 0 }.rotate(direction),
};
constexpr CoordsXY nextVerticalTile = CoordsXY{ 32, 32 }.Rotate(direction);
constexpr CoordsXY nextVerticalTile = CoordsXY{ 32, 32 }.rotate(direction);
for (; numVerticalTiles > 0; --numVerticalTiles)
{
@@ -330,7 +330,7 @@ static void ViewportSurfaceSmoothenEdge(
return;
// The edge row consists of invisible grass tiles. Do not attempt to smooth with them.
if (MapIsEdge(self.tile_coords.ToCoordsXY()) || MapIsEdge(neighbour.tile_coords.ToCoordsXY()))
if (MapIsEdge(self.tile_coords.toCoordsXY()) || MapIsEdge(neighbour.tile_coords.toCoordsXY()))
return;
uint32_t maskImageBase = 0;
@@ -436,7 +436,7 @@ static bool TileIsInsideClipView(const TileDescriptor& tile)
if (tile.tile_element->getBaseZ() > gClipHeight * kCoordsZStep)
return false;
auto coords = tile.tile_coords.ToCoordsXY();
auto coords = tile.tile_coords.toCoordsXY();
if (coords.x < gClipSelectionA.x || coords.x > gClipSelectionB.x)
return false;
if (coords.y < gClipSelectionA.y || coords.y > gClipSelectionB.y)
+9 -9
View File
@@ -198,7 +198,7 @@ namespace OpenRCT2::PathFinding
static int32_t PeepMoveOneTile(Direction direction, Peep& peep)
{
assert(DirectionValid(direction));
auto newTile = CoordsXY{ CoordsXY{ peep.nextLoc } + CoordsDirectionDelta[direction] }.ToTileCentre();
auto newTile = CoordsXY{ CoordsXY{ peep.nextLoc } + CoordsDirectionDelta[direction] }.toTileCentre();
if (newTile.x >= kMaximumMapSizeBig || newTile.y >= kMaximumMapSizeBig)
{
@@ -723,7 +723,7 @@ namespace OpenRCT2::PathFinding
if (currentElementIsWide)
{
const Staff* staff = peep.as<Staff>();
if (staff != nullptr && staff->canIgnoreWideFlag(loc.ToCoordsXYZ(), currentTileElement))
if (staff != nullptr && staff->canIgnoreWideFlag(loc.toCoordsXYZ(), currentTileElement))
currentElementIsWide = false;
}
@@ -745,7 +745,7 @@ namespace OpenRCT2::PathFinding
auto* staff = peep.as<Staff>();
if (staff != nullptr && staff->isMechanic())
{
nextInPatrolArea = staff->isLocationInPatrol(loc.ToCoordsXY());
nextInPatrolArea = staff->isLocationInPatrol(loc.toCoordsXY());
if (inPatrolArea && !nextInPatrolArea)
{
/* The mechanic will leave his patrol area by taking
@@ -850,7 +850,7 @@ namespace OpenRCT2::PathFinding
if (pathElement->isWide())
{
/* Check if staff can ignore this wide flag. */
if (staff == nullptr || !staff->canIgnoreWideFlag(loc.ToCoordsXYZ(), tileElement))
if (staff == nullptr || !staff->canIgnoreWideFlag(loc.toCoordsXYZ(), tileElement))
{
searchResult = PathSearchResult::wide;
found = true;
@@ -1356,7 +1356,7 @@ namespace OpenRCT2::PathFinding
// Clear pathfinding history
TileCoordsXYZD nullPos;
nullPos.SetNull();
nullPos.setNull();
std::fill(std::begin(peep.pathfindHistory), std::end(peep.pathfindHistory), nullPos);
@@ -1408,7 +1408,7 @@ namespace OpenRCT2::PathFinding
for (auto& entry : state.history)
{
entry.location.SetNull();
entry.location.setNull();
entry.direction = kInvalidDirection;
}
@@ -1635,7 +1635,7 @@ namespace OpenRCT2::PathFinding
if (chosenSpawn == 0xFF)
return GuestPathfindAimless(peep, edges);
const auto peepSpawnLoc = getGameState().peepSpawns[chosenSpawn].ToTileStart();
const auto peepSpawnLoc = getGameState().peepSpawns[chosenSpawn].toTileStart();
Direction direction = peepSpawnLoc.direction;
if (peepSpawnLoc.x == peep.nextLoc.x && peepSpawnLoc.y == peep.nextLoc.y)
@@ -1661,7 +1661,7 @@ namespace OpenRCT2::PathFinding
if (peep.peepFlags.has(PeepFlag::parkEntranceChosen))
{
entranceGoal = peep.pathfindGoal;
auto* entranceElement = MapGetParkEntranceElementAt(entranceGoal.ToCoordsXYZ(), false);
auto* entranceElement = MapGetParkEntranceElementAt(entranceGoal.toCoordsXYZ(), false);
// If entrance no longer exists, choose a new one
if (entranceElement == nullptr)
{
@@ -2051,7 +2051,7 @@ namespace OpenRCT2::PathFinding
for (const auto& station : ride->getStations())
{
// Skip if stationNum has no entrance (so presumably an exit only station)
if (station.entrance.IsNull())
if (station.entrance.isNull())
continue;
const auto stationIndex = ride->getStationIndex(&station);
+13 -13
View File
@@ -868,11 +868,11 @@ namespace OpenRCT2::RCT1
// Station
if (src->overallView.IsNull())
{
dst->overallView.SetNull();
dst->overallView.setNull();
}
else
{
dst->overallView = TileCoordsXY{ src->overallView.x, src->overallView.y }.ToCoordsXY();
dst->overallView = TileCoordsXY{ src->overallView.x, src->overallView.y }.toCoordsXY();
}
for (StationIndex::UnderlyingType i = 0; i < Limits::kMaxStationsPerRide; i++)
@@ -880,12 +880,12 @@ namespace OpenRCT2::RCT1
auto& dstStation = dst->getStation(StationIndex::FromUnderlying(i));
if (src->stationStarts[i].IsNull())
{
dstStation.start.SetNull();
dstStation.start.setNull();
}
else
{
auto tileStartLoc = TileCoordsXY{ src->stationStarts[i].x, src->stationStarts[i].y };
dstStation.start = tileStartLoc.ToCoordsXY();
dstStation.start = tileStartLoc.toCoordsXY();
}
dstStation.setBaseZ(src->stationHeights[i] * Limits::kCoordsZStep);
dstStation.length = src->stationLengths[i];
@@ -895,12 +895,12 @@ namespace OpenRCT2::RCT1
// Direction is fixed later.
if (src->entrances[i].IsNull())
dstStation.entrance.SetNull();
dstStation.entrance.setNull();
else
dstStation.entrance = { src->entrances[i].x, src->entrances[i].y, src->stationHeights[i] / 2, 0 };
if (src->exits[i].IsNull())
dstStation.exit.SetNull();
dstStation.exit.setNull();
else
dstStation.exit = { src->exits[i].x, src->exits[i].y, src->stationHeights[i] / 2, 0 };
@@ -915,10 +915,10 @@ namespace OpenRCT2::RCT1
for (int32_t i = Limits::kMaxStationsPerRide; i < OpenRCT2::Limits::kMaxStationsPerRide; i++)
{
auto& dstStation = dst->getStation(StationIndex::FromUnderlying(i));
dstStation.start.SetNull();
dstStation.start.setNull();
dstStation.trainAtStation = RideStation::kNoTrain;
dstStation.entrance.SetNull();
dstStation.exit.SetNull();
dstStation.entrance.setNull();
dstStation.exit.setNull();
dstStation.lastPeepInQueue = EntityId::GetNull();
}
@@ -1051,7 +1051,7 @@ namespace OpenRCT2::RCT1
if (src->curTestTrackLocation.IsNull())
{
dst->curTestTrackLocation.SetNull();
dst->curTestTrackLocation.setNull();
}
else
{
@@ -2542,7 +2542,7 @@ namespace OpenRCT2::RCT1
if ((element->asEntrance()->getSequenceIndex()) != ParkEntranceSequence::centre)
continue;
CoordsXYZD entrance = { TileCoordsXY(it.x, it.y).ToCoordsXY(), element->getBaseZ(), element->getDirection() };
CoordsXYZD entrance = { TileCoordsXY(it.x, it.y).toCoordsXY(), element->getBaseZ(), element->getDirection() };
park.entrances.push_back(entrance);
}
}
@@ -2877,13 +2877,13 @@ namespace OpenRCT2::RCT1
dst->current_station = StationIndex::FromUnderlying(src->CurrentStation);
if (src->BoatLocation.IsNull() || ride->mode != RideMode::boatHire || statusSrc != ::Vehicle::Status::travellingBoat)
{
dst->BoatLocation.SetNull();
dst->BoatLocation.setNull();
dst->SetTrackDirection(src->GetTrackDirection());
dst->SetTrackType(RCT1TrackTypeToOpenRCT2(src->GetTrackType(), ride->type));
}
else
{
dst->BoatLocation = TileCoordsXY{ src->BoatLocation.x, src->BoatLocation.y }.ToCoordsXY();
dst->BoatLocation = TileCoordsXY{ src->BoatLocation.x, src->BoatLocation.y }.toCoordsXY();
dst->SetTrackDirection(0);
dst->SetTrackType(TrackElemType::flat);
}
+1 -1
View File
@@ -268,7 +268,7 @@ namespace OpenRCT2::RCT1
td->statistics.ratings.intensity = td4Base.Intensity * kTD46RatingsMultiplier;
td->statistics.ratings.nausea = td4Base.Nausea * kTD46RatingsMultiplier;
td->statistics.upkeepCost = ToMoney64(td4Base.UpkeepCost);
td->statistics.spaceRequired.SetNull();
td->statistics.spaceRequired.setNull();
td->operation.liftHillSpeed = 5;
td->operation.numCircuits = 1;
td->operation.operationSetting = std::min(
+7 -7
View File
@@ -212,7 +212,7 @@ static void FixLandOwnershipTilesWithOwnership(const std::span<const TileCoordsX
if (surfaceElement != nullptr)
{
surfaceElement->setOwnership(ownership);
Park::UpdateFencesAroundTile(tile.ToCoordsXY());
Park::UpdateFencesAroundTile(tile.toCoordsXY());
}
}
}
@@ -487,7 +487,7 @@ static void RemoveTileElements(const json_t& scenarioPatch)
for (const auto& tile : coordinatesVector)
{
auto tileElement = MapGetNthElementAt(tile.ToCoordsXY(), elementIndex);
auto tileElement = MapGetNthElementAt(tile.toCoordsXY(), elementIndex);
if (tileElement == nullptr)
{
Guard::Assert(false, "Invalid Nth element at tile");
@@ -495,7 +495,7 @@ static void RemoveTileElements(const json_t& scenarioPatch)
}
else
{
ClearElementAt(tile.ToCoordsXY(), &tileElement);
ClearElementAt(tile.toCoordsXY(), &tileElement);
}
}
}
@@ -530,15 +530,15 @@ static void SwapRideEntranceAndExit(RideId rideId)
station.entrance = entranceCoords;
station.exit = exitCoords;
auto entranceElement = MapGetRideExitElementAt(entranceCoords.ToCoordsXYZD(), false);
auto entranceElement = MapGetRideExitElementAt(entranceCoords.toCoordsXYZD(), false);
entranceElement->setEntranceType(EntranceType::rideEntrance);
auto exitElement = MapGetRideEntranceElementAt(exitCoords.ToCoordsXYZD(), false);
auto exitElement = MapGetRideEntranceElementAt(exitCoords.toCoordsXYZD(), false);
exitElement->setEntranceType(EntranceType::rideExit);
// Trigger footpath update
FootpathQueueChainReset();
FootpathConnectEdges(
entranceCoords.ToCoordsXY(), reinterpret_cast<TileElement*>(entranceElement),
entranceCoords.toCoordsXY(), reinterpret_cast<TileElement*>(entranceElement),
{ CommandFlag::apply, CommandFlag::allowDuringPaused });
FootpathUpdateQueueChains();
}
@@ -739,7 +739,7 @@ static void ApplyPathFixes(const json_t& scenarioPatch)
if (direction != kInvalidDirection)
slope = { FootpathSlopeType::sloped, direction };
auto footpathPlaceAction = GameActions::FootpathPlaceAction(
coordinate.ToCoordsXYZ(), slope, surfaceObjIndex, railingsObjIndex, direction, constructionFlags);
coordinate.toCoordsXYZ(), slope, surfaceObjIndex, railingsObjIndex, direction, constructionFlags);
auto& gameState = getGameState();
auto result = footpathPlaceAction.Execute(gameState, gameState.park);
if (result.error != GameActions::Status::ok)
+14 -14
View File
@@ -749,12 +749,12 @@ namespace OpenRCT2::RCT2
if (src->overallView.IsNull())
{
dst->overallView.SetNull();
dst->overallView.setNull();
}
else
{
auto tileLoc = TileCoordsXY(src->overallView.x, src->overallView.y);
dst->overallView = tileLoc.ToCoordsXY();
dst->overallView = tileLoc.toCoordsXY();
}
for (StationIndex::UnderlyingType i = 0; i < Limits::kMaxStationsPerRide; i++)
@@ -764,12 +764,12 @@ namespace OpenRCT2::RCT2
if (src->stationStarts[i].IsNull())
{
destStation.start.SetNull();
destStation.start.setNull();
}
else
{
auto tileStartLoc = TileCoordsXY(src->stationStarts[i].x, src->stationStarts[i].y);
destStation.start = tileStartLoc.ToCoordsXY();
destStation.start = tileStartLoc.toCoordsXY();
}
destStation.height = src->stationHeights[i];
destStation.length = src->stationLength[i];
@@ -778,12 +778,12 @@ namespace OpenRCT2::RCT2
// Direction is fixed later.
if (src->entrances[i].IsNull())
destStation.entrance.SetNull();
destStation.entrance.setNull();
else
destStation.entrance = { src->entrances[i].x, src->entrances[i].y, src->stationHeights[i], 0 };
if (src->exits[i].IsNull())
destStation.exit.SetNull();
destStation.exit.setNull();
else
destStation.exit = { src->exits[i].x, src->exits[i].y, src->stationHeights[i], 0 };
@@ -802,10 +802,10 @@ namespace OpenRCT2::RCT2
StationIndex stationIndex = StationIndex::FromUnderlying(i);
auto& destStation = dst->getStation(stationIndex);
destStation.start.SetNull();
destStation.start.setNull();
destStation.trainAtStation = RideStation::kNoTrain;
destStation.entrance.SetNull();
destStation.exit.SetNull();
destStation.entrance.setNull();
destStation.exit.setNull();
destStation.lastPeepInQueue = EntityId::GetNull();
}
@@ -858,7 +858,7 @@ namespace OpenRCT2::RCT2
if (src->curTestTrackLocation.IsNull())
{
dst->curTestTrackLocation.SetNull();
dst->curTestTrackLocation.setNull();
}
else
{
@@ -1724,7 +1724,7 @@ namespace OpenRCT2::RCT2
dst->peepFlags.holder = src->PeepFlags;
if (isNullLocation(src->PathfindGoal))
{
dst->pathfindGoal.SetNull();
dst->pathfindGoal.setNull();
dst->pathfindGoal.direction = kInvalidDirection;
}
else
@@ -1736,7 +1736,7 @@ namespace OpenRCT2::RCT2
{
if (isNullLocation(src->PathfindHistory[i]))
{
dst->pathfindHistory[i].SetNull();
dst->pathfindHistory[i].setNull();
dst->pathfindHistory[i].direction = kInvalidDirection;
}
else
@@ -1999,7 +1999,7 @@ namespace OpenRCT2::RCT2
if (src->BoatLocation.IsNull() || static_cast<RideMode>(ride.mode) != RideMode::boatHire
|| src->Status != static_cast<uint8_t>(::Vehicle::Status::travellingBoat))
{
dst->BoatLocation.SetNull();
dst->BoatLocation.setNull();
dst->SetTrackDirection(src->GetTrackDirection());
// Skipping OriginalRideClass::wildMouse - this is handled specifically.
auto originalClass = IsFlatRide(src->Ride) ? OriginalRideClass::flatRide : OriginalRideClass::regular;
@@ -2026,7 +2026,7 @@ namespace OpenRCT2::RCT2
}
else
{
dst->BoatLocation = TileCoordsXY{ src->BoatLocation.x, src->BoatLocation.y }.ToCoordsXY();
dst->BoatLocation = TileCoordsXY{ src->BoatLocation.x, src->BoatLocation.y }.toCoordsXY();
dst->SetTrackDirection(0);
dst->SetTrackType(TrackElemType::flat);
}
+1 -1
View File
@@ -197,7 +197,7 @@ namespace OpenRCT2::RCT2
tempStream.WriteValue<uint8_t>(
entranceElement.location.z == -1 ? static_cast<uint8_t>(0x80) : entranceElement.location.z);
tempStream.WriteValue<uint8_t>(entranceElement.location.direction | (entranceElement.isExit << 7));
auto xy = entranceElement.location.ToCoordsXY();
auto xy = entranceElement.location.toCoordsXY();
tempStream.WriteValue<int16_t>(xy.x);
tempStream.WriteValue<int16_t>(xy.y);
}
+1 -1
View File
@@ -127,7 +127,7 @@ namespace OpenRCT2::RCT2
TrackDesignSceneryElement sceneryElement{};
sceneryElement.sceneryObject = ObjectEntryDescriptor(t6SceneryElement.SceneryObject);
TileCoordsXYZ tileCoords = { t6SceneryElement.x, t6SceneryElement.y, t6SceneryElement.z };
sceneryElement.loc = tileCoords.ToCoordsXYZ();
sceneryElement.loc = tileCoords.toCoordsXYZ();
sceneryElement.flags = t6SceneryElement.Flags;
sceneryElement.primaryColour = t6SceneryElement.PrimaryColour;
sceneryElement.secondaryColour = t6SceneryElement.SecondaryColour;
+1 -1
View File
@@ -83,7 +83,7 @@ Vehicle* CableLiftSegmentCreate(
current->SetState(Vehicle::Status::movingToEndOfStation, 0);
current->num_peeps = 0;
current->next_free_seat = 0;
current->BoatLocation.SetNull();
current->BoatLocation.setNull();
return current;
}
+46 -46
View File
@@ -337,7 +337,7 @@ namespace OpenRCT2
{
int32_t queueLength = 0;
for (const auto& station : stations)
if (!station.entrance.IsNull())
if (!station.entrance.isNull())
queueLength += station.queueLength;
return queueLength;
}
@@ -346,7 +346,7 @@ namespace OpenRCT2
{
uint8_t queueTime = 0;
for (const auto& station : stations)
if (!station.entrance.IsNull())
if (!station.entrance.isNull())
queueTime = std::max(queueTime, station.queueTime);
return static_cast<int32_t>(queueTime);
}
@@ -766,7 +766,7 @@ namespace OpenRCT2
StationIndex::UnderlyingType nullStationsSeen{ 0 };
for (size_t i = 0; i < in.ToUnderlying(); i++)
{
if (stations[i].start.IsNull())
if (stations[i].start.isNull())
{
nullStationsSeen++;
}
@@ -884,10 +884,10 @@ namespace OpenRCT2
if (oldChairliftBullwheelRotation == ride.speed / 8)
return;
auto bullwheelLoc = ride.chairliftBullwheelLocation[0].ToCoordsXYZ();
auto bullwheelLoc = ride.chairliftBullwheelLocation[0].toCoordsXYZ();
MapInvalidateTileZoom1({ bullwheelLoc, bullwheelLoc.z, bullwheelLoc.z + (4 * kCoordsZStep) });
bullwheelLoc = ride.chairliftBullwheelLocation[1].ToCoordsXYZ();
bullwheelLoc = ride.chairliftBullwheelLocation[1].toCoordsXYZ();
MapInvalidateTileZoom1({ bullwheelLoc, bullwheelLoc.z, bullwheelLoc.z + (4 * kCoordsZStep) });
}
@@ -987,7 +987,7 @@ namespace OpenRCT2
// Invalidate something related to station start
for (int32_t i = 0; i < Limits::kMaxStationsPerRide; i++)
{
if (ride.stations[i].start.IsNull())
if (ride.stations[i].start.isNull())
continue;
auto startLoc = ride.stations[i].start;
@@ -1494,21 +1494,21 @@ namespace OpenRCT2
// Get either exit position or entrance position if there is no exit
const auto& station = ride.getStation(stationIndex);
TileCoordsXYZD location = station.exit;
if (location.IsNull())
if (location.isNull())
{
location = station.entrance;
if (station.entrance.IsNull())
if (station.entrance.isNull())
return nullptr;
}
// Get station start track element and position
auto mapLocation = location.ToCoordsXYZ();
auto mapLocation = location.toCoordsXYZ();
TileElement* tileElement = RideGetStationExitElement(mapLocation);
if (tileElement == nullptr)
return nullptr;
// Set x,y to centre of the station exit for the mechanic search.
auto centreMapLocation = mapLocation.ToTileCentre();
auto centreMapLocation = mapLocation.toTileCentre();
return FindClosestMechanic(centreMapLocation, forInspection);
}
@@ -1547,7 +1547,7 @@ namespace OpenRCT2
continue;
}
auto location = entrancePosition.ToTileStart();
auto location = entrancePosition.toTileStart();
if (MapIsLocationInPark(location))
if (!peep->isLocationInPatrol(location))
continue;
@@ -1668,7 +1668,7 @@ namespace OpenRCT2
return;
}
CoordsXYZ rideCoords = ride.getStation().getStart().ToTileCentre();
CoordsXYZ rideCoords = ride.getStation().getStart().toTileCentre();
const auto sampleRate = RideMusicSampleRate(ride);
@@ -1706,7 +1706,7 @@ namespace OpenRCT2
return;
}
CoordsXYZ rideCoords = ride.getStation().getStart().ToTileCentre();
CoordsXYZ rideCoords = ride.getStation().getStart().toTileCentre();
int32_t sampleRate = RideMusicSampleRate(ride);
@@ -2035,7 +2035,7 @@ namespace OpenRCT2
*/
static bool RideEntranceExitIsReachable(const TileCoordsXYZD& coordinates)
{
if (coordinates.IsNull())
if (coordinates.isNull())
return true;
TileCoordsXYZ loc{ coordinates.x, coordinates.y, coordinates.z };
@@ -2052,10 +2052,10 @@ namespace OpenRCT2
auto entrance = station.entrance;
auto exit = station.exit;
if (station_start.IsNull())
if (station_start.isNull())
continue;
if (!entrance.IsNull() && !RideEntranceExitIsReachable(entrance))
if (!entrance.isNull() && !RideEntranceExitIsReachable(entrance))
{
// name of ride is parameter of the format string
Formatter ft;
@@ -2067,7 +2067,7 @@ namespace OpenRCT2
ride.connectedMessageThrottle = 3;
}
if (!exit.IsNull() && !RideEntranceExitIsReachable(exit))
if (!exit.isNull() && !RideEntranceExitIsReachable(exit))
{
// name of ride is parameter of the format string
Formatter ft;
@@ -2084,7 +2084,7 @@ namespace OpenRCT2
static void RideShopConnected(const Ride& ride)
{
auto shopLoc = TileCoordsXY(ride.getStation().start);
if (shopLoc.IsNull())
if (shopLoc.isNull())
return;
TrackElement* trackElement = nullptr;
@@ -2217,7 +2217,7 @@ namespace OpenRCT2
// Get the queue length
int32_t queueLength = 0;
const auto stationIndex = entranceElement.getStationIndex();
if (!ride->getStation(stationIndex).entrance.IsNull())
if (!ride->getStation(stationIndex).entrance.isNull())
{
queueLength = ride->getStation(stationIndex).queueLength;
}
@@ -2304,7 +2304,7 @@ namespace OpenRCT2
uint16_t numStations = 0;
for (const auto& station : ride.getStations())
{
if (!station.start.IsNull())
if (!station.start.isNull())
{
numStations++;
}
@@ -2377,22 +2377,22 @@ namespace OpenRCT2
uint8_t exit = 0;
for (const auto& station : ride->getStations())
{
if (station.start.IsNull())
if (station.start.isNull())
continue;
if (!station.entrance.IsNull())
if (!station.entrance.isNull())
{
entrance = 1;
}
if (!station.exit.IsNull())
if (!station.exit.isNull())
{
exit = 1;
}
// If station start and no entrance/exit
// Sets same error message as no entrance
if (station.exit.IsNull() && station.entrance.IsNull())
if (station.exit.isNull() && station.entrance.isNull())
{
entrance = 0;
break;
@@ -2420,10 +2420,10 @@ namespace OpenRCT2
{
for (const auto& station : stations)
{
if (station.entrance.IsNull())
if (station.entrance.isNull())
continue;
auto mapLocation = station.entrance.ToCoordsXYZ();
auto mapLocation = station.entrance.toCoordsXYZ();
// This will fire for every entrance on this x, y and z, regardless whether that actually belongs to
// the ride or not.
@@ -2764,21 +2764,21 @@ namespace OpenRCT2
TileCoordsXYZD* position = positions;
for (const auto& station : ride.getStations())
{
if (!station.entrance.IsNull())
if (!station.entrance.isNull())
{
*position++ = station.entrance;
}
if (!station.exit.IsNull())
if (!station.exit.isNull())
{
*position++ = station.exit;
}
}
position->SetNull();
position->setNull();
// Enumerate entrance and exit positions
for (position = positions; !position->IsNull(); position++)
for (position = positions; !position->isNull(); position++)
{
auto entranceExitMapPos = position->ToCoordsXYZ();
auto entranceExitMapPos = position->toCoordsXYZ();
TileElement* tileElement = MapGetFirstElementAt(*position);
do
@@ -3166,7 +3166,7 @@ namespace OpenRCT2
// Loc6DDD5E:
vehicle->num_peeps = 0;
vehicle->next_free_seat = 0;
vehicle->BoatLocation.SetNull();
vehicle->BoatLocation.setNull();
return vehicle;
}
@@ -3524,7 +3524,7 @@ namespace OpenRCT2
for (const auto& station : ride.getStations())
{
CoordsXYZ trackStart = station.getStart();
if (trackStart.IsNull())
if (trackStart.isNull())
continue;
TileElement* tileElement = MapGetTrackElementAtOfType(trackStart, TrackElemType::endStation);
@@ -3695,17 +3695,17 @@ namespace OpenRCT2
const RideStation* incompleteStation = nullptr;
for (const auto& station : stations)
{
if (station.start.IsNull())
if (station.start.isNull())
continue;
if (station.entrance.IsNull())
if (station.entrance.isNull())
{
entranceOrExit = WC_RIDE_CONSTRUCTION__WIDX_ENTRANCE;
incompleteStation = &station;
break;
}
if (station.exit.IsNull())
if (station.exit.isNull())
{
entranceOrExit = WC_RIDE_CONSTRUCTION__WIDX_EXIT;
incompleteStation = &station;
@@ -4723,7 +4723,7 @@ namespace OpenRCT2
std::optional<int32_t> result;
for (const auto& station : ride.getStations())
{
if (!station.start.IsNull())
if (!station.start.isNull())
{
if (!result.has_value() || station.length < result.value())
{
@@ -4748,7 +4748,7 @@ namespace OpenRCT2
for (const auto& station : ride.getStations())
{
trackStart = station.getStart();
if (trackStart.IsNull())
if (trackStart.isNull())
continue;
tileElement = MapGetFirstElementAt(trackStart);
@@ -5187,7 +5187,7 @@ namespace OpenRCT2
for (const auto& station : ride.getStations())
{
auto stationStart = station.getStart();
if (!stationStart.IsNull())
if (!stationStart.isNull())
{
/* Get the map element for the station start. */
TileElement* stationElement = GetStationPlatform({ stationStart, stationStart.z + 0 });
@@ -5336,9 +5336,9 @@ namespace OpenRCT2
bool fixExit = false;
// Skip if the station has no entrance
if (!entranceLoc.IsNull())
if (!entranceLoc.isNull())
{
const EntranceElement* entranceElement = MapGetRideEntranceElementAt(entranceLoc.ToCoordsXYZD(), false);
const EntranceElement* entranceElement = MapGetRideEntranceElementAt(entranceLoc.toCoordsXYZD(), false);
if (entranceElement == nullptr || entranceElement->getRideIndex() != ride.id
|| entranceElement->getStationIndex() != stationIndex)
@@ -5351,9 +5351,9 @@ namespace OpenRCT2
}
}
if (!exitLoc.IsNull())
if (!exitLoc.isNull())
{
const EntranceElement* entranceElement = MapGetRideExitElementAt(exitLoc.ToCoordsXYZD(), false);
const EntranceElement* entranceElement = MapGetRideExitElementAt(exitLoc.toCoordsXYZD(), false);
if (entranceElement == nullptr || entranceElement->getRideIndex() != ride.id
|| entranceElement->getStationIndex() != stationIndex)
@@ -5445,12 +5445,12 @@ namespace OpenRCT2
if (fixEntrance && !alreadyFoundEntrance)
{
station.entrance.SetNull();
station.entrance.setNull();
LOG_VERBOSE("Cleared disconnected entrance of ride %d, station %d.", ride.id, stationIndex);
}
if (fixExit && !alreadyFoundExit)
{
station.exit.SetNull();
station.exit.setNull();
LOG_VERBOSE("Cleared disconnected exit of ride %d, station %d.", ride.id, stationIndex);
}
}
@@ -5464,7 +5464,7 @@ namespace OpenRCT2
{
for (tilePos.y = 0; tilePos.y < gameState.mapSize.y; ++tilePos.y)
{
for (auto* entrance : TileElementsView<EntranceElement>(tilePos.ToCoordsXY()))
for (auto* entrance : TileElementsView<EntranceElement>(tilePos.toCoordsXY()))
{
const bool isRideEntranceExit = entrance->getEntranceType() == EntranceType::rideEntrance
|| entrance->getEntranceType() == EntranceType::rideExit;
+21 -21
View File
@@ -465,8 +465,8 @@ namespace OpenRCT2
auto exitPosition = CoordsXYZD{ 0, 0, 0, kInvalidDirection };
if (!stationIndex.IsNull())
{
auto location = getStation(stationIndex).exit.ToCoordsXYZD();
if (!location.IsNull())
auto location = getStation(stationIndex).exit.toCoordsXYZD();
if (!location.isNull())
{
auto direction = DirectionReverse(location.direction);
exitPosition = location;
@@ -496,7 +496,7 @@ namespace OpenRCT2
if (exitPosition.direction == kInvalidDirection)
{
CoordsXYZ newLoc = { peep->nextLoc.ToTileCentre(), peep->nextLoc.z };
CoordsXYZ newLoc = { peep->nextLoc.toTileCentre(), peep->nextLoc.z };
if (peep->getNextIsSloped())
newLoc.z += kCoordsZStep;
newLoc.z++;
@@ -526,7 +526,7 @@ namespace OpenRCT2
if (exitPosition.direction == kInvalidDirection)
{
CoordsXYZ newLoc = { peep->nextLoc.ToTileCentre(), peep->nextLoc.z };
CoordsXYZ newLoc = { peep->nextLoc.toTileCentre(), peep->nextLoc.z };
if (peep->getNextIsSloped())
newLoc.z += kCoordsZStep;
newLoc.z++;
@@ -556,14 +556,14 @@ namespace OpenRCT2
{
for (tilePos.y = 0; tilePos.y < gameState.mapSize.y; ++tilePos.y)
{
for (auto* trackElement : TileElementsView<TrackElement>(tilePos.ToCoordsXY()))
for (auto* trackElement : TileElementsView<TrackElement>(tilePos.toCoordsXY()))
{
if (trackElement->getRideIndex() != ride.id)
continue;
// Unblock footpath element that is at same position
auto* footpathElement = MapGetFootpathElement(
TileCoordsXYZ{ tilePos, trackElement->baseHeight }.ToCoordsXYZ());
TileCoordsXYZ{ tilePos, trackElement->baseHeight }.toCoordsXYZ());
if (footpathElement == nullptr)
continue;
@@ -613,7 +613,7 @@ namespace OpenRCT2
CoordsXY offsets = { trackBlock.x, trackBlock.y };
CoordsXY newCoords = location;
newCoords += offsets.Rotate(DirectionReverse(mapDirection));
newCoords += offsets.rotate(DirectionReverse(mapDirection));
auto retCoordsXYZ = CoordsXYZ{ newCoords.x, newCoords.y, location.z - trackBlock.z };
@@ -627,7 +627,7 @@ namespace OpenRCT2
const auto& block = ted.sequenceData.sequences[i].clearance;
CoordsXY cur = { retCoordsXYZ };
offsets = { block.x, block.y };
cur += offsets.Rotate(mapDirection);
cur += offsets.rotate(mapDirection);
int32_t cur_z = start_z + block.z;
MapInvalidateTileFull(cur);
@@ -727,7 +727,7 @@ namespace OpenRCT2
case RideConstructionState::back:
if (_currentTrackSelectionFlags.has(TrackSelectionFlag::arrow))
{
MapInvalidateTileFull(_currentTrackBegin.ToTileStart());
MapInvalidateTileFull(_currentTrackBegin.toTileStart());
}
RideConstructionRemoveGhosts();
break;
@@ -1394,7 +1394,7 @@ namespace OpenRCT2
// find the stations of the ride to begin stepping over track elements from
for (const auto& station : stations)
{
if (station.start.IsNull())
if (station.start.isNull())
continue;
CoordsXYZ location = station.getStart();
@@ -1464,7 +1464,7 @@ namespace OpenRCT2
for (uint8_t i = 0; i < ted.sequenceData.numSequences; i++)
{
const auto& block = ted.sequenceData.sequences[i].clearance;
CoordsXYZ blockLocation = location + CoordsXYZ{ CoordsXY{ block.x, block.y }.Rotate(direction), 0 };
CoordsXYZ blockLocation = location + CoordsXYZ{ CoordsXY{ block.x, block.y }.rotate(direction), 0 };
bool trackFound = false;
tileElement = MapGetFirstElementAt(blockLocation);
@@ -1500,16 +1500,16 @@ namespace OpenRCT2
sfl::static_vector<TileCoordsXYZD, kMaxStationLocations> locations;
for (auto& station : stations)
{
if (!station.entrance.IsNull())
if (!station.entrance.isNull())
{
locations.push_back(station.entrance);
station.entrance.SetNull();
station.entrance.setNull();
}
if (!station.exit.IsNull())
if (!station.exit.isNull())
{
locations.push_back(station.exit);
station.exit.SetNull();
station.exit.setNull();
}
}
@@ -1537,7 +1537,7 @@ namespace OpenRCT2
continue;
}
// if it's not a duplicate location
CoordsXY location = locationCoords.ToCoordsXY();
CoordsXY location = locationCoords.toCoordsXY();
TileElement* tileElement = MapGetFirstElementAt(location);
if (tileElement == nullptr)
@@ -1600,7 +1600,7 @@ namespace OpenRCT2
if (tileElement->asEntrance()->getEntranceType() == EntranceType::rideExit)
{
// if the location is already set for this station, big problem!
if (!station.exit.IsNull())
if (!station.exit.isNull())
break;
// set the station's exit location to this one
CoordsXYZD loc = { location, station.getBaseZ(), tileElement->getDirection() };
@@ -1609,7 +1609,7 @@ namespace OpenRCT2
else
{
// if the location is already set for this station, big problem!
if (!station.entrance.IsNull())
if (!station.entrance.isNull())
break;
// set the station's entrance location to this one
CoordsXYZD loc = { location, station.getBaseZ(), tileElement->getDirection() };
@@ -1693,15 +1693,15 @@ namespace OpenRCT2
for (auto& station : ride.getStations())
{
if (station.start.IsNull())
if (station.start.isNull())
{
continue;
}
if (station.entrance.IsNull())
if (station.entrance.isNull())
{
return { false, STR_ENTRANCE_NOT_YET_BUILT };
}
if (station.exit.IsNull())
if (station.exit.isNull())
{
return { false, STR_EXIT_NOT_YET_BUILT };
}
+4 -4
View File
@@ -395,7 +395,7 @@ namespace OpenRCT2
{
auto entranceIndex = tileElement->asTrack()->getStationIndex();
state.StationFlags &= ~RIDE_RATING_STATION_FLAG_NO_ENTRANCE;
if (ride->getStation(entranceIndex).entrance.IsNull())
if (ride->getStation(entranceIndex).entrance.isNull())
{
state.StationFlags |= RIDE_RATING_STATION_FLAG_NO_ENTRANCE;
}
@@ -543,10 +543,10 @@ namespace OpenRCT2
for (auto& station : ride->getStations())
{
if (!station.start.IsNull())
if (!station.start.isNull())
{
state.StationFlags &= ~RIDE_RATING_STATION_FLAG_NO_ENTRANCE;
if (station.entrance.IsNull())
if (station.entrance.isNull())
{
state.StationFlags |= RIDE_RATING_STATION_FLAG_NO_ENTRANCE;
}
@@ -1763,7 +1763,7 @@ namespace OpenRCT2
const auto& rtd = ride.getRideTypeDescriptor();
if (rtd.specialType == RtdSpecialType::maze)
{
location = ride.getStation().entrance.ToCoordsXY();
location = ride.getStation().entrance.toCoordsXY();
}
else
{
+4 -4
View File
@@ -34,7 +34,7 @@ namespace OpenRCT2
*/
void RideUpdateStation(Ride& ride, StationIndex stationIndex)
{
if (ride.getStation(stationIndex).start.IsNull())
if (ride.getStation(stationIndex).start.isNull())
return;
switch (ride.mode)
@@ -381,7 +381,7 @@ namespace OpenRCT2
{
for (const auto& station : ride.getStations())
{
if (!station.exit.IsNull())
if (!station.exit.isNull())
{
return ride.getStationIndex(&station);
}
@@ -393,7 +393,7 @@ namespace OpenRCT2
{
for (const auto& station : ride.getStations())
{
if (!station.start.IsNull())
if (!station.start.isNull())
{
return ride.getStationIndex(&station);
}
@@ -405,7 +405,7 @@ namespace OpenRCT2
{
for (const auto& station : ride.getStations())
{
if (station.start.IsNull())
if (station.start.isNull())
{
return ride.getStationIndex(&station);
}
+2 -2
View File
@@ -78,7 +78,7 @@ static void ride_remove_station(Ride& ride, const CoordsXYZ& location)
auto stationStart = station.getStart();
if (stationStart == location)
{
station.start.SetNull();
station.start.setNull();
ride.numStations--;
break;
}
@@ -444,7 +444,7 @@ std::optional<CoordsXYZD> GetTrackSegmentOrigin(const CoordsXYE& posEl)
const auto& trackBlock = ted.sequenceData.sequences[sequenceIndex].clearance;
CoordsXY trackBlockOffset = { trackBlock.x, trackBlock.y };
coords += trackBlockOffset.Rotate(DirectionReverse(direction));
coords += trackBlockOffset.rotate(DirectionReverse(direction));
coords.z -= trackBlock.z;
return CoordsXYZD(coords, direction);
+16 -16
View File
@@ -282,12 +282,12 @@ ResultWithMessage TrackDesign::CreateTrackDesignTrack(TrackDesignState& tds, con
location = station.exit;
}
if (location.IsNull())
if (location.isNull())
{
continue;
}
CoordsXY mapLocation = location.ToCoordsXY();
CoordsXY mapLocation = location.toCoordsXY();
TileElement* tileElement = MapGetFirstElementAt(mapLocation);
if (tileElement == nullptr)
@@ -309,7 +309,7 @@ ResultWithMessage TrackDesign::CreateTrackDesignTrack(TrackDesignState& tds, con
mapLocation -= tds.origin;
// Rotate entrance coordinates backwards to the correct direction
auto rotatedMapLocation = TileCoordsXY(mapLocation.Rotate(0 - _saveDirection));
auto rotatedMapLocation = TileCoordsXY(mapLocation.rotate(0 - _saveDirection));
z -= tds.origin.z;
z /= kCoordsZStep;
@@ -391,12 +391,12 @@ ResultWithMessage TrackDesign::CreateTrackDesignMaze(TrackDesignState& tds, cons
}
auto location = ride.getStation().entrance;
if (location.IsNull())
if (location.isNull())
{
return { false, STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY };
}
CoordsXY entranceLoc = location.ToCoordsXY();
CoordsXY entranceLoc = location.toCoordsXY();
auto tileElement = MapGetFirstElementAt(entranceLoc);
do
{
@@ -418,12 +418,12 @@ ResultWithMessage TrackDesign::CreateTrackDesignMaze(TrackDesignState& tds, cons
entranceElements.push_back(mazeEntrance);
location = ride.getStation().exit;
if (location.IsNull())
if (location.isNull())
{
return { false, STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY };
}
CoordsXY exitLoc = location.ToCoordsXY();
CoordsXY exitLoc = location.toCoordsXY();
tileElement = MapGetFirstElementAt(exitLoc);
if (tileElement == nullptr)
return { false, STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY };
@@ -524,7 +524,7 @@ ResultWithMessage TrackDesign::CreateTrackDesignScenery(TrackDesignState& tds)
}
const auto relativeMapPosition = scenery.loc - tds.origin;
const CoordsXY rotatedRelativeMapPos = relativeMapPosition.Rotate(0 - _saveDirection);
const CoordsXY rotatedRelativeMapPos = relativeMapPosition.rotate(0 - _saveDirection);
if (rotatedRelativeMapPos.x > 127 * kCoordsXYStep || rotatedRelativeMapPos.y > 127 * kCoordsXYStep
|| rotatedRelativeMapPos.x < -126 * kCoordsXYStep || rotatedRelativeMapPos.y < -126 * kCoordsXYStep)
@@ -1307,7 +1307,7 @@ static GameActions::Result TrackDesignPlaceAllScenery(
for (const auto& scenery : sceneryList)
{
auto mapCoord = CoordsXYZ{ CoordsXY(origin) + scenery.loc.Rotate(rotation), origin.z };
auto mapCoord = CoordsXYZ{ CoordsXY(origin) + scenery.loc.rotate(rotation), origin.z };
TrackDesignUpdatePreviewBounds(tds, mapCoord);
auto placementRes = TrackDesignPlaceSceneryElement(tds, mapCoord, mode, scenery, rotation, origin.z);
@@ -1341,8 +1341,8 @@ static std::optional<GameActions::Result> TrackDesignPlaceEntrances(
for (const auto& entrance : td.entranceElements)
{
auto rotation = _currentTrackPieceDirection & 3;
CoordsXY entranceMapPos = entrance.location.ToCoordsXY();
auto rotatedEntranceMapPos = entranceMapPos.Rotate(rotation);
CoordsXY entranceMapPos = entrance.location.toCoordsXY();
auto rotatedEntranceMapPos = entranceMapPos.rotate(rotation);
newCoords = { rotatedEntranceMapPos + tds.origin, newCoords.z };
TrackDesignUpdatePreviewBounds(tds, newCoords);
@@ -1462,8 +1462,8 @@ static GameActions::Result TrackDesignPlaceMaze(
for (const auto& maze_element : td.mazeElements)
{
uint8_t rotation = _currentTrackPieceDirection & 3;
CoordsXY mazeMapPos = maze_element.location.ToCoordsXY();
auto mapCoord = mazeMapPos.Rotate(rotation);
CoordsXY mazeMapPos = maze_element.location.toCoordsXY();
auto mapCoord = mazeMapPos.rotate(rotation);
mapCoord += origin;
TrackDesignUpdatePreviewBounds(tds, { mapCoord, origin.z });
@@ -1603,7 +1603,7 @@ static GameActions::Result TrackDesignPlaceRide(
for (uint8_t i = 0; i < ted.sequenceData.numSequences; i++)
{
const auto& trackBlock = ted.sequenceData.sequences[i].clearance;
auto tile = CoordsXY{ newCoords } + CoordsXY{ trackBlock.x, trackBlock.y }.Rotate(rotation);
auto tile = CoordsXY{ newCoords } + CoordsXY{ trackBlock.x, trackBlock.y }.rotate(rotation);
TrackDesignUpdatePreviewBounds(tds, { tile, newCoords.z });
TrackDesignAddSelectedTile(tile);
}
@@ -1678,7 +1678,7 @@ static GameActions::Result TrackDesignPlaceRide(
for (uint8_t i = 0; i < ted.sequenceData.numSequences; i++)
{
const auto& trackBlock = ted.sequenceData.sequences[i].clearance;
auto tile = CoordsXY{ newCoords } + CoordsXY{ trackBlock.x, trackBlock.y }.Rotate(rotation);
auto tile = CoordsXY{ newCoords } + CoordsXY{ trackBlock.x, trackBlock.y }.rotate(rotation);
if (!MapIsLocationValid(tile))
{
continue;
@@ -1719,7 +1719,7 @@ static GameActions::Result TrackDesignPlaceRide(
const TrackCoordinates& track_coordinates = ted.coordinates;
auto offsetAndRotatedTrack = CoordsXY{ newCoords }
+ CoordsXY{ track_coordinates.x, track_coordinates.y }.Rotate(rotation);
+ CoordsXY{ track_coordinates.x, track_coordinates.y }.rotate(rotation);
newCoords = { offsetAndRotatedTrack, newCoords.z - track_coordinates.zBegin + track_coordinates.zEnd };
rotation = (rotation + track_coordinates.rotationEnd - track_coordinates.rotationBegin) & 3;
+3 -3
View File
@@ -270,7 +270,7 @@ static TrackDesignAddStatus TrackDesignSaveAddLargeScenery(const CoordsXY& loc,
for (auto& tile : sceneryTiles)
{
CoordsXY offsetPos{ tile.offset };
auto rotatedOffsetPos = offsetPos.Rotate(direction);
auto rotatedOffsetPos = offsetPos.rotate(direction);
CoordsXYZ tileLoc = { sceneryOrigin->x + rotatedOffsetPos.x, sceneryOrigin->y + rotatedOffsetPos.y,
sceneryOrigin->z + tile.offset.z };
@@ -484,7 +484,7 @@ static void TrackDesignSaveRemoveLargeScenery(const CoordsXY& loc, LargeSceneryE
for (auto& tile : sceneryTiles)
{
CoordsXY offsetPos{ tile.offset };
auto rotatedOffsetPos = offsetPos.Rotate(direction);
auto rotatedOffsetPos = offsetPos.rotate(direction);
CoordsXYZ tileLoc = { sceneryOrigin->x + rotatedOffsetPos.x, sceneryOrigin->y + rotatedOffsetPos.y,
sceneryOrigin->z + tile.offset.z };
@@ -616,7 +616,7 @@ static void TrackDesignSaveShouldSelectNearbySceneryForTile(RideId rideIndex, in
{
if (!TrackDesignSaveContainsTileElement(tileElement))
{
TrackDesignSaveAddTileElement(TileCoordsXY(x, y).ToCoordsXY(), tileElement);
TrackDesignSaveAddTileElement(TileCoordsXY(x, y).toCoordsXY(), tileElement);
}
}
} while (!(tileElement++)->isLastForTile());
+4 -4
View File
@@ -289,8 +289,8 @@ namespace OpenRCT2
CoordsXY coords = { x, y };
CoordsXY trackCoordOffset = { trackCoordinate.x, trackCoordinate.y };
CoordsXY trackBlockOffset = { trackBlock.x, trackBlock.y };
coords += trackCoordOffset.Rotate(rotation);
coords += trackBlockOffset.Rotate(DirectionReverse(rotation));
coords += trackCoordOffset.rotate(rotation);
coords += trackBlockOffset.rotate(DirectionReverse(rotation));
OriginZ -= trackBlock.z;
OriginZ += trackCoordinate.zEnd;
@@ -371,7 +371,7 @@ namespace OpenRCT2
CoordsXY coords = { outTrackBeginEnd->begin_x, outTrackBeginEnd->begin_y };
CoordsXY offsets = { nextTrackCoordinate.x, nextTrackCoordinate.y };
coords += offsets.Rotate(DirectionReverse(nextRotation));
coords += offsets.rotate(DirectionReverse(nextRotation));
outTrackBeginEnd->begin_x = coords.x;
outTrackBeginEnd->begin_y = coords.y;
@@ -428,7 +428,7 @@ namespace OpenRCT2
uint8_t rotation = trackElement->getDirection();
CoordsXY coords = CoordsXY{ trackPos };
CoordsXY offsets = { trackBlock.x, trackBlock.y };
coords += offsets.Rotate(DirectionReverse(rotation));
coords += offsets.rotate(DirectionReverse(rotation));
z -= trackBlock.z;
z += trackCoordinate.zBegin;
+9 -9
View File
@@ -27,7 +27,7 @@ void Vehicle::UpdateTravellingBoatHireSetup()
var_34 = orientation;
TrackLocation.x = x;
TrackLocation.y = y;
TrackLocation = TrackLocation.ToTileStart();
TrackLocation = TrackLocation.toTileStart();
CoordsXY location = CoordsXY(TrackLocation) + CoordsDirectionDelta[orientation >> 3];
@@ -88,7 +88,7 @@ void Vehicle::TryReconnectBoatToTrack(const CoordsXY& currentBoatLocation, const
SetTrackType(trackElement->getTrackType());
SetTrackDirection(curRide->boatHireReturnDirection);
BoatLocation.SetNull();
BoatLocation.setNull();
}
track_progress = 0;
@@ -132,7 +132,7 @@ void Vehicle::UpdateMotionBoatHire()
{
// Loc6DA7A5
var_35++;
auto loc = BoatLocation.ToTileCentre();
auto loc = BoatLocation.toTileCentre();
CoordsXY loc2 = loc;
uint8_t bl;
@@ -249,7 +249,7 @@ void Vehicle::UpdateMotionBoatHire()
break;
}
auto flooredLocation = loc2.ToTileStart();
auto flooredLocation = loc2.toTileStart();
if (flooredLocation != TrackLocation)
{
if (!vehicle_boat_is_location_accessible({ loc2, TrackLocation.z }))
@@ -398,10 +398,10 @@ void Vehicle::UpdateBoatLocation()
CoordsXY location = CoordsXY{ x, y } + CoordsDirectionDelta[returnDirection];
if (location.ToTileStart() == returnPosition.ToCoordsXY())
if (location.toTileStart() == returnPosition.toCoordsXY())
{
sub_state = BoatHireSubState::enteringReturnPosition;
BoatLocation = location.ToTileStart();
BoatLocation = location.toTileStart();
return;
}
@@ -413,7 +413,7 @@ void Vehicle::UpdateBoatLocation()
{
if (ScenarioRand() & 1)
{
CoordsXY destLocation = (returnPosition.ToCoordsXY() - CoordsDirectionDelta[returnDirection]).ToTileCentre();
CoordsXY destLocation = (returnPosition.toCoordsXY() - CoordsDirectionDelta[returnDirection]).toTileCentre();
destLocation.x -= x;
destLocation.y -= y;
@@ -445,13 +445,13 @@ void Vehicle::UpdateBoatLocation()
continue;
}
BoatLocation = trackLocation.ToTileStart();
BoatLocation = trackLocation.toTileStart();
return;
}
CoordsXY trackLocation = TrackLocation;
trackLocation += CoordsDirectionDelta[curDirection & 3];
BoatLocation = trackLocation.ToTileStart();
BoatLocation = trackLocation.toTileStart();
}
/**
+2 -2
View File
@@ -118,7 +118,7 @@ void Vehicle::UpdateSceneryDoor() const
const auto& ted = GetTrackElementDescriptor(trackType);
const auto& trackBlock = ted.sequenceData.sequences[ted.sequenceData.numSequences - 1].clearance;
const TrackCoordinates* trackCoordinates = &ted.coordinates;
auto wallCoords = CoordsXYZ{ x, y, TrackLocation.z - trackBlock.z + trackCoordinates->zEnd }.ToTileStart();
auto wallCoords = CoordsXYZ{ x, y, TrackLocation.z - trackBlock.z + trackCoordinates->zEnd }.toTileStart();
int32_t direction = (GetTrackDirection() + trackCoordinates->rotationEnd) & 3;
AnimateSceneryDoor<false>({ wallCoords, static_cast<Direction>(direction) }, TrackLocation, next_vehicle_on_train.IsNull());
@@ -172,7 +172,7 @@ void Vehicle::UpdateLandscapeDoors(const int32_t previousTrackHeight) const
return;
}
const CoordsXYZ previousTrackLocation = CoordsXYZ(x, y, previousTrackHeight).ToTileStart();
const CoordsXYZ previousTrackLocation = CoordsXYZ(x, y, previousTrackHeight).toTileStart();
auto* const previousTrackElement = MapGetTrackElementAtBeforeSurfaceFromRide(previousTrackLocation, ride);
auto* const currentTrackElement = MapGetTrackElementAtBeforeSurfaceFromRide(TrackLocation, ride);
if (previousTrackElement != nullptr && currentTrackElement == nullptr)
+4 -4
View File
@@ -526,7 +526,7 @@ void Vehicle::UpdateWaitingForPassengers()
return;
auto& station = curRide->getStation(current_station);
if (station.entrance.IsNull())
if (station.entrance.isNull())
{
station.trainAtStation = RideStation::kNoTrain;
sub_state = 2;
@@ -720,7 +720,7 @@ void Vehicle::UpdateWaitingToDepart()
}
else
{
if (!currentStation.exit.IsNull())
if (!currentStation.exit.isNull())
{
SetState(Status::unloadingPassengers);
return;
@@ -734,7 +734,7 @@ void Vehicle::UpdateWaitingToDepart()
{
if (trainCar->num_peeps != 0)
{
if (!currentStation.exit.IsNull())
if (!currentStation.exit.isNull())
{
SetState(Status::unloadingPassengers);
return;
@@ -950,7 +950,7 @@ void Vehicle::UpdateUnloadingPassengers()
}
else
{
if (currentStation.exit.IsNull())
if (currentStation.exit.isNull())
{
if (sub_state != 1)
return;
+4 -4
View File
@@ -457,7 +457,7 @@ namespace OpenRCT2
return;
const auto& currentStation = curRide->getStation(curRide->currentTestStation);
if (!currentStation.entrance.IsNull())
if (!currentStation.entrance.isNull())
{
uint8_t test_segment = curRide->currentTestSegment;
StationIndex stationIndex = StationIndex::FromUnderlying(test_segment);
@@ -517,7 +517,7 @@ namespace OpenRCT2
{
curRide->curTestTrackLocation = curTrackLoc;
if (currentStation.entrance.IsNull())
if (currentStation.entrance.isNull())
return;
auto trackElemType = GetTrackType();
@@ -705,7 +705,7 @@ namespace OpenRCT2
}
}
if (currentStation.entrance.IsNull())
if (currentStation.entrance.isNull())
return;
if (x == kLocationNull)
@@ -971,7 +971,7 @@ namespace OpenRCT2
ride.previousVerticalG = MakeFixed16_2dp(1, 0);
ride.previousLateralG = 0;
ride.testingFlags.clearAll();
ride.curTestTrackLocation.SetNull();
ride.curTestTrackLocation.setNull();
ride.turnCountDefault = 0;
ride.turnCountBanked = 0;
ride.turnCountSloped = 0;
+1 -1
View File
@@ -318,7 +318,7 @@ void EditorScene::FinaliseMainView()
void EditorScene::resetMainViewport()
{
auto* mainWindow = WindowGetMain();
mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.ToCoordsXYZ());
mainWindow->setViewportLocation(TileCoordsXYZ{ 75, 75, 14 }.toCoordsXYZ());
}
/**
@@ -22,7 +22,7 @@ namespace OpenRCT2::Title
WindowBase* w = WindowGetMain();
if (w != nullptr)
{
auto loc = TileCoordsXY(Location.X, Location.Y).ToCoordsXY().ToTileCentre();
auto loc = TileCoordsXY(Location.X, Location.Y).toCoordsXY().toTileCentre();
int32_t z = TileElementHeight(loc);
// Prevent scroll adjustment due to window placement when in-game
+1 -1
View File
@@ -1502,7 +1502,7 @@ JSValue ScriptEngine::GameActionResultToJS(
{
JS_SetPropertyStr(ctx, obj, "cost", JS_NewInt64(ctx, result.cost));
}
if (!result.position.IsNull())
if (!result.position.isNull())
{
JS_SetPropertyStr(ctx, obj, "position", ToJSValue(ctx, result.position));
}
+9 -9
View File
@@ -363,7 +363,7 @@ namespace OpenRCT2::Scripting
return output;
}
inline CoordsXY JSToCoordsXY(JSContext* ctx, JSValue obj)
inline CoordsXY JStoCoordsXY(JSContext* ctx, JSValue obj)
{
return { AsOrDefault(ctx, obj, "x", 0), AsOrDefault(ctx, obj, "y", 0) };
}
@@ -371,12 +371,12 @@ namespace OpenRCT2::Scripting
inline CoordsXY JSToCoordXY(JSContext* ctx, JSValue obj, const char* property)
{
JSValue val = JS_GetPropertyStr(ctx, obj, property);
CoordsXY output = JSToCoordsXY(ctx, val);
CoordsXY output = JStoCoordsXY(ctx, val);
JS_FreeValue(ctx, val);
return output;
}
inline CoordsXYZ JSToCoordsXYZ(JSContext* ctx, JSValue obj)
inline CoordsXYZ JStoCoordsXYZ(JSContext* ctx, JSValue obj)
{
CoordsXYZ result;
if (JS_IsObject(obj))
@@ -387,21 +387,21 @@ namespace OpenRCT2::Scripting
}
else
{
result.SetNull();
result.setNull();
}
return result;
}
inline CoordsXYZD JSToCoordsXYZD(JSContext* ctx, JSValue obj)
inline CoordsXYZD JStoCoordsXYZD(JSContext* ctx, JSValue obj)
{
CoordsXYZD result;
if (JS_IsObject(obj))
{
result = CoordsXYZD(JSToCoordsXYZ(ctx, obj), AsOrDefault(ctx, obj, "direction", 0));
result = CoordsXYZD(JStoCoordsXYZ(ctx, obj), AsOrDefault(ctx, obj, "direction", 0));
}
else
{
result.SetNull();
result.setNull();
}
return result;
}
@@ -445,7 +445,7 @@ namespace OpenRCT2::Scripting
inline JSValue ToJSValue(JSContext* ctx, const CoordsXYZ& value)
{
if (value.IsNull())
if (value.isNull())
{
return JS_NULL;
}
@@ -459,7 +459,7 @@ namespace OpenRCT2::Scripting
inline JSValue ToJSValue(JSContext* ctx, const CoordsXYZD& value)
{
if (value.IsNull())
if (value.isNull())
{
return JS_NULL;
}
@@ -123,7 +123,7 @@ namespace OpenRCT2::Scripting
auto entity = GetCrashedVehicleParticle(thisVal);
if (entity != nullptr)
{
auto velocity = JSToCoordsXYZ(ctx, obj);
auto velocity = JStoCoordsXYZ(ctx, obj);
entity->velocityX = velocity.x;
entity->velocityY = velocity.y;
entity->velocityZ = velocity.z;
@@ -147,7 +147,7 @@ namespace OpenRCT2::Scripting
auto entity = GetCrashedVehicleParticle(thisVal);
if (entity != nullptr)
{
auto acceleration = JSToCoordsXYZ(ctx, obj);
auto acceleration = JStoCoordsXYZ(ctx, obj);
entity->accelerationX = acceleration.x;
entity->accelerationY = acceleration.y;
entity->accelerationZ = acceleration.z;
@@ -191,14 +191,14 @@ namespace OpenRCT2::Scripting
}
if (JS_IsObject(acceleration))
{
auto accelerationXYZ = JSToCoordsXYZ(ctx, acceleration);
auto accelerationXYZ = JStoCoordsXYZ(ctx, acceleration);
entity->accelerationX = accelerationXYZ.x;
entity->accelerationY = accelerationXYZ.y;
entity->accelerationZ = accelerationXYZ.z;
}
if (JS_IsObject(velocity))
{
auto velocityXYZ = JSToCoordsXYZ(ctx, velocity);
auto velocityXYZ = JStoCoordsXYZ(ctx, velocity);
entity->velocityX = velocityXYZ.x;
entity->velocityY = velocityXYZ.y;
entity->velocityZ = velocityXYZ.z;
@@ -130,7 +130,7 @@ namespace OpenRCT2::Scripting
auto peep = GetPeep(thisVal);
if (peep != nullptr)
{
auto pos = JSToCoordsXY(ctx, value);
auto pos = JStoCoordsXY(ctx, value);
peep->setDestination(pos);
peep->invalidate();
}
Loaded 100 of 122 files, more files were not shown because too many files have changed in this diff. Show more