From 7dd8989e706b01b76a7925104b66d02d43450425 Mon Sep 17 00:00:00 2001 From: Duncan Date: Wed, 12 Oct 2022 06:35:20 +0100 Subject: [PATCH] Next chunk of World/Map.h snakes (#18296) * Next chunk of World/Map.h snakes * Apply clang-format --- .../interface/ViewportInteraction.cpp | 4 +- src/openrct2-ui/scripting/ScTileSelection.hpp | 8 +- src/openrct2-ui/scripting/ScViewport.hpp | 2 +- src/openrct2-ui/windows/Footpath.cpp | 18 ++-- src/openrct2-ui/windows/Guest.cpp | 4 +- src/openrct2-ui/windows/LandRights.cpp | 4 +- src/openrct2-ui/windows/Map.cpp | 26 +++--- src/openrct2-ui/windows/MazeConstruction.cpp | 4 +- src/openrct2-ui/windows/PatrolArea.cpp | 4 +- src/openrct2-ui/windows/RideConstruction.cpp | 34 ++++---- src/openrct2-ui/windows/Staff.cpp | 4 +- src/openrct2-ui/windows/TileInspector.cpp | 4 +- src/openrct2-ui/windows/TopToolbar.cpp | 34 ++++---- src/openrct2-ui/windows/TrackDesignPlace.cpp | 6 +- src/openrct2-ui/windows/ViewClipping.cpp | 4 +- src/openrct2-ui/windows/Viewport.cpp | 2 +- src/openrct2/Editor.cpp | 2 +- src/openrct2/GameState.cpp | 6 +- src/openrct2/actions/BannerPlaceAction.cpp | 2 +- src/openrct2/actions/BannerRemoveAction.cpp | 2 +- .../actions/BannerSetColourAction.cpp | 2 +- src/openrct2/actions/BannerSetStyleAction.cpp | 4 +- src/openrct2/actions/ClearAction.cpp | 4 +- .../actions/FootpathAdditionPlaceAction.cpp | 2 +- .../actions/FootpathAdditionRemoveAction.cpp | 2 +- src/openrct2/actions/FootpathPlaceAction.cpp | 8 +- .../actions/FootpathPlaceFromTrackAction.cpp | 8 +- src/openrct2/actions/FootpathRemoveAction.cpp | 4 +- src/openrct2/actions/GameAction.cpp | 2 +- src/openrct2/actions/LandBuyRightsAction.cpp | 2 +- src/openrct2/actions/LandLowerAction.cpp | 8 +- src/openrct2/actions/LandRaiseAction.cpp | 8 +- src/openrct2/actions/LandSetHeightAction.cpp | 6 +- src/openrct2/actions/LandSetRightsAction.cpp | 2 +- src/openrct2/actions/LandSmoothAction.cpp | 6 +- .../actions/LargeSceneryPlaceAction.cpp | 10 +-- .../actions/LargeSceneryRemoveAction.cpp | 10 +-- .../actions/LargeScenerySetColourAction.cpp | 4 +- src/openrct2/actions/MazePlaceTrackAction.cpp | 2 +- src/openrct2/actions/MazeSetTrackAction.cpp | 4 +- .../actions/ParkEntranceRemoveAction.cpp | 2 +- .../actions/PlaceParkEntranceAction.cpp | 2 +- src/openrct2/actions/PlacePeepSpawnAction.cpp | 2 +- src/openrct2/actions/RideDemolishAction.cpp | 6 +- .../actions/RideEntranceExitPlaceAction.cpp | 6 +- .../actions/RideEntranceExitRemoveAction.cpp | 4 +- .../actions/RideSetAppearanceAction.cpp | 2 +- src/openrct2/actions/RideSetNameAction.cpp | 2 +- src/openrct2/actions/RideSetPriceAction.cpp | 2 +- src/openrct2/actions/RideSetSettingAction.cpp | 2 +- src/openrct2/actions/RideSetStatusAction.cpp | 2 +- src/openrct2/actions/RideSetVehicleAction.cpp | 2 +- .../actions/SmallSceneryPlaceAction.cpp | 18 ++-- .../actions/SmallSceneryRemoveAction.cpp | 6 +- .../actions/SmallScenerySetColourAction.cpp | 4 +- src/openrct2/actions/StaffHireNewAction.cpp | 4 +- .../actions/SurfaceSetStyleAction.cpp | 10 +-- src/openrct2/actions/TileModifyAction.cpp | 2 +- src/openrct2/actions/TrackPlaceAction.cpp | 2 +- src/openrct2/actions/TrackRemoveAction.cpp | 2 +- src/openrct2/actions/WallPlaceAction.cpp | 8 +- src/openrct2/actions/WallRemoveAction.cpp | 6 +- src/openrct2/actions/WallSetColourAction.cpp | 6 +- src/openrct2/actions/WaterLowerAction.cpp | 8 +- src/openrct2/actions/WaterRaiseAction.cpp | 8 +- src/openrct2/actions/WaterSetHeightAction.cpp | 4 +- src/openrct2/cmdline/BenchSpriteSort.cpp | 2 +- src/openrct2/entity/Duck.cpp | 10 +-- src/openrct2/entity/EntityRegistry.cpp | 2 +- src/openrct2/entity/Guest.cpp | 16 ++-- src/openrct2/entity/Litter.cpp | 2 +- src/openrct2/entity/MoneyEffect.cpp | 2 +- src/openrct2/entity/Particle.cpp | 4 +- src/openrct2/entity/Peep.cpp | 16 ++-- src/openrct2/entity/Staff.cpp | 22 ++--- src/openrct2/interface/InteractiveConsole.cpp | 2 +- src/openrct2/interface/Screenshot.cpp | 4 +- src/openrct2/interface/Viewport.cpp | 10 +-- src/openrct2/interface/Window.cpp | 12 +-- src/openrct2/management/NewsItem.cpp | 4 +- src/openrct2/paint/Paint.Entity.cpp | 2 +- src/openrct2/paint/VirtualFloor.cpp | 2 +- .../paint/tile_element/Paint.Surface.cpp | 8 +- .../paint/tile_element/Paint.TileElement.cpp | 2 +- src/openrct2/peep/GuestPathfinding.cpp | 10 +-- src/openrct2/rct1/S4Importer.cpp | 4 +- src/openrct2/ride/Ride.cpp | 12 +-- src/openrct2/ride/RideConstruction.cpp | 4 +- src/openrct2/ride/RideRatings.cpp | 4 +- src/openrct2/ride/TrackDesign.cpp | 12 +-- src/openrct2/ride/Vehicle.cpp | 16 ++-- src/openrct2/scenario/Scenario.cpp | 14 +-- .../scripting/bindings/world/ScTile.cpp | 6 +- src/openrct2/title/Command/SetLocation.cpp | 2 +- src/openrct2/world/ConstructionClearance.cpp | 4 +- src/openrct2/world/Entrance.cpp | 2 +- src/openrct2/world/Footpath.cpp | 10 +-- src/openrct2/world/Map.cpp | 86 +++++++++---------- src/openrct2/world/Map.h | 56 ++++++------ src/openrct2/world/MapGen.cpp | 2 +- src/openrct2/world/Park.cpp | 10 +-- src/openrct2/world/Surface.cpp | 2 +- src/openrct2/world/TileElementBase.cpp | 2 +- src/openrct2/world/TileInspector.cpp | 5 +- src/openrct2/world/Wall.cpp | 7 +- test/tests/TileElements.cpp | 5 +- 106 files changed, 394 insertions(+), 397 deletions(-) diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 8fdd2296e9..cb8bee03e3 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -356,7 +356,7 @@ InteractionInfo ViewportInteractionGetItemRight(const ScreenCoordsXY& screenCoor else { // FIXME: Why does it *2 the value? - if (!gCheatsSandboxMode && !map_is_location_owned({ info.Loc, tileElement->GetBaseZ() * 2 })) + if (!gCheatsSandboxMode && !MapIsLocationOwned({ info.Loc, tileElement->GetBaseZ() * 2 })) { info.SpriteType = ViewportInteractionItem::None; return info; @@ -793,7 +793,7 @@ CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoo int16_t z = waterHeight; if (info.SpriteType != ViewportInteractionItem::Water) { - z = tile_element_height(mapPos); + z = TileElementHeight(mapPos); } mapPos = viewport_coord_to_map_coord(initialVPPos, z); mapPos.x = std::clamp(mapPos.x, initialPos.x, initialPos.x + 31); diff --git a/src/openrct2-ui/scripting/ScTileSelection.hpp b/src/openrct2-ui/scripting/ScTileSelection.hpp index 625d44c65b..526f7ca389 100644 --- a/src/openrct2-ui/scripting/ScTileSelection.hpp +++ b/src/openrct2-ui/scripting/ScTileSelection.hpp @@ -52,7 +52,7 @@ namespace OpenRCT2::Scripting void range_set(DukValue value) { - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); if (value.type() == DukValue::Type::OBJECT) { auto range = GetMapRange(value); @@ -70,7 +70,7 @@ namespace OpenRCT2::Scripting { gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; } - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); } DukValue tiles_get() const @@ -95,7 +95,7 @@ namespace OpenRCT2::Scripting void tiles_set(DukValue value) { - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectionTiles.clear(); if (value.is_array()) { @@ -125,7 +125,7 @@ namespace OpenRCT2::Scripting { gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; } - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); } static void Register(duk_context* ctx) diff --git a/src/openrct2-ui/scripting/ScViewport.hpp b/src/openrct2-ui/scripting/ScViewport.hpp index 8b9cba0759..88d4683fe2 100644 --- a/src/openrct2-ui/scripting/ScViewport.hpp +++ b/src/openrct2-ui/scripting/ScViewport.hpp @@ -294,7 +294,7 @@ namespace OpenRCT2::Scripting return CoordsXYZ(x, y, dukZ.as_int()); } - auto z = tile_element_height(CoordsXY(x, y)); + auto z = TileElementHeight(CoordsXY(x, y)); return CoordsXYZ(x, y, z); } } diff --git a/src/openrct2-ui/windows/Footpath.cpp b/src/openrct2-ui/windows/Footpath.cpp index 4bb3c8b880..abd421db17 100644 --- a/src/openrct2-ui/windows/Footpath.cpp +++ b/src/openrct2-ui/windows/Footpath.cpp @@ -182,7 +182,7 @@ public: { FootpathProvisionalUpdate(); viewport_set_visibility(0); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; window_invalidate_by_class(WindowClass::TopToolbar); hide_gridlines(); @@ -293,7 +293,7 @@ public: _windowFootpathCost = MONEY32_UNDEFINED; tool_cancel(); FootpathProvisionalUpdate(); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; _footpathConstructionMode = PATH_CONSTRUCTION_MODE_LAND; tool_set(*this, WIDX_CONSTRUCT_ON_LAND, Tool::PathDown); @@ -310,7 +310,7 @@ public: _windowFootpathCost = MONEY32_UNDEFINED; tool_cancel(); FootpathProvisionalUpdate(); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; _footpathConstructionMode = PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL_TOOL; tool_set(*this, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, Tool::Crosshair); @@ -765,7 +765,7 @@ private: */ void WindowFootpathSetProvisionalPathAtPoint(const ScreenCoordsXY& screenCoords) { - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; auto info = get_map_coordinates_from_pos( @@ -846,7 +846,7 @@ private: int32_t direction; TileElement* tileElement; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; @@ -878,7 +878,7 @@ private: gMapSelectArrowPosition = CoordsXYZ{ mapCoords, z }; gMapSelectArrowDirection = direction; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); } /** @@ -1115,7 +1115,7 @@ private: TileElement* tileElement; int32_t z, zLow; - if (!map_is_location_valid(gFootpathConstructFromPosition)) + if (!MapIsLocationValid(gFootpathConstructFromPosition)) { return nullptr; } @@ -1188,7 +1188,7 @@ private: { if (_footpathConstructionMode == PATH_CONSTRUCTION_MODE_BRIDGE_OR_TUNNEL) { - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags |= MAP_SELECT_FLAG_GREEN; @@ -1196,7 +1196,7 @@ private: gMapSelectionTiles.clear(); gMapSelectionTiles.push_back({ gFootpathConstructFromPosition.x + CoordsDirectionDelta[direction].x, gFootpathConstructFromPosition.y + CoordsDirectionDelta[direction].y }); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); } uint64_t pressedWidgets = pressed_widgets diff --git a/src/openrct2-ui/windows/Guest.cpp b/src/openrct2-ui/windows/Guest.cpp index ed3efe64b7..d450afef1c 100644 --- a/src/openrct2-ui/windows/Guest.cpp +++ b/src/openrct2-ui/windows/Guest.cpp @@ -913,7 +913,7 @@ private: if (widgetIndex != WIDX_PICKUP) return; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; @@ -924,7 +924,7 @@ private: gMapSelectType = MAP_SELECT_TYPE_FULL; gMapSelectPositionA = mapCoords; gMapSelectPositionB = mapCoords; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); } gPickupPeepImage = ImageId(); diff --git a/src/openrct2-ui/windows/LandRights.cpp b/src/openrct2-ui/windows/LandRights.cpp index a81d500ffa..65a57d9adb 100644 --- a/src/openrct2-ui/windows/LandRights.cpp +++ b/src/openrct2-ui/windows/LandRights.cpp @@ -236,7 +236,7 @@ public: void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; auto mapTile = screen_get_map_xy(screenCoords, nullptr); @@ -303,7 +303,7 @@ public: state_changed++; } - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); if (!state_changed) return; diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index d11dce0195..a3fe229560 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -427,7 +427,7 @@ public: void SetLandRightsToolUpdate(const ScreenCoordsXY& screenCoords) { - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; auto mapCoords = screen_get_map_xy(screenCoords, nullptr); if (!mapCoords.has_value()) @@ -447,7 +447,7 @@ public: gMapSelectPositionA = *mapCoords; gMapSelectPositionB.x = mapCoords->x + size; gMapSelectPositionB.y = mapCoords->y + size; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); } CoordsXYZD PlaceParkEntranceGetMapPosition(const ScreenCoordsXY& screenCoords) @@ -484,8 +484,8 @@ public: void PlaceParkEntranceToolUpdate(const ScreenCoordsXY& screenCoords) { - map_invalidate_selection_rect(); - map_invalidate_map_selection_tiles(); + MapInvalidateSelectionRect(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; @@ -508,7 +508,7 @@ public: gMapSelectArrowDirection = parkEntrancePosition.direction; gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT | MAP_SELECT_FLAG_ENABLE_ARROW; - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); if (gParkEntranceGhostExists && parkEntrancePosition == gParkEntranceGhostPosition) { return; @@ -547,7 +547,7 @@ public: { int32_t direction; TileElement* tileElement; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement); @@ -570,7 +570,7 @@ public: gMapSelectPositionB = mapCoords; gMapSelectArrowPosition = CoordsXYZ{ mapCoords, mapZ }; gMapSelectArrowDirection = DirectionReverse(direction); - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); } void SetPeepSpawnToolDown(const ScreenCoordsXY& screenCoords) @@ -648,7 +648,7 @@ public: { CoordsXY c = ScreenToMap(screenCoords); auto mapCoords = CoordsXY{ std::clamp(c.x, 0, MAXIMUM_MAP_SIZE_BIG - 1), std::clamp(c.y, 0, MAXIMUM_MAP_SIZE_BIG - 1) }; - auto mapZ = tile_element_height(mapCoords); + auto mapZ = TileElementHeight(mapCoords); rct_window* mainWindow = window_get_main(); if (mainWindow != nullptr) @@ -664,12 +664,12 @@ public: int32_t radius = (landToolSize * 16) - 16; mapCoords = (mapCoords - CoordsXY{ radius, radius }).ToTileStart(); - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; gMapSelectType = MAP_SELECT_TYPE_FULL; gMapSelectPositionA = mapCoords; gMapSelectPositionB = mapCoords + CoordsXY{ size, size }; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); auto surfaceSetStyleAction = SurfaceSetStyleAction( { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, @@ -684,12 +684,12 @@ public: int32_t radius = (landRightsToolSize * 16) - 16; mapCoords = (mapCoords - CoordsXY{ radius, radius }).ToTileStart(); - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; gMapSelectType = MAP_SELECT_TYPE_FULL; gMapSelectPositionA = mapCoords; gMapSelectPositionB = mapCoords + CoordsXY{ size, size }; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); auto landSetRightsAction = LandSetRightsAction( { gMapSelectPositionA.x, gMapSelectPositionA.y, gMapSelectPositionB.x, gMapSelectPositionB.y }, @@ -1037,7 +1037,7 @@ private: for (int32_t i = 0; i < MAXIMUM_MAP_SIZE_TECHNICAL; i++) { - if (!map_is_edge({ x, y })) + if (!MapIsEdge({ x, y })) { uint16_t colour = 0; switch (selected_tab) diff --git a/src/openrct2-ui/windows/MazeConstruction.cpp b/src/openrct2-ui/windows/MazeConstruction.cpp index 349060065e..44b93e67e8 100644 --- a/src/openrct2-ui/windows/MazeConstruction.cpp +++ b/src/openrct2-ui/windows/MazeConstruction.cpp @@ -104,7 +104,7 @@ public: ride_construction_invalidate_current_track(); viewport_set_visibility(0); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; @@ -333,7 +333,7 @@ private: { ride_construction_invalidate_current_track(); - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; diff --git a/src/openrct2-ui/windows/PatrolArea.cpp b/src/openrct2-ui/windows/PatrolArea.cpp index d6e5ebf549..ea1437ffea 100644 --- a/src/openrct2-ui/windows/PatrolArea.cpp +++ b/src/openrct2-ui/windows/PatrolArea.cpp @@ -176,14 +176,14 @@ public: if (stateChanged) { // Invalidate previous area - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); // Update and invalidate new area gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; gMapSelectType = MAP_SELECT_TYPE_FULL; gMapSelectPositionA = posA; gMapSelectPositionB = posB; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); } } diff --git a/src/openrct2-ui/windows/RideConstruction.cpp b/src/openrct2-ui/windows/RideConstruction.cpp index 9f88598f4e..80bf2ea36b 100644 --- a/src/openrct2-ui/windows/RideConstruction.cpp +++ b/src/openrct2-ui/windows/RideConstruction.cpp @@ -249,7 +249,7 @@ public: ride_construction_invalidate_current_track(); viewport_set_visibility(0); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; @@ -2138,7 +2138,7 @@ public: int32_t trackType, trackDirection; CoordsXYZ trackPos{}; - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags |= MAP_SELECT_FLAG_GREEN; @@ -2170,7 +2170,7 @@ public: if (get_ride(_currentRideIndex)) { SelectMapTiles(trackType, trackDirection, trackPos); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); } } @@ -2543,7 +2543,7 @@ private: void ToolDownEntranceExit(const ScreenCoordsXY& screenCoords) { ride_construction_invalidate_current_track(); - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; @@ -3206,7 +3206,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) int32_t z; const rct_preview_track* trackBlock; - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; @@ -3214,7 +3214,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) if (!mapCoords) { ride_construction_invalidate_current_track(); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); return; } @@ -3236,7 +3236,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) &trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, nullptr, nullptr)) { ride_construction_invalidate_current_track(); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); return; } _currentTrackPieceType = trackType; @@ -3268,7 +3268,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) int32_t highestZ = 0; for (const auto& selectedTile : gMapSelectionTiles) { - if (map_is_location_valid(selectedTile)) + if (MapIsLocationValid(selectedTile)) { z = map_get_highest_z(selectedTile); if (z > highestZ) @@ -3296,7 +3296,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) _currentTrackBegin.z = z; if ((_currentTrackSelectionFlags & TRACK_SELECTION_FLAG_TRACK) && _currentTrackBegin == _previousTrackPiece) { - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); return; } @@ -3325,7 +3325,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION); context_broadcast_intent(&intent); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); return; } @@ -3357,7 +3357,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) for (int8_t i = 0; i < NumOrthogonalDirections; i++) { const auto testLoc = CoordsXYZ{ *mapCoords + CoordsDirectionDelta[i], z }; - if (!map_is_location_owned(testLoc)) + if (!MapIsLocationOwned(testLoc)) { pathsByDir[i] = nullptr; continue; @@ -3416,7 +3416,7 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) } window_ride_construction_update_active_elements(); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); } /** @@ -3425,8 +3425,8 @@ void ride_construction_toolupdate_construct(const ScreenCoordsXY& screenCoords) */ void ride_construction_toolupdate_entrance_exit(const ScreenCoordsXY& screenCoords) { - map_invalidate_selection_rect(); - map_invalidate_map_selection_tiles(); + MapInvalidateSelectionRect(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; @@ -3443,7 +3443,7 @@ void ride_construction_toolupdate_entrance_exit(const ScreenCoordsXY& screenCoor gMapSelectPositionB = entranceOrExitCoords; gMapSelectArrowPosition = entranceOrExitCoords; gMapSelectArrowDirection = DirectionReverse(entranceOrExitCoords.direction); - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); entranceOrExitCoords.direction = DirectionReverse(gRideEntranceExitPlaceDirection); StationIndex stationNum = gRideEntranceExitPlaceStationIndex; @@ -3470,7 +3470,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) rct_window* w; - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); ride_construction_invalidate_current_track(); CoordsXYZ mapCoords{}; @@ -3488,7 +3488,7 @@ void ride_construction_tooldown_construct(const ScreenCoordsXY& screenCoords) { for (const auto& selectedTile : gMapSelectionTiles) { - if (!map_is_location_valid(selectedTile)) + if (!MapIsLocationValid(selectedTile)) continue; z = map_get_highest_z(selectedTile); diff --git a/src/openrct2-ui/windows/Staff.cpp b/src/openrct2-ui/windows/Staff.cpp index c153b05841..a2009fa98b 100644 --- a/src/openrct2-ui/windows/Staff.cpp +++ b/src/openrct2-ui/windows/Staff.cpp @@ -651,7 +651,7 @@ private: if (widgetIndex != WIDX_PICKUP) return; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; @@ -662,7 +662,7 @@ private: gMapSelectType = MAP_SELECT_TYPE_FULL; gMapSelectPositionA = mapCoords; gMapSelectPositionB = mapCoords; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); } gPickupPeepImage = ImageId(); diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index cba0dd1e23..d07a370223 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -923,7 +923,7 @@ public: void OnToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; CoordsXY mapCoords; @@ -953,7 +953,7 @@ public: gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectType = MAP_SELECT_TYPE_FULL; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); } void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override diff --git a/src/openrct2-ui/windows/TopToolbar.cpp b/src/openrct2-ui/windows/TopToolbar.cpp index b3e3593155..7d04f3f828 100644 --- a/src/openrct2-ui/windows/TopToolbar.cpp +++ b/src/openrct2-ui/windows/TopToolbar.cpp @@ -2012,7 +2012,7 @@ static uint8_t TopToolbarToolUpdateLandPaint(const ScreenCoordsXY& screenPos) { uint8_t state_changed = 0; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; auto mapTile = screen_get_map_xy(screenPos, nullptr); @@ -2074,7 +2074,7 @@ static uint8_t TopToolbarToolUpdateLandPaint(const ScreenCoordsXY& screenPos) state_changed++; } - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); return state_changed; } @@ -2105,7 +2105,7 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos) { const bool mapCtrlPressed = InputTestPlaceObjectModifier(PLACE_OBJECT_MODIFIER_COPY_Z); - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); if (gCurrentToolId == Tool::UpDownArrow) { @@ -2194,7 +2194,7 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos) state_changed++; } - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); if (!state_changed) return; @@ -2320,7 +2320,7 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos) state_changed++; } - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); if (!state_changed) return; @@ -2341,7 +2341,7 @@ static void TopToolbarToolUpdateLand(const ScreenCoordsXY& screenPos) */ static void TopToolbarToolUpdateWater(const ScreenCoordsXY& screenPos) { - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); if (gCurrentToolId == Tool::UpDownArrow) { @@ -2436,7 +2436,7 @@ static void TopToolbarToolUpdateWater(const ScreenCoordsXY& screenPos) state_changed++; } - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); if (!state_changed) return; @@ -2608,8 +2608,8 @@ static money64 TryPlaceGhostBanner(CoordsXYZD loc, ObjectEntryIndex entryIndex) */ static void TopToolbarToolUpdateScenery(const ScreenCoordsXY& screenPos) { - map_invalidate_selection_rect(); - map_invalidate_map_selection_tiles(); + MapInvalidateSelectionRect(); + MapInvalidateMapSelectionTiles(); if (gConfigGeneral.virtual_floor_style != VirtualFloorStyles::Off) { @@ -2679,7 +2679,7 @@ static void TopToolbarToolUpdateScenery(const ScreenCoordsXY& screenPos) gMapSelectType = MAP_SELECT_TYPE_QUARTER_0 + (quadrant ^ 2); } - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); // If no change in ghost placement if ((gSceneryGhostType & SCENERY_GHOST_FLAG_0) && mapTile == gSceneryGhostPosition && quadrant == _unkF64F0E @@ -2734,7 +2734,7 @@ static void TopToolbarToolUpdateScenery(const ScreenCoordsXY& screenPos) gMapSelectPositionB.y = mapTile.y; gMapSelectType = MAP_SELECT_TYPE_FULL; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); // If no change in ghost placement if ((gSceneryGhostType & SCENERY_GHOST_FLAG_1) && mapTile == gSceneryGhostPosition && z == gSceneryGhostPosition.z) @@ -2769,7 +2769,7 @@ static void TopToolbarToolUpdateScenery(const ScreenCoordsXY& screenPos) gMapSelectPositionB.y = mapTile.y; gMapSelectType = MAP_SELECT_TYPE_EDGE_0 + edge; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); // If no change in ghost placement if ((gSceneryGhostType & SCENERY_GHOST_FLAG_2) && mapTile == gSceneryGhostPosition @@ -2833,7 +2833,7 @@ static void TopToolbarToolUpdateScenery(const ScreenCoordsXY& screenPos) } gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); // If no change in ghost placement if ((gSceneryGhostType & SCENERY_GHOST_FLAG_3) && mapTile == gSceneryGhostPosition && gSceneryPlaceZ == _unkF64F0A @@ -2891,7 +2891,7 @@ static void TopToolbarToolUpdateScenery(const ScreenCoordsXY& screenPos) gMapSelectPositionB.y = mapTile.y; gMapSelectType = MAP_SELECT_TYPE_FULL; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); // If no change in ghost placement if ((gSceneryGhostType & SCENERY_GHOST_FLAG_4) && mapTile == gSceneryGhostPosition && z == gSceneryGhostPosition.z @@ -3235,17 +3235,17 @@ static void WindowTopToolbarToolUp(rct_window* w, WidgetIndex widgetIndex, const switch (widgetIndex) { case WIDX_LAND: - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gCurrentToolId = Tool::DigDown; break; case WIDX_WATER: - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gCurrentToolId = Tool::WaterDown; break; case WIDX_CLEAR_SCENERY: - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gCurrentToolId = Tool::Crosshair; break; diff --git a/src/openrct2-ui/windows/TrackDesignPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp index 19aaeb1d32..0b5f57acaf 100644 --- a/src/openrct2-ui/windows/TrackDesignPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -93,7 +93,7 @@ public: { ClearProvisional(); viewport_set_visibility(0); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; hide_gridlines(); @@ -146,7 +146,7 @@ public: TrackDesignState tds{}; int16_t mapZ; - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; @@ -209,7 +209,7 @@ public: void OnToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override { ClearProvisional(); - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags &= ~MAP_SELECT_FLAG_ENABLE_ARROW; diff --git a/src/openrct2-ui/windows/ViewClipping.cpp b/src/openrct2-ui/windows/ViewClipping.cpp index 725869e301..bb2fedda66 100644 --- a/src/openrct2-ui/windows/ViewClipping.cpp +++ b/src/openrct2-ui/windows/ViewClipping.cpp @@ -232,14 +232,14 @@ public: auto mapCoords = screen_pos_to_map_pos(screenCoords, &direction); if (mapCoords) { - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE; gMapSelectPositionA.x = std::min(_selectionStart.x, mapCoords->x); gMapSelectPositionB.x = std::max(_selectionStart.x, mapCoords->x); gMapSelectPositionA.y = std::min(_selectionStart.y, mapCoords->y); gMapSelectPositionB.y = std::max(_selectionStart.y, mapCoords->y); gMapSelectType = MAP_SELECT_TYPE_FULL; - map_invalidate_selection_rect(); + MapInvalidateSelectionRect(); } } diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index ebb68ee6e4..4c6af71b09 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -144,7 +144,7 @@ public: { auto info = get_map_coordinates_from_pos( { windowPos.x + (width / 2), windowPos.y + (height / 2) }, ViewportInteractionItemAll); - window_scroll_to_location(*mainWindow, { info.Loc, tile_element_height(info.Loc) }); + window_scroll_to_location(*mainWindow, { info.Loc, TileElementHeight(info.Loc) }); } break; } diff --git a/src/openrct2/Editor.cpp b/src/openrct2/Editor.cpp index f42b926022..3e4506036c 100644 --- a/src/openrct2/Editor.cpp +++ b/src/openrct2/Editor.cpp @@ -294,7 +294,7 @@ namespace Editor static void ClearMapForEditing(bool fromSave) { - map_remove_all_rides(); + MapRemoveAllRides(); UnlinkAllRideBanners(); ride_init_all(); diff --git a/src/openrct2/GameState.cpp b/src/openrct2/GameState.cpp index 7e0c79fffe..b347212b32 100644 --- a/src/openrct2/GameState.cpp +++ b/src/openrct2/GameState.cpp @@ -324,13 +324,13 @@ void GameState::UpdateLogic(LogicTimings* timings) map_update_tiles(); report_time(LogicTimePart::MapTiles); // Temporarily remove provisional paths to prevent peep from interacting with them - map_remove_provisional_elements(); + MapRemoveProvisionalElements(); report_time(LogicTimePart::MapStashProvisionalElements); - map_update_path_wide_flags(); + MapUpdatePathWideFlags(); report_time(LogicTimePart::MapPathWideFlags); peep_update_all(); report_time(LogicTimePart::Peep); - map_restore_provisional_elements(); + MapRestoreProvisionalElements(); report_time(LogicTimePart::MapRestoreProvisionalElements); vehicle_update_all(); report_time(LogicTimePart::Vehicle); diff --git a/src/openrct2/actions/BannerPlaceAction.cpp b/src/openrct2/actions/BannerPlaceAction.cpp index f70e3eaf1f..bf12c9545a 100644 --- a/src/openrct2/actions/BannerPlaceAction.cpp +++ b/src/openrct2/actions/BannerPlaceAction.cpp @@ -73,7 +73,7 @@ GameActions::Result BannerPlaceAction::Query() const GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_CAN_ONLY_BE_BUILT_ACROSS_PATHS); } - if (!map_can_build_at(_loc)) + if (!MapCanBuildAt(_loc)) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/BannerRemoveAction.cpp b/src/openrct2/actions/BannerRemoveAction.cpp index 42de2dc0cd..04708aee84 100644 --- a/src/openrct2/actions/BannerRemoveAction.cpp +++ b/src/openrct2/actions/BannerRemoveAction.cpp @@ -49,7 +49,7 @@ GameActions::Result BannerRemoveAction::Query() const res.Position.z = _loc.z; res.ErrorTitle = STR_CANT_REMOVE_THIS; - if (!LocationValid(_loc) || !map_can_build_at({ _loc.x, _loc.y, _loc.z - 16 })) + if (!LocationValid(_loc) || !MapCanBuildAt({ _loc.x, _loc.y, _loc.z - 16 })) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/BannerSetColourAction.cpp b/src/openrct2/actions/BannerSetColourAction.cpp index a6445a2bd4..cb834872f6 100644 --- a/src/openrct2/actions/BannerSetColourAction.cpp +++ b/src/openrct2/actions/BannerSetColourAction.cpp @@ -70,7 +70,7 @@ GameActions::Result BannerSetColourAction::QueryExecute(bool isExecuting) const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REPAINT_THIS, STR_NONE); } - if (!map_can_build_at({ _loc.x, _loc.y, _loc.z - 16 })) + if (!MapCanBuildAt({ _loc.x, _loc.y, _loc.z - 16 })) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/BannerSetStyleAction.cpp b/src/openrct2/actions/BannerSetStyleAction.cpp index a9e700df1e..b88823cbad 100644 --- a/src/openrct2/actions/BannerSetStyleAction.cpp +++ b/src/openrct2/actions/BannerSetStyleAction.cpp @@ -55,7 +55,7 @@ GameActions::Result BannerSetStyleAction::Query() const res.Expenditure = ExpenditureType::Landscaping; auto location = banner->position.ToCoordsXY().ToTileCentre(); - res.Position = { location, tile_element_height(location) }; + res.Position = { location, TileElementHeight(location) }; TileElement* tileElement = BannerGetTileElement(_bannerIndex); @@ -109,7 +109,7 @@ GameActions::Result BannerSetStyleAction::Execute() const res.Expenditure = ExpenditureType::Landscaping; auto location = banner->position.ToCoordsXY().ToTileCentre(); - res.Position = { location, tile_element_height(location) }; + res.Position = { location, TileElementHeight(location) }; TileElement* tileElement = BannerGetTileElement(_bannerIndex); diff --git a/src/openrct2/actions/ClearAction.cpp b/src/openrct2/actions/ClearAction.cpp index 047e9808cf..07512a7eff 100644 --- a/src/openrct2/actions/ClearAction.cpp +++ b/src/openrct2/actions/ClearAction.cpp @@ -55,7 +55,7 @@ GameActions::Result ClearAction::CreateResult() const auto x = (_range.GetLeft() + _range.GetRight()) / 2 + 16; auto y = (_range.GetTop() + _range.GetBottom()) / 2 + 16; - auto z = tile_element_height({ x, y }); + auto z = TileElementHeight({ x, y }); result.Position = CoordsXYZ(x, y, z); return result; @@ -227,5 +227,5 @@ void ClearAction::ResetClearLargeSceneryFlag() bool ClearAction::MapCanClearAt(const CoordsXY& location) { - return (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode || map_is_location_owned_or_has_rights(location); + return (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode || MapIsLocationOwnedOrHasRights(location); } diff --git a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp index bd04546a79..960bf1859b 100644 --- a/src/openrct2/actions/FootpathAdditionPlaceAction.cpp +++ b/src/openrct2/actions/FootpathAdditionPlaceAction.cpp @@ -55,7 +55,7 @@ GameActions::Result FootpathAdditionPlaceAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_loc)) + if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp index 7911cc69e8..8505e86dc6 100644 --- a/src/openrct2/actions/FootpathAdditionRemoveAction.cpp +++ b/src/openrct2/actions/FootpathAdditionRemoveAction.cpp @@ -49,7 +49,7 @@ GameActions::Result FootpathAdditionRemoveAction::Query() const return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_loc)) + if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/FootpathPlaceAction.cpp b/src/openrct2/actions/FootpathPlaceAction.cpp index a1ee0aae52..dee757968b 100644 --- a/src/openrct2/actions/FootpathPlaceAction.cpp +++ b/src/openrct2/actions/FootpathPlaceAction.cpp @@ -71,12 +71,12 @@ GameActions::Result FootpathPlaceAction::Query() const gFootpathGroundFlags = 0; - if (!LocationValid(_loc) || map_is_edge(_loc)) + if (!LocationValid(_loc) || MapIsEdge(_loc)) { return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_loc)) + if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_NOT_OWNED_BY_PARK); } @@ -284,7 +284,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertQuery(GameActions::Result zHigh += PATH_HEIGHT_STEP; } - auto entranceElement = map_get_park_entrance_element_at(_loc, false); + auto entranceElement = MapGetParkEntranceElementAt(_loc, false); // Make sure the entrance part is the middle if (entranceElement != nullptr && (entranceElement->GetSequenceIndex()) == 0) { @@ -353,7 +353,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertExecute(GameActions::Resul zHigh += PATH_HEIGHT_STEP; } - auto entranceElement = map_get_park_entrance_element_at(_loc, false); + auto entranceElement = MapGetParkEntranceElementAt(_loc, false); // Make sure the entrance part is the middle if (entranceElement != nullptr && (entranceElement->GetSequenceIndex()) == 0) { diff --git a/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp b/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp index 4cb05966ff..d398b75e8f 100644 --- a/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp +++ b/src/openrct2/actions/FootpathPlaceFromTrackAction.cpp @@ -57,13 +57,13 @@ GameActions::Result FootpathPlaceFromTrackAction::Query() const gFootpathGroundFlags = 0; - if (!LocationValid(_loc) || map_is_edge(_loc)) + if (!LocationValid(_loc) || MapIsEdge(_loc)) { return GameActions::Result( GameActions::Status::InvalidParameters, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_loc)) + if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -126,7 +126,7 @@ GameActions::Result FootpathPlaceFromTrackAction::ElementInsertQuery(GameActions zHigh += PATH_HEIGHT_STEP; } - auto entranceElement = map_get_park_entrance_element_at(_loc, false); + auto entranceElement = MapGetParkEntranceElementAt(_loc, false); // Make sure the entrance part is the middle if (entranceElement != nullptr && (entranceElement->GetSequenceIndex()) == 0) { @@ -196,7 +196,7 @@ GameActions::Result FootpathPlaceFromTrackAction::ElementInsertExecute(GameActio zHigh += PATH_HEIGHT_STEP; } - auto entranceElement = map_get_park_entrance_element_at(_loc, false); + auto entranceElement = MapGetParkEntranceElementAt(_loc, false); // Make sure the entrance part is the middle if (entranceElement != nullptr && (entranceElement->GetSequenceIndex()) == 0) { diff --git a/src/openrct2/actions/FootpathRemoveAction.cpp b/src/openrct2/actions/FootpathRemoveAction.cpp index d672561ad3..808817c1c2 100644 --- a/src/openrct2/actions/FootpathRemoveAction.cpp +++ b/src/openrct2/actions/FootpathRemoveAction.cpp @@ -56,7 +56,7 @@ GameActions::Result FootpathRemoveAction::Query() const GameActions::Status::NotOwned, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK); } - if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !map_is_location_owned(_loc)) + if (!((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && !MapIsLocationOwned(_loc)) { return GameActions::Result( GameActions::Status::NotOwned, STR_CANT_REMOVE_FOOTPATH_FROM_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -97,7 +97,7 @@ GameActions::Result FootpathRemoveAction::Execute() const } FootpathRemoveEdgesAt(_loc, footpathElement); map_invalidate_tile_full(_loc); - tile_element_remove(footpathElement); + TileElementRemove(footpathElement); FootpathUpdateQueueChains(); // Remove the spawn point (if there is one in the current tile) diff --git a/src/openrct2/actions/GameAction.cpp b/src/openrct2/actions/GameAction.cpp index fe1d649356..86e8e3eb8b 100644 --- a/src/openrct2/actions/GameAction.cpp +++ b/src/openrct2/actions/GameAction.cpp @@ -471,7 +471,7 @@ const char* GameAction::GetName() const bool GameAction::LocationValid(const CoordsXY& coords) const { - auto result = map_is_location_valid(coords); + auto result = MapIsLocationValid(coords); if (!result) return false; #ifdef ENABLE_SCRIPTING diff --git a/src/openrct2/actions/LandBuyRightsAction.cpp b/src/openrct2/actions/LandBuyRightsAction.cpp index 001779f3aa..b8534059c6 100644 --- a/src/openrct2/actions/LandBuyRightsAction.cpp +++ b/src/openrct2/actions/LandBuyRightsAction.cpp @@ -74,7 +74,7 @@ GameActions::Result LandBuyRightsAction::QueryExecute(bool isExecuting) const CoordsXYZ centre{ (validRange.GetLeft() + validRange.GetRight()) / 2 + 16, (validRange.GetTop() + validRange.GetBottom()) / 2 + 16, 0 }; - centre.z = tile_element_height(centre); + centre.z = TileElementHeight(centre); res.Position = centre; res.Expenditure = ExpenditureType::LandPurchase; diff --git a/src/openrct2/actions/LandLowerAction.cpp b/src/openrct2/actions/LandLowerAction.cpp index 2dc5690670..0d80033d9a 100644 --- a/src/openrct2/actions/LandLowerAction.cpp +++ b/src/openrct2/actions/LandLowerAction.cpp @@ -64,15 +64,15 @@ GameActions::Result LandLowerAction::QueryExecute(bool isExecuting) const auto validRange = ClampRangeWithinMap(_range); - res.Position = { _coords.x, _coords.y, tile_element_height(_coords) }; + res.Position = { _coords.x, _coords.y, TileElementHeight(_coords) }; res.Expenditure = ExpenditureType::Landscaping; if (isExecuting) { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, { _coords.x, _coords.y, tile_element_height(_coords) }); + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, { _coords.x, _coords.y, TileElementHeight(_coords) }); } - uint8_t maxHeight = map_get_highest_land_height(validRange); + uint8_t maxHeight = MapGetHighestLandHeight(validRange); bool withinOwnership = false; for (int32_t y = validRange.GetTop(); y <= validRange.GetBottom(); y += COORDS_XY_STEP) @@ -87,7 +87,7 @@ GameActions::Result LandLowerAction::QueryExecute(bool isExecuting) const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(CoordsXY{ x, y })) + if (!MapIsLocationInPark(CoordsXY{ x, y })) { continue; } diff --git a/src/openrct2/actions/LandRaiseAction.cpp b/src/openrct2/actions/LandRaiseAction.cpp index 8d50c08627..6384a6b809 100644 --- a/src/openrct2/actions/LandRaiseAction.cpp +++ b/src/openrct2/actions/LandRaiseAction.cpp @@ -65,15 +65,15 @@ GameActions::Result LandRaiseAction::QueryExecute(bool isExecuting) const auto validRange = ClampRangeWithinMap(_range); - res.Position = { _coords.x, _coords.y, tile_element_height(_coords) }; + res.Position = { _coords.x, _coords.y, TileElementHeight(_coords) }; res.Expenditure = ExpenditureType::Landscaping; if (isExecuting) { - OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, { _coords.x, _coords.y, tile_element_height(_coords) }); + OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, { _coords.x, _coords.y, TileElementHeight(_coords) }); } - uint8_t minHeight = map_get_lowest_land_height(validRange); + uint8_t minHeight = MapGetLowestLandHeight(validRange); bool withinOwnership = false; for (int32_t y = validRange.GetTop(); y <= validRange.GetBottom(); y += COORDS_XY_STEP) @@ -88,7 +88,7 @@ GameActions::Result LandRaiseAction::QueryExecute(bool isExecuting) const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(CoordsXY{ x, y })) + if (!MapIsLocationInPark(CoordsXY{ x, y })) { continue; } diff --git a/src/openrct2/actions/LandSetHeightAction.cpp b/src/openrct2/actions/LandSetHeightAction.cpp index a965ebcc01..f65252598f 100644 --- a/src/openrct2/actions/LandSetHeightAction.cpp +++ b/src/openrct2/actions/LandSetHeightAction.cpp @@ -60,7 +60,7 @@ GameActions::Result LandSetHeightAction::Query() const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(_coords)) + if (!MapIsLocationInPark(_coords)) { return GameActions::Result(GameActions::Status::Disallowed, STR_LAND_NOT_OWNED_BY_PARK, STR_NONE); } @@ -144,7 +144,7 @@ GameActions::Result LandSetHeightAction::Query() const GameActions::Result LandSetHeightAction::Execute() const { money32 cost = 0.00_GBP; - auto surfaceHeight = tile_element_height(_coords); + auto surfaceHeight = TileElementHeight(_coords); FootpathRemoveLitter({ _coords, surfaceHeight }); if (!gCheatsDisableClearanceChecks) @@ -257,7 +257,7 @@ void LandSetHeightAction::SmallSceneryRemoval() const continue; if (_height + 4 < tileElement->base_height) continue; - tile_element_remove(tileElement--); + TileElementRemove(tileElement--); } while (!(tileElement++)->IsLastForTile()); } diff --git a/src/openrct2/actions/LandSetRightsAction.cpp b/src/openrct2/actions/LandSetRightsAction.cpp index cd5d86365c..5d17c92c7a 100644 --- a/src/openrct2/actions/LandSetRightsAction.cpp +++ b/src/openrct2/actions/LandSetRightsAction.cpp @@ -70,7 +70,7 @@ GameActions::Result LandSetRightsAction::QueryExecute(bool isExecuting) const auto validRange = ClampRangeWithinMap(_range.Normalise()); CoordsXYZ centre{ (validRange.GetLeft() + validRange.GetRight()) / 2 + 16, (validRange.GetTop() + validRange.GetBottom()) / 2 + 16, 0 }; - centre.z = tile_element_height(centre); + centre.z = TileElementHeight(centre); res.Position = centre; res.Expenditure = ExpenditureType::LandPurchase; diff --git a/src/openrct2/actions/LandSmoothAction.cpp b/src/openrct2/actions/LandSmoothAction.cpp index 04cabecc17..45887f2f2e 100644 --- a/src/openrct2/actions/LandSmoothAction.cpp +++ b/src/openrct2/actions/LandSmoothAction.cpp @@ -330,7 +330,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const auto b = std::clamp(normRange.GetBottom(), 0, MAXIMUM_TILE_START_XY); auto validRange = MapRange{ l, t, r, b }; - int32_t centreZ = tile_element_height(_coords); + int32_t centreZ = TileElementHeight(_coords); auto res = GameActions::Result(); res.ErrorTitle = _ErrorTitles[_isLowering ? 0 : 1]; @@ -342,8 +342,8 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const { case MAP_SELECT_TYPE_FULL: { - uint8_t minHeight = heightOffset + map_get_lowest_land_height(validRange); - uint8_t maxHeight = heightOffset + map_get_highest_land_height(validRange); + uint8_t minHeight = heightOffset + MapGetLowestLandHeight(validRange); + uint8_t maxHeight = heightOffset + MapGetHighestLandHeight(validRange); // Smooth the 4 corners { // top-left diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.cpp b/src/openrct2/actions/LargeSceneryPlaceAction.cpp index b88d8f88e2..e1e53ca75c 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.cpp +++ b/src/openrct2/actions/LargeSceneryPlaceAction.cpp @@ -56,7 +56,7 @@ GameActions::Result LargeSceneryPlaceAction::Query() const auto res = GameActions::Result(); res.ErrorTitle = STR_CANT_POSITION_THIS_HERE; res.Expenditure = ExpenditureType::Landscaping; - int16_t surfaceHeight = tile_element_height(_loc); + int16_t surfaceHeight = TileElementHeight(_loc); res.Position.x = _loc.x + 16; res.Position.y = _loc.y + 16; res.Position.z = surfaceHeight; @@ -148,12 +148,12 @@ GameActions::Result LargeSceneryPlaceAction::Query() const resultData.GroundFlags = tempSceneryGroundFlags; - if (!LocationValid(curTile) || map_is_edge(curTile)) + if (!LocationValid(curTile) || MapIsEdge(curTile)) { return GameActions::Result(GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_OFF_EDGE_OF_MAP); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !map_is_location_owned({ curTile, zLow }) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !MapIsLocationOwned({ curTile, zLow }) && !gCheatsSandboxMode) { return GameActions::Result( GameActions::Status::Disallowed, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); @@ -182,7 +182,7 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const res.ErrorTitle = STR_CANT_POSITION_THIS_HERE; res.Expenditure = ExpenditureType::Landscaping; - int16_t surfaceHeight = tile_element_height(_loc); + int16_t surfaceHeight = TileElementHeight(_loc); res.Position.x = _loc.x + 16; res.Position.y = _loc.y + 16; res.Position.z = surfaceHeight; @@ -346,7 +346,7 @@ int16_t LargeSceneryPlaceAction::GetMaxSurfaceHeight(rct_large_scenery_tile* til curTile.x += _loc.x; curTile.y += _loc.y; - if (!map_is_location_valid(curTile)) + if (!MapIsLocationValid(curTile)) { continue; } diff --git a/src/openrct2/actions/LargeSceneryRemoveAction.cpp b/src/openrct2/actions/LargeSceneryRemoveAction.cpp index 3eb4e44c6a..f9bc0c93ac 100644 --- a/src/openrct2/actions/LargeSceneryRemoveAction.cpp +++ b/src/openrct2/actions/LargeSceneryRemoveAction.cpp @@ -54,7 +54,7 @@ GameActions::Result LargeSceneryRemoveAction::Query() const const uint32_t flags = GetFlags(); - int32_t z = tile_element_height(_loc); + int32_t z = TileElementHeight(_loc); res.Position.x = _loc.x + 16; res.Position.y = _loc.y + 16; res.Position.z = z; @@ -93,7 +93,7 @@ GameActions::Result LargeSceneryRemoveAction::Query() const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_owned({ currentTile.x, currentTile.y, currentTile.z })) + if (!MapIsLocationOwned({ currentTile.x, currentTile.y, currentTile.z })) { return GameActions::Result(GameActions::Status::NoClearance, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); } @@ -125,7 +125,7 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const { auto res = GameActions::Result(); - int32_t z = tile_element_height(_loc); + int32_t z = TileElementHeight(_loc); res.Position.x = _loc.x + 16; res.Position.y = _loc.y + 16; res.Position.z = z; @@ -165,7 +165,7 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_owned({ currentTile.x, currentTile.y, currentTile.z })) + if (!MapIsLocationOwned({ currentTile.x, currentTile.y, currentTile.z })) { return GameActions::Result(GameActions::Status::NoClearance, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); } @@ -175,7 +175,7 @@ GameActions::Result LargeSceneryRemoveAction::Execute() const if (sceneryElement != nullptr) { map_invalidate_tile_full(currentTile); - tile_element_remove(sceneryElement); + TileElementRemove(sceneryElement); } else { diff --git a/src/openrct2/actions/LargeScenerySetColourAction.cpp b/src/openrct2/actions/LargeScenerySetColourAction.cpp index 3f0e408276..7a3f5ebd92 100644 --- a/src/openrct2/actions/LargeScenerySetColourAction.cpp +++ b/src/openrct2/actions/LargeScenerySetColourAction.cpp @@ -52,7 +52,7 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) res.Expenditure = ExpenditureType::Landscaping; res.Position.x = _loc.x + 16; res.Position.y = _loc.y + 16; - res.Position.z = tile_element_height(_loc); + res.Position.z = TileElementHeight(_loc); res.ErrorTitle = STR_CANT_REPAINT_THIS; auto mapSizeMax = GetMapSizeMaxXY(); @@ -119,7 +119,7 @@ GameActions::Result LargeScenerySetColourAction::QueryExecute(bool isExecuting) if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_owned(currentTile)) + if (!MapIsLocationOwned(currentTile)) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK); } diff --git a/src/openrct2/actions/MazePlaceTrackAction.cpp b/src/openrct2/actions/MazePlaceTrackAction.cpp index fdf1f04945..e5737ceb17 100644 --- a/src/openrct2/actions/MazePlaceTrackAction.cpp +++ b/src/openrct2/actions/MazePlaceTrackAction.cpp @@ -50,7 +50,7 @@ GameActions::Result MazePlaceTrackAction::Query() const return res; } - if (!LocationValid(_loc) || (!map_is_location_owned(_loc) && !gCheatsSandboxMode)) + if (!LocationValid(_loc) || (!MapIsLocationOwned(_loc) && !gCheatsSandboxMode)) { res.Error = GameActions::Status::NotOwned; res.ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK; diff --git a/src/openrct2/actions/MazeSetTrackAction.cpp b/src/openrct2/actions/MazeSetTrackAction.cpp index 1827a24fb2..feb4fbf9cd 100644 --- a/src/openrct2/actions/MazeSetTrackAction.cpp +++ b/src/openrct2/actions/MazeSetTrackAction.cpp @@ -61,7 +61,7 @@ GameActions::Result MazeSetTrackAction::Query() const return res; } - if (!LocationValid(_loc) || (!map_is_location_owned(_loc) && !gCheatsSandboxMode)) + if (!LocationValid(_loc) || (!MapIsLocationOwned(_loc) && !gCheatsSandboxMode)) { res.Error = GameActions::Status::NotOwned; res.ErrorMessage = STR_LAND_NOT_OWNED_BY_PARK; @@ -292,7 +292,7 @@ GameActions::Result MazeSetTrackAction::Execute() const if ((tileElement->AsTrack()->GetMazeEntry() & 0x8888) == 0x8888) { - tile_element_remove(tileElement); + TileElementRemove(tileElement); ride->ValidateStations(); ride->maze_tiles--; } diff --git a/src/openrct2/actions/ParkEntranceRemoveAction.cpp b/src/openrct2/actions/ParkEntranceRemoveAction.cpp index 2aa90ffeef..34edb76188 100644 --- a/src/openrct2/actions/ParkEntranceRemoveAction.cpp +++ b/src/openrct2/actions/ParkEntranceRemoveAction.cpp @@ -85,7 +85,7 @@ GameActions::Result ParkEntranceRemoveAction::Execute() const void ParkEntranceRemoveAction::ParkEntranceRemoveSegment(const CoordsXYZ& loc) const { - auto entranceElement = map_get_park_entrance_element_at(loc, true); + auto entranceElement = MapGetParkEntranceElementAt(loc, true); if (entranceElement == nullptr) { return; diff --git a/src/openrct2/actions/PlaceParkEntranceAction.cpp b/src/openrct2/actions/PlaceParkEntranceAction.cpp index d6e88a989a..bd102e22c5 100644 --- a/src/openrct2/actions/PlaceParkEntranceAction.cpp +++ b/src/openrct2/actions/PlaceParkEntranceAction.cpp @@ -93,7 +93,7 @@ GameActions::Result PlaceParkEntranceAction::Query() const } // Check that entrance element does not already exist at this location - EntranceElement* entranceElement = map_get_park_entrance_element_at(entranceLoc, false); + EntranceElement* entranceElement = MapGetParkEntranceElementAt(entranceLoc, false); if (entranceElement != nullptr) { return GameActions::Result(GameActions::Status::ItemAlreadyPlaced, STR_CANT_BUILD_THIS_HERE, STR_NONE); diff --git a/src/openrct2/actions/PlacePeepSpawnAction.cpp b/src/openrct2/actions/PlacePeepSpawnAction.cpp index 5ea989e475..0cd01ec34d 100644 --- a/src/openrct2/actions/PlacePeepSpawnAction.cpp +++ b/src/openrct2/actions/PlacePeepSpawnAction.cpp @@ -55,7 +55,7 @@ GameActions::Result PlacePeepSpawnAction::Query() const } // Verify footpath exists at location, and retrieve coordinates - auto pathElement = map_get_path_element_at(TileCoordsXYZ{ _location }); + auto pathElement = MapGetPathElementAt(TileCoordsXYZ{ _location }); if (pathElement == nullptr) { return GameActions::Result( diff --git a/src/openrct2/actions/RideDemolishAction.cpp b/src/openrct2/actions/RideDemolishAction.cpp index 8cfb2a6be2..0c5a2fe371 100644 --- a/src/openrct2/actions/RideDemolishAction.cpp +++ b/src/openrct2/actions/RideDemolishAction.cpp @@ -150,7 +150,7 @@ GameActions::Result RideDemolishAction::DemolishRide(Ride* ride) const if (!ride->overall_view.IsNull()) { auto xy = ride->overall_view.ToTileCentre(); - res.Position = { xy, tile_element_height(xy) }; + res.Position = { xy, TileElementHeight(xy) }; } ride->Delete(); @@ -229,7 +229,7 @@ money32 RideDemolishAction::DemolishTracks() const auto removRes = GameActions::ExecuteNested(&trackRemoveAction); if (removRes.Error != GameActions::Status::Ok) { - tile_element_remove(tileElement); + TileElementRemove(tileElement); } else { @@ -281,7 +281,7 @@ GameActions::Result RideDemolishAction::RefurbishRide(Ride* ride) const if (!ride->overall_view.IsNull()) { auto location = ride->overall_view.ToTileCentre(); - res.Position = { location, tile_element_height(location) }; + res.Position = { location, TileElementHeight(location) }; } window_close_by_number(WindowClass::DemolishRidePrompt, _rideIndex.ToUnderlying()); diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp index 92450ad7bc..28215d1b9b 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.cpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.cpp @@ -92,7 +92,7 @@ GameActions::Result RideEntranceExitPlaceAction::Query() const } auto z = ride->GetStation(_stationNum).GetBaseZ(); - if (!LocationValid(_loc) || (!gCheatsSandboxMode && !map_is_location_owned({ _loc, z }))) + if (!LocationValid(_loc) || (!gCheatsSandboxMode && !MapIsLocationOwned({ _loc, z }))) { return GameActions::Result(GameActions::Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK); } @@ -225,7 +225,7 @@ GameActions::Result RideEntranceExitPlaceAction::TrackPlaceQuery(const CoordsXYZ const auto errorTitle = isExit ? STR_CANT_BUILD_MOVE_EXIT_FOR_THIS_RIDE_ATTRACTION : STR_CANT_BUILD_MOVE_ENTRANCE_FOR_THIS_RIDE_ATTRACTION; - if (!gCheatsSandboxMode && !map_is_location_owned(loc)) + if (!gCheatsSandboxMode && !MapIsLocationOwned(loc)) { return GameActions::Result(GameActions::Status::NotOwned, errorTitle, STR_LAND_NOT_OWNED_BY_PARK); } @@ -254,7 +254,7 @@ GameActions::Result RideEntranceExitPlaceAction::TrackPlaceQuery(const CoordsXYZ return GameActions::Result(GameActions::Status::Disallowed, errorTitle, STR_TOO_HIGH); } auto res = GameActions::Result(); - res.Position = { loc.ToTileCentre(), tile_element_height(loc) }; + res.Position = { loc.ToTileCentre(), TileElementHeight(loc) }; res.Expenditure = ExpenditureType::RideConstruction; res.Cost += canBuild.Cost; return res; diff --git a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp index 73682cb729..ac51cd6075 100644 --- a/src/openrct2/actions/RideEntranceExitRemoveAction.cpp +++ b/src/openrct2/actions/RideEntranceExitRemoveAction.cpp @@ -138,13 +138,13 @@ GameActions::Result RideEntranceExitRemoveAction::Execute() const auto res = GameActions::Result(); res.Position.x = _loc.x + 16; res.Position.y = _loc.y + 16; - res.Position.z = tile_element_height(res.Position); + res.Position.z = TileElementHeight(res.Position); FootpathQueueChainReset(); MazeEntranceHedgeReplacement({ _loc, entranceElement }); FootpathRemoveEdgesAt(_loc, entranceElement); - tile_element_remove(entranceElement); + TileElementRemove(entranceElement); auto& station = ride->GetStation(_stationNum); if (_isExit) diff --git a/src/openrct2/actions/RideSetAppearanceAction.cpp b/src/openrct2/actions/RideSetAppearanceAction.cpp index b1e518cd9f..4a0b9dc45d 100644 --- a/src/openrct2/actions/RideSetAppearanceAction.cpp +++ b/src/openrct2/actions/RideSetAppearanceAction.cpp @@ -148,7 +148,7 @@ GameActions::Result RideSetAppearanceAction::Execute() const if (!ride->overall_view.IsNull()) { auto location = ride->overall_view.ToTileCentre(); - res.Position = { location, tile_element_height(location) }; + res.Position = { location, TileElementHeight(location) }; } return res; diff --git a/src/openrct2/actions/RideSetNameAction.cpp b/src/openrct2/actions/RideSetNameAction.cpp index 5af06adc09..6090e18a9d 100644 --- a/src/openrct2/actions/RideSetNameAction.cpp +++ b/src/openrct2/actions/RideSetNameAction.cpp @@ -92,7 +92,7 @@ GameActions::Result RideSetNameAction::Execute() const auto res = GameActions::Result(); auto location = ride->overall_view.ToTileCentre(); - res.Position = { location, tile_element_height(location) }; + res.Position = { location, TileElementHeight(location) }; return res; } diff --git a/src/openrct2/actions/RideSetPriceAction.cpp b/src/openrct2/actions/RideSetPriceAction.cpp index d907d29429..ca36271e63 100644 --- a/src/openrct2/actions/RideSetPriceAction.cpp +++ b/src/openrct2/actions/RideSetPriceAction.cpp @@ -90,7 +90,7 @@ GameActions::Result RideSetPriceAction::Execute() const if (!ride->overall_view.IsNull()) { auto location = ride->overall_view.ToTileCentre(); - res.Position = { location, tile_element_height(location) }; + res.Position = { location, TileElementHeight(location) }; } ShopItem shopItem; diff --git a/src/openrct2/actions/RideSetSettingAction.cpp b/src/openrct2/actions/RideSetSettingAction.cpp index c69e4507b6..243b36c870 100644 --- a/src/openrct2/actions/RideSetSettingAction.cpp +++ b/src/openrct2/actions/RideSetSettingAction.cpp @@ -234,7 +234,7 @@ GameActions::Result RideSetSettingAction::Execute() const if (!ride->overall_view.IsNull()) { auto location = ride->overall_view.ToTileCentre(); - res.Position = { location, tile_element_height(location) }; + res.Position = { location, TileElementHeight(location) }; } window_invalidate_by_number(WindowClass::Ride, _rideIndex.ToUnderlying()); return res; diff --git a/src/openrct2/actions/RideSetStatusAction.cpp b/src/openrct2/actions/RideSetStatusAction.cpp index 01295a7134..a71e22bc3a 100644 --- a/src/openrct2/actions/RideSetStatusAction.cpp +++ b/src/openrct2/actions/RideSetStatusAction.cpp @@ -137,7 +137,7 @@ GameActions::Result RideSetStatusAction::Execute() const if (!ride->overall_view.IsNull()) { auto location = ride->overall_view.ToTileCentre(); - res.Position = { location, tile_element_height(location) }; + res.Position = { location, TileElementHeight(location) }; } switch (_status) diff --git a/src/openrct2/actions/RideSetVehicleAction.cpp b/src/openrct2/actions/RideSetVehicleAction.cpp index 8734d3dc23..76e091e745 100644 --- a/src/openrct2/actions/RideSetVehicleAction.cpp +++ b/src/openrct2/actions/RideSetVehicleAction.cpp @@ -197,7 +197,7 @@ GameActions::Result RideSetVehicleAction::Execute() const if (!ride->overall_view.IsNull()) { auto location = ride->overall_view.ToTileCentre(); - res.Position = { location, tile_element_height(res.Position) }; + res.Position = { location, TileElementHeight(res.Position) }; } auto intent = Intent(INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE); diff --git a/src/openrct2/actions/SmallSceneryPlaceAction.cpp b/src/openrct2/actions/SmallSceneryPlaceAction.cpp index 23ddf93140..847f137279 100644 --- a/src/openrct2/actions/SmallSceneryPlaceAction.cpp +++ b/src/openrct2/actions/SmallSceneryPlaceAction.cpp @@ -74,8 +74,8 @@ GameActions::Result SmallSceneryPlaceAction::Query() const { supportsRequired = true; } - int32_t landHeight = tile_element_height(_loc); - int16_t waterHeight = tile_element_water_height(_loc); + int32_t landHeight = TileElementHeight(_loc); + int16_t waterHeight = TileElementWaterHeight(_loc); int32_t surfaceHeight = landHeight; // If on water @@ -138,8 +138,8 @@ GameActions::Result SmallSceneryPlaceAction::Query() const loc2.x += SceneryQuadrantOffsets[quadrant & 3].x; loc2.y += SceneryQuadrantOffsets[quadrant & 3].y; } - landHeight = tile_element_height(loc2); - waterHeight = tile_element_water_height(loc2); + landHeight = TileElementHeight(loc2); + waterHeight = TileElementWaterHeight(loc2); surfaceHeight = landHeight; // If on water @@ -159,7 +159,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const } if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode - && !map_is_location_owned({ _loc.x, _loc.y, targetHeight })) + && !MapIsLocationOwned({ _loc.x, _loc.y, targetHeight })) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } @@ -283,8 +283,8 @@ GameActions::Result SmallSceneryPlaceAction::Execute() const { supportsRequired = true; } - int32_t landHeight = tile_element_height(_loc); - int16_t waterHeight = tile_element_water_height(_loc); + int32_t landHeight = TileElementHeight(_loc); + int16_t waterHeight = TileElementWaterHeight(_loc); int32_t surfaceHeight = landHeight; // If on water @@ -332,8 +332,8 @@ GameActions::Result SmallSceneryPlaceAction::Execute() const x2 += SceneryQuadrantOffsets[quadrant & 3].x; y2 += SceneryQuadrantOffsets[quadrant & 3].y; } - landHeight = tile_element_height({ x2, y2 }); - waterHeight = tile_element_water_height({ x2, y2 }); + landHeight = TileElementHeight({ x2, y2 }); + waterHeight = TileElementWaterHeight({ x2, y2 }); surfaceHeight = landHeight; // If on water diff --git a/src/openrct2/actions/SmallSceneryRemoveAction.cpp b/src/openrct2/actions/SmallSceneryRemoveAction.cpp index fe3d38021f..38a9b81d20 100644 --- a/src/openrct2/actions/SmallSceneryRemoveAction.cpp +++ b/src/openrct2/actions/SmallSceneryRemoveAction.cpp @@ -87,7 +87,7 @@ GameActions::Result SmallSceneryRemoveAction::Query() const } // Check if the land is owned - if (!map_is_location_owned(_loc)) + if (!MapIsLocationOwned(_loc)) { res.Error = GameActions::Status::NoClearance; res.ErrorTitle = STR_CANT_REMOVE_THIS; @@ -128,10 +128,10 @@ GameActions::Result SmallSceneryRemoveAction::Execute() const GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } - res.Position.z = tile_element_height(res.Position); + res.Position.z = TileElementHeight(res.Position); map_invalidate_tile_full(_loc); - tile_element_remove(tileElement); + TileElementRemove(tileElement); return res; } diff --git a/src/openrct2/actions/SmallScenerySetColourAction.cpp b/src/openrct2/actions/SmallScenerySetColourAction.cpp index cb0224d360..5018e3d952 100644 --- a/src/openrct2/actions/SmallScenerySetColourAction.cpp +++ b/src/openrct2/actions/SmallScenerySetColourAction.cpp @@ -75,13 +75,13 @@ GameActions::Result SmallScenerySetColourAction::QueryExecute(bool isExecuting) if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_owned(_loc)) + if (!MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK); } } - auto sceneryElement = map_get_small_scenery_element_at(_loc, _sceneryType, _quadrant); + auto sceneryElement = MapGetSmallSceneryElementAt(_loc, _sceneryType, _quadrant); if (sceneryElement == nullptr) { diff --git a/src/openrct2/actions/StaffHireNewAction.cpp b/src/openrct2/actions/StaffHireNewAction.cpp index 77195f7f20..dfeddc6b05 100644 --- a/src/openrct2/actions/StaffHireNewAction.cpp +++ b/src/openrct2/actions/StaffHireNewAction.cpp @@ -231,7 +231,7 @@ void StaffHireNewAction::AutoPositionNewStaff(Peep* newPeep) const if (guest->State == PeepState::Walking) { // Check the walking guest's tile. Only count them if they're on a path tile. - guest_tile = map_get_path_element_at(TileCoordsXYZ{ guest->NextLoc }); + guest_tile = MapGetPathElementAt(TileCoordsXYZ{ guest->NextLoc }); if (guest_tile != nullptr) ++count; } @@ -249,7 +249,7 @@ void StaffHireNewAction::AutoPositionNewStaff(Peep* newPeep) const { if (guest->State == PeepState::Walking) { - guest_tile = map_get_path_element_at(TileCoordsXYZ{ guest->NextLoc }); + guest_tile = MapGetPathElementAt(TileCoordsXYZ{ guest->NextLoc }); if (guest_tile != nullptr) { if (rand == 0) diff --git a/src/openrct2/actions/SurfaceSetStyleAction.cpp b/src/openrct2/actions/SurfaceSetStyleAction.cpp index 7434731f5d..a307f60d75 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.cpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.cpp @@ -78,7 +78,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const auto xMid = (validRange.GetLeft() + validRange.GetRight()) / 2 + 16; auto yMid = (validRange.GetTop() + validRange.GetBottom()) / 2 + 16; - auto heightMid = tile_element_height({ xMid, yMid }); + auto heightMid = TileElementHeight({ xMid, yMid }); res.Position.x = xMid; res.Position.y = yMid; @@ -104,7 +104,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(coords)) + if (!MapIsLocationInPark(coords)) continue; } @@ -154,7 +154,7 @@ GameActions::Result SurfaceSetStyleAction::Execute() const auto validRange = ClampRangeWithinMap(_range.Normalise()); auto xMid = (validRange.GetLeft() + validRange.GetRight()) / 2 + 16; auto yMid = (validRange.GetTop() + validRange.GetBottom()) / 2 + 16; - auto heightMid = tile_element_height({ xMid, yMid }); + auto heightMid = TileElementHeight({ xMid, yMid }); res.Position.x = xMid; res.Position.y = yMid; @@ -172,7 +172,7 @@ GameActions::Result SurfaceSetStyleAction::Execute() const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(coords)) + if (!MapIsLocationInPark(coords)) continue; } @@ -198,7 +198,7 @@ GameActions::Result SurfaceSetStyleAction::Execute() const surfaceElement->SetSurfaceStyle(_surfaceStyle); map_invalidate_tile_full(coords); - FootpathRemoveLitter({ coords, tile_element_height(coords) }); + FootpathRemoveLitter({ coords, TileElementHeight(coords) }); } } } diff --git a/src/openrct2/actions/TileModifyAction.cpp b/src/openrct2/actions/TileModifyAction.cpp index 6c11df3be3..ba2a8a0cac 100644 --- a/src/openrct2/actions/TileModifyAction.cpp +++ b/src/openrct2/actions/TileModifyAction.cpp @@ -217,7 +217,7 @@ GameActions::Result TileModifyAction::QueryExecute(bool isExecuting) const res.Position.x = _loc.x; res.Position.y = _loc.y; - res.Position.z = tile_element_height(_loc); + res.Position.z = TileElementHeight(_loc); return res; } diff --git a/src/openrct2/actions/TrackPlaceAction.cpp b/src/openrct2/actions/TrackPlaceAction.cpp index 7f2322971b..ec1959e1cf 100644 --- a/src/openrct2/actions/TrackPlaceAction.cpp +++ b/src/openrct2/actions/TrackPlaceAction.cpp @@ -171,7 +171,7 @@ GameActions::Result TrackPlaceAction::Query() const 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) || (!map_is_location_owned(tileCoords) && !gCheatsSandboxMode)) + if (!LocationValid(tileCoords) || (!MapIsLocationOwned(tileCoords) && !gCheatsSandboxMode)) { return GameActions::Result( GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); diff --git a/src/openrct2/actions/TrackRemoveAction.cpp b/src/openrct2/actions/TrackRemoveAction.cpp index e19bb8c253..59c91635d5 100644 --- a/src/openrct2/actions/TrackRemoveAction.cpp +++ b/src/openrct2/actions/TrackRemoveAction.cpp @@ -434,7 +434,7 @@ GameActions::Result TrackRemoveAction::Execute() const { FootpathRemoveEdgesAt(mapLoc, tileElement); } - tile_element_remove(tileElement); + TileElementRemove(tileElement); ride->ValidateStations(); if (!(GetFlags() & GAME_COMMAND_FLAG_GHOST)) { diff --git a/src/openrct2/actions/WallPlaceAction.cpp b/src/openrct2/actions/WallPlaceAction.cpp index 2b093a764c..6cfeef32e3 100644 --- a/src/openrct2/actions/WallPlaceAction.cpp +++ b/src/openrct2/actions/WallPlaceAction.cpp @@ -70,7 +70,7 @@ GameActions::Result WallPlaceAction::Query() const if (_loc.z == 0) { - res.Position.z = tile_element_height(res.Position); + res.Position.z = TileElementHeight(res.Position); } if (!LocationValid(_loc)) @@ -83,12 +83,12 @@ GameActions::Result WallPlaceAction::Query() const { if (_loc.z == 0) { - if (!map_is_location_in_park(_loc)) + if (!MapIsLocationInPark(_loc)) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_BUILD_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } } - else if (!map_is_location_owned(_loc)) + else if (!MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_BUILD_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); } @@ -280,7 +280,7 @@ GameActions::Result WallPlaceAction::Execute() const if (res.Position.z == 0) { - res.Position.z = tile_element_height(res.Position); + res.Position.z = TileElementHeight(res.Position); } uint8_t edgeSlope = 0; diff --git a/src/openrct2/actions/WallRemoveAction.cpp b/src/openrct2/actions/WallRemoveAction.cpp index 947e96e157..9d0b02da6e 100644 --- a/src/openrct2/actions/WallRemoveAction.cpp +++ b/src/openrct2/actions/WallRemoveAction.cpp @@ -51,7 +51,7 @@ GameActions::Result WallRemoveAction::Query() const } const bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST; - if (!isGhost && !(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && !map_is_location_owned(_loc)) + if (!isGhost && !(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode && !MapIsLocationOwned(_loc)) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); } @@ -84,11 +84,11 @@ GameActions::Result WallRemoveAction::Execute() const res.Position.x = _loc.x + 16; res.Position.y = _loc.y + 16; - res.Position.z = tile_element_height(res.Position); + res.Position.z = TileElementHeight(res.Position); wallElement->RemoveBannerEntry(); map_invalidate_tile_zoom1({ _loc, wallElement->GetBaseZ(), (wallElement->GetBaseZ()) + 72 }); - tile_element_remove(wallElement); + TileElementRemove(wallElement); return res; } diff --git a/src/openrct2/actions/WallSetColourAction.cpp b/src/openrct2/actions/WallSetColourAction.cpp index 298ebe9fe1..93b372232d 100644 --- a/src/openrct2/actions/WallSetColourAction.cpp +++ b/src/openrct2/actions/WallSetColourAction.cpp @@ -56,12 +56,12 @@ GameActions::Result WallSetColourAction::Query() const return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK); } - if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !map_is_location_in_park(_loc) && !gCheatsSandboxMode) + if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !MapIsLocationInPark(_loc) && !gCheatsSandboxMode) { return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK); } - auto wallElement = map_get_wall_element_at(_loc); + auto wallElement = MapGetWallElementAt(_loc); if (wallElement == nullptr) { log_error( @@ -113,7 +113,7 @@ GameActions::Result WallSetColourAction::Execute() const res.Position.z = _loc.z; res.Expenditure = ExpenditureType::Landscaping; - auto wallElement = map_get_wall_element_at(_loc); + auto wallElement = MapGetWallElementAt(_loc); if (wallElement == nullptr) { log_error( diff --git a/src/openrct2/actions/WaterLowerAction.cpp b/src/openrct2/actions/WaterLowerAction.cpp index 2aed4cdb3c..b2f70f583f 100644 --- a/src/openrct2/actions/WaterLowerAction.cpp +++ b/src/openrct2/actions/WaterLowerAction.cpp @@ -48,8 +48,8 @@ GameActions::Result WaterLowerAction::QueryExecute(bool isExecuting) const auto validRange = ClampRangeWithinMap(_range); res.Position.x = ((validRange.GetLeft() + validRange.GetRight()) / 2) + 16; res.Position.y = ((validRange.GetTop() + validRange.GetBottom()) / 2) + 16; - int16_t z = tile_element_height(res.Position); - int16_t waterHeight = tile_element_water_height(res.Position); + int16_t z = TileElementHeight(res.Position); + int16_t waterHeight = TileElementWaterHeight(res.Position); if (waterHeight != 0) { z = waterHeight; @@ -73,7 +73,7 @@ GameActions::Result WaterLowerAction::QueryExecute(bool isExecuting) const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(CoordsXY{ x, y })) + if (!MapIsLocationInPark(CoordsXY{ x, y })) { continue; } @@ -132,7 +132,7 @@ uint8_t WaterLowerAction::GetLowestHeight(const MapRange& validRange) const { if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(CoordsXY{ x, y })) + if (!MapIsLocationInPark(CoordsXY{ x, y })) { continue; } diff --git a/src/openrct2/actions/WaterRaiseAction.cpp b/src/openrct2/actions/WaterRaiseAction.cpp index 54dcfc5288..74779abaa8 100644 --- a/src/openrct2/actions/WaterRaiseAction.cpp +++ b/src/openrct2/actions/WaterRaiseAction.cpp @@ -48,8 +48,8 @@ GameActions::Result WaterRaiseAction::QueryExecute(bool isExecuting) const auto validRange = ClampRangeWithinMap(_range); res.Position.x = ((validRange.GetLeft() + validRange.GetRight()) / 2) + 16; res.Position.y = ((validRange.GetTop() + validRange.GetBottom()) / 2) + 16; - int32_t z = tile_element_height(res.Position); - int16_t waterHeight = tile_element_water_height(res.Position); + int32_t z = TileElementHeight(res.Position); + int16_t waterHeight = TileElementWaterHeight(res.Position); if (waterHeight != 0) { z = waterHeight; @@ -73,7 +73,7 @@ GameActions::Result WaterRaiseAction::QueryExecute(bool isExecuting) const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(CoordsXY{ x, y })) + if (!MapIsLocationInPark(CoordsXY{ x, y })) { continue; } @@ -138,7 +138,7 @@ uint16_t WaterRaiseAction::GetHighestHeight(const MapRange& validRange) const { if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(CoordsXY{ x, y })) + if (!MapIsLocationInPark(CoordsXY{ x, y })) { continue; } diff --git a/src/openrct2/actions/WaterSetHeightAction.cpp b/src/openrct2/actions/WaterSetHeightAction.cpp index 52237d21a7..bacf225b6b 100644 --- a/src/openrct2/actions/WaterSetHeightAction.cpp +++ b/src/openrct2/actions/WaterSetHeightAction.cpp @@ -58,7 +58,7 @@ GameActions::Result WaterSetHeightAction::Query() const if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(_coords)) + if (!MapIsLocationInPark(_coords)) { return GameActions::Result(GameActions::Status::Disallowed, STR_NONE, STR_LAND_NOT_OWNED_BY_PARK); } @@ -104,7 +104,7 @@ GameActions::Result WaterSetHeightAction::Execute() const res.Expenditure = ExpenditureType::Landscaping; res.Position = { _coords, _height * COORDS_Z_STEP }; - int32_t surfaceHeight = tile_element_height(_coords); + int32_t surfaceHeight = TileElementHeight(_coords); FootpathRemoveLitter({ _coords, surfaceHeight }); if (!gCheatsDisableClearanceChecks) WallRemoveAtZ({ _coords, surfaceHeight }); diff --git a/src/openrct2/cmdline/BenchSpriteSort.cpp b/src/openrct2/cmdline/BenchSpriteSort.cpp index aabc4fd67e..a9ef4b8e78 100644 --- a/src/openrct2/cmdline/BenchSpriteSort.cpp +++ b/src/openrct2/cmdline/BenchSpriteSort.cpp @@ -103,7 +103,7 @@ static std::vector extract_paint_session(std::string_view viewport.flags = 0; auto customXY = TileCoordsXY(gMapSize.x / 2, gMapSize.y / 2).ToCoordsXY().ToTileCentre(); - auto customXYZ = CoordsXYZ(customXY, tile_element_height(customXY)); + auto customXYZ = CoordsXYZ(customXY, TileElementHeight(customXY)); auto screenXY = translate_3d_to_2d_with_z(0, customXYZ); viewport.viewPos = { screenXY.x - (viewport.view_width / 2), screenXY.y - (viewport.view_height / 2) }; diff --git a/src/openrct2/entity/Duck.cpp b/src/openrct2/entity/Duck.cpp index d489fdace4..5332ec9f86 100644 --- a/src/openrct2/entity/Duck.cpp +++ b/src/openrct2/entity/Duck.cpp @@ -180,8 +180,8 @@ void Duck::UpdateSwim() else { Invalidate(); - int16_t landZ = tile_element_height({ x, y }); - int16_t waterZ = tile_element_water_height({ x, y }); + int16_t landZ = TileElementHeight({ x, y }); + int16_t waterZ = TileElementWaterHeight({ x, y }); if (z < landZ || waterZ == 0) { @@ -200,8 +200,8 @@ void Duck::UpdateSwim() int32_t direction = sprite_direction >> 3; auto destination = CoordsXYZ{ CoordsXY{ x, y } + DuckMoveOffset[direction], 0 }; - landZ = tile_element_height(destination); - waterZ = tile_element_water_height(destination); + landZ = TileElementHeight(destination); + waterZ = TileElementWaterHeight(destination); if (z > landZ && z == waterZ) { @@ -259,7 +259,7 @@ void Duck::UpdateFlyAway() int32_t direction = sprite_direction >> 3; auto destination = CoordsXYZ{ x + (DuckMoveOffset[direction].x * 2), y + (DuckMoveOffset[direction].y * 2), std::min(z + 2, 496) }; - if (map_is_location_valid(destination)) + if (MapIsLocationValid(destination)) { MoveTo(destination); } diff --git a/src/openrct2/entity/EntityRegistry.cpp b/src/openrct2/entity/EntityRegistry.cpp index bd81c7db16..c09d2c8f54 100644 --- a/src/openrct2/entity/EntityRegistry.cpp +++ b/src/openrct2/entity/EntityRegistry.cpp @@ -454,7 +454,7 @@ void EntityBase::MoveTo(const CoordsXYZ& newLocation) } auto loc = newLocation; - if (!map_is_location_valid(loc)) + if (!MapIsLocationValid(loc)) { loc.x = LOCATION_NULL; } diff --git a/src/openrct2/entity/Guest.cpp b/src/openrct2/entity/Guest.cpp index 109ed2eaf3..bc0cbf581e 100644 --- a/src/openrct2/entity/Guest.cpp +++ b/src/openrct2/entity/Guest.cpp @@ -449,7 +449,7 @@ static bool IsValidLocation(const CoordsXYZ& coords) { if (coords.x != LOCATION_NULL) { - if (map_is_location_valid(coords)) + if (MapIsLocationValid(coords)) { return true; } @@ -1885,7 +1885,7 @@ BitSet Guest::FindRidesToGoOn() for (int32_t tileY = cy - radius; tileY <= cy + radius; tileY += COORDS_XY_STEP) { auto location = CoordsXY{ tileX, tileY }; - if (!map_is_location_valid(location)) + if (!MapIsLocationValid(location)) continue; for (auto* trackElement : TileElementsView(location)) @@ -2903,7 +2903,7 @@ static bool peep_really_liked_ride(Guest* peep, Ride* ride) */ static PeepThoughtType peep_assess_surroundings(int16_t centre_x, int16_t centre_y, int16_t centre_z) { - if ((tile_element_height({ centre_x, centre_y })) > centre_z) + if ((TileElementHeight({ centre_x, centre_y })) > centre_z) return PeepThoughtType::None; uint16_t num_scenery = 0; @@ -3158,7 +3158,7 @@ template static void peep_head_for_nearest_ride(Guest* peep, bool co for (auto y = cy - searchRadius; y <= cy + searchRadius; y += COORDS_XY_STEP) { auto location = CoordsXY{ x, y }; - if (!map_is_location_valid(location)) + if (!MapIsLocationValid(location)) continue; for (auto* trackElement : TileElementsView(location)) @@ -6276,7 +6276,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, RideId* rideToVi uint16_t x = peep->NextLoc.x + CoordsDirectionDelta[edge].x; uint16_t y = peep->NextLoc.y + CoordsDirectionDelta[edge].y; - if (!map_is_location_valid({ x, y })) + if (!MapIsLocationValid({ x, y })) { return false; } @@ -6393,7 +6393,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, RideId* rideToVi x += CoordsDirectionDelta[edge].x; y += CoordsDirectionDelta[edge].y; - if (!map_is_location_valid({ x, y })) + if (!MapIsLocationValid({ x, y })) { return false; } @@ -6510,7 +6510,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, RideId* rideToVi x += CoordsDirectionDelta[edge].x; y += CoordsDirectionDelta[edge].y; - if (!map_is_location_valid({ x, y })) + if (!MapIsLocationValid({ x, y })) { return false; } @@ -6699,7 +6699,7 @@ void Guest::UpdateSpriteType() if (ClimateIsRaining() && (HasItem(ShopItem::Umbrella)) && x != LOCATION_NULL) { CoordsXY loc = { x, y }; - if (map_is_location_valid(loc.ToTileStart())) + if (MapIsLocationValid(loc.ToTileStart())) { TileElement* tileElement = MapGetFirstElementAt(loc); while (true) diff --git a/src/openrct2/entity/Litter.cpp b/src/openrct2/entity/Litter.cpp index 17d9f25b8e..32864fd3ef 100644 --- a/src/openrct2/entity/Litter.cpp +++ b/src/openrct2/entity/Litter.cpp @@ -20,7 +20,7 @@ static bool isLocationLitterable(const CoordsXYZ& mapPos) { TileElement* tileElement; - if (!map_is_location_owned(mapPos)) + if (!MapIsLocationOwned(mapPos)) return false; tileElement = MapGetFirstElementAt(mapPos); diff --git a/src/openrct2/entity/MoneyEffect.cpp b/src/openrct2/entity/MoneyEffect.cpp index 4743768520..aedf13a5ac 100644 --- a/src/openrct2/entity/MoneyEffect.cpp +++ b/src/openrct2/entity/MoneyEffect.cpp @@ -93,7 +93,7 @@ void MoneyEffect::Create(money64 value, const CoordsXYZ& loc) if (!mapPositionXY.has_value()) return; - offsetLoc = { mapPositionXY.value(), tile_element_height(*mapPositionXY) }; + offsetLoc = { mapPositionXY.value(), TileElementHeight(*mapPositionXY) }; } offsetLoc.z += 10; CreateAt(-value, offsetLoc, false); diff --git a/src/openrct2/entity/Particle.cpp b/src/openrct2/entity/Particle.cpp index a726b2af78..74ae41e1e8 100644 --- a/src/openrct2/entity/Particle.cpp +++ b/src/openrct2/entity/Particle.cpp @@ -109,8 +109,8 @@ void VehicleCrashParticle::Update() velocity_z = vz & 0xFFFF; // Check collision with land / water - int16_t landZ = tile_element_height(newLoc); - int16_t waterZ = tile_element_water_height(newLoc); + int16_t landZ = TileElementHeight(newLoc); + int16_t waterZ = TileElementWaterHeight(newLoc); if (waterZ != 0 && z >= waterZ && newLoc.z <= waterZ) { diff --git a/src/openrct2/entity/Peep.cpp b/src/openrct2/entity/Peep.cpp index caa5089eeb..a13bad8696 100644 --- a/src/openrct2/entity/Peep.cpp +++ b/src/openrct2/entity/Peep.cpp @@ -620,7 +620,7 @@ void Peep::PickupAbort(int32_t old_x) // dropped. GameActions::Result Peep::Place(const TileCoordsXYZ& location, bool apply) { - auto* pathElement = map_get_path_element_at(location); + auto* pathElement = MapGetPathElementAt(location); TileElement* tileElement = reinterpret_cast(pathElement); if (pathElement == nullptr) { @@ -635,7 +635,7 @@ GameActions::Result Peep::Place(const TileCoordsXYZ& location, bool apply) // in the middle of a tile. CoordsXYZ destination = { location.ToCoordsXY().ToTileCentre(), tileElement->GetBaseZ() + 16 }; - if (!map_is_location_owned(destination)) + if (!MapIsLocationOwned(destination)) { return GameActions::Result(GameActions::Status::NotOwned, STR_ERR_CANT_PLACE_PERSON_HERE, STR_LAND_NOT_OWNED_BY_PARK); } @@ -810,7 +810,7 @@ void Peep::UpdateFalling() return; } } - int32_t map_height = tile_element_height({ x, y }); + int32_t map_height = TileElementHeight({ x, y }); if (map_height < z || map_height - 4 > z) continue; saved_height = map_height; @@ -2140,7 +2140,7 @@ static void peep_interact_with_path(Peep* peep, const CoordsXYE& coords) int16_t z = tile_element->GetBaseZ(); auto* guest = peep->As(); - if (map_is_location_owned({ coords, z })) + if (MapIsLocationOwned({ coords, z })) { if (guest != nullptr && guest->OutsideOfPark) { @@ -2410,7 +2410,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result) return; } - if (map_is_edge(newLoc)) + if (MapIsEdge(newLoc)) { if (guest != nullptr && guest->OutsideOfPark) { @@ -2462,7 +2462,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result) if (Is() || (GetNextIsSurface())) { - int16_t height = abs(tile_element_height(newLoc) - z); + int16_t height = abs(TileElementHeight(newLoc) - z); if (height <= 3 || (Is() && height <= 32)) { InteractionRideIndex = RideId::GetNull(); @@ -2472,7 +2472,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result) SetState(PeepState::One); } - if (!map_is_location_in_park(newLoc)) + if (!MapIsLocationInPark(newLoc)) { peep_return_to_centre_of_tile(this); return; @@ -2528,7 +2528,7 @@ int32_t Peep::GetZOnSlope(int32_t tile_x, int32_t tile_y) if (GetNextIsSurface()) { - return tile_element_height({ tile_x, tile_y }); + return TileElementHeight({ tile_x, tile_y }); } uint8_t slope = GetNextDirection(); diff --git a/src/openrct2/entity/Staff.cpp b/src/openrct2/entity/Staff.cpp index da5baa0bc0..d9699d6169 100644 --- a/src/openrct2/entity/Staff.cpp +++ b/src/openrct2/entity/Staff.cpp @@ -81,7 +81,7 @@ template<> bool EntityBase::Is() const bool Staff::IsLocationInPatrol(const CoordsXY& loc) const { // Check if location is in the park - if (!map_is_location_owned_or_has_rights(loc)) + if (!MapIsLocationOwnedOrHasRights(loc)) return false; // Check if staff has patrol area @@ -428,7 +428,7 @@ uint8_t Staff::HandymanDirectionToUncutGrass(uint8_t valid_directions) const CoordsXY chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[chosenDirection]; - if (!map_is_location_valid(chosenTile)) + if (!MapIsLocationValid(chosenTile)) continue; auto surfaceElement = MapGetSurfaceElementAt(chosenTile); @@ -461,7 +461,7 @@ Direction Staff::HandymanDirectionRandSurface(uint8_t validDirections) const CoordsXY chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; - if (map_surface_is_blocked(chosenTile)) + if (MapSurfaceIsBlocked(chosenTile)) continue; break; @@ -503,7 +503,7 @@ bool Staff::DoHandymanPathFinding() } else { - auto* pathElement = map_get_path_element_at(TileCoordsXYZ{ NextLoc }); + auto* pathElement = MapGetPathElementAt(TileCoordsXYZ{ NextLoc }); if (pathElement == nullptr) return true; @@ -554,7 +554,7 @@ bool Staff::DoHandymanPathFinding() CoordsXY chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; - while (!map_is_location_valid(chosenTile)) + while (!MapIsLocationValid(chosenTile)) { newDirection = HandymanDirectionRandSurface(validDirections); chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; @@ -599,7 +599,7 @@ Direction Staff::DirectionSurface(Direction initialDirection) const CoordsXY chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[direction]; - if (!map_surface_is_blocked(chosenTile)) + if (!MapSurfaceIsBlocked(chosenTile)) { return direction; } @@ -759,7 +759,7 @@ bool Staff::DoMechanicPathFinding() } else { - auto* pathElement = map_get_path_element_at(TileCoordsXYZ{ NextLoc }); + auto* pathElement = MapGetPathElementAt(TileCoordsXYZ{ NextLoc }); if (pathElement == nullptr) return true; @@ -771,7 +771,7 @@ bool Staff::DoMechanicPathFinding() CoordsXY chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; - while (!map_is_location_valid(chosenTile)) + while (!MapIsLocationValid(chosenTile)) { newDirection = MechanicDirectionSurface(); chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; @@ -840,7 +840,7 @@ bool Staff::DoMiscPathFinding() } else { - auto* pathElement = map_get_path_element_at(TileCoordsXYZ{ NextLoc }); + auto* pathElement = MapGetPathElementAt(TileCoordsXYZ{ NextLoc }); if (pathElement == nullptr) return true; @@ -849,7 +849,7 @@ bool Staff::DoMiscPathFinding() CoordsXY chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; - while (!map_is_location_valid(chosenTile)) + while (!MapIsLocationValid(chosenTile)) { newDirection = DirectionSurface(scenario_rand() & 3); chosenTile = CoordsXY{ NextLoc } + CoordsDirectionDelta[newDirection]; @@ -1074,7 +1074,7 @@ void Staff::UpdateMowing() { if (auto loc = UpdateAction(); loc.has_value()) { - int16_t checkZ = tile_element_height(*loc); + int16_t checkZ = TileElementHeight(*loc); MoveTo({ loc.value(), checkZ }); return; } diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 65a1bc2d4b..052c90cf25 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -1058,7 +1058,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv) if (w != nullptr) { auto location = TileCoordsXYZ(int_val[0], int_val[1], 0).ToCoordsXYZ().ToTileCentre(); - location.z = tile_element_height(location); + location.z = TileElementHeight(location); w->SetLocation(location); viewport_update_position(w); console.Execute("get location"); diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index f5e48dd4ba..a5d0efbdc8 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -667,7 +667,7 @@ int32_t cmdline_for_screenshot(const char** argv, int32_t argc, ScreenshotOption if (centreMapY) customY = (mapSize.y / 2) * 32 + 16; - int32_t z = tile_element_height({ customX, customY }); + int32_t z = TileElementHeight({ customX, customY }); CoordsXYZ coords3d = { customX, customY, z }; auto coords2d = translate_3d_to_2d_with_z(customRotation, coords3d); @@ -763,7 +763,7 @@ void CaptureImage(const CaptureOptions& options) viewport.view_width = viewport.width; viewport.view_height = viewport.height; - auto z = tile_element_height(options.View->Position); + auto z = TileElementHeight(options.View->Position); CoordsXYZ coords3d(options.View->Position, z); auto coords2d = translate_3d_to_2d_with_z(options.Rotation, coords3d); viewport.viewPos = { coords2d.x - ((options.Zoom.ApplyTo(viewport.view_width)) / 2), diff --git a/src/openrct2/interface/Viewport.cpp b/src/openrct2/interface/Viewport.cpp index 17fe9f53b7..a7eab51259 100644 --- a/src/openrct2/interface/Viewport.cpp +++ b/src/openrct2/interface/Viewport.cpp @@ -248,7 +248,7 @@ CoordsXYZ viewport_adjust_for_map_height(const ScreenCoordsXY& startCoords) for (int32_t i = 0; i < 6; i++) { pos = viewport_coord_to_map_coord(startCoords, height); - height = tile_element_height(pos); + height = TileElementHeight(pos); // HACK: This is to prevent the x and y values being set to values outside // of the map. This can happen when the height is larger than the map size. @@ -673,7 +673,7 @@ void viewport_update_sprite_follow(rct_window* window) if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)) { - int32_t height = (tile_element_height({ sprite->x, sprite->y })) - 16; + int32_t height = (TileElementHeight({ sprite->x, sprite->y })) - 16; int32_t underground = sprite->z < height; viewport_set_underground_flag(underground, window, window->viewport); } @@ -761,7 +761,7 @@ void viewport_update_smart_guest_follow(rct_window* window, const Guest* peep) CoordsXYZ coordFocus; coordFocus.x = xy.x; coordFocus.y = xy.y; - coordFocus.z = tile_element_height(xy) + (4 * COORDS_Z_STEP); + coordFocus.z = TileElementHeight(xy) + (4 * COORDS_Z_STEP); focus = Focus(coordFocus); window->viewport_target_sprite = EntityId::GetNull(); } @@ -1998,7 +1998,7 @@ std::optional screen_get_map_xy(const ScreenCoordsXY& screenCoords, rc // Iterates the cursor location to work out exactly where on the tile it is for (int32_t i = 0; i < 5; i++) { - int32_t z = tile_element_height(cursorMapPos); + int32_t z = TileElementHeight(cursorMapPos); cursorMapPos = viewport_coord_to_map_coord(start_vp_pos, z); cursorMapPos.x = std::clamp(cursorMapPos.x, info.Loc.x, info.Loc.x + 31); cursorMapPos.y = std::clamp(cursorMapPos.y, info.Loc.y, info.Loc.y + 31); @@ -2024,7 +2024,7 @@ std::optional screen_get_map_xy_with_z(const ScreenCoordsXY& screenCoo auto vpCoords = viewport->ScreenToViewportCoord(screenCoords); auto mapPosition = viewport_coord_to_map_coord(vpCoords, z); - if (!map_is_location_valid(mapPosition)) + if (!MapIsLocationValid(mapPosition)) { return std::nullopt; } diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index 25d48a962b..df29b56055 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -820,7 +820,7 @@ void window_scroll_to_location(rct_window& w, const CoordsXYZ& coords) window_unfollow_sprite(w); if (w.viewport != nullptr) { - int16_t height = tile_element_height(coords); + int16_t height = TileElementHeight(coords); if (coords.z < height - 16) { if (!(w.viewport->flags & VIEWPORT_FLAG_UNDERGROUND_INSIDE)) @@ -932,7 +932,7 @@ void window_rotate_camera(rct_window& w, int32_t direction) { coords.x = mapXYCoords->x; coords.y = mapXYCoords->y; - coords.z = tile_element_height(coords); + coords.z = TileElementHeight(coords); } gCurrentRotation = (get_current_rotation() + direction) & 3; @@ -965,7 +965,7 @@ void window_viewport_get_map_coords_by_cursor( *map_y = mapCoords.y; // Get viewport coordinates centring around the tile. - int32_t z = tile_element_height(mapCoords); + int32_t z = TileElementHeight(mapCoords); auto centreLoc = centre_2d_coordinates({ mapCoords.x, mapCoords.y, z }, w.viewport); if (!centreLoc) @@ -986,7 +986,7 @@ void window_viewport_get_map_coords_by_cursor( void window_viewport_centre_tile_around_cursor(rct_window& w, int32_t map_x, int32_t map_y, int32_t offset_x, int32_t offset_y) { // Get viewport coordinates centring around the tile. - int32_t z = tile_element_height({ map_x, map_y }); + int32_t z = TileElementHeight({ map_x, map_y }); auto centreLoc = centre_2d_coordinates({ map_x, map_y, z }, w.viewport); if (!centreLoc.has_value()) @@ -1380,8 +1380,8 @@ void tool_cancel() { input_set_flag(INPUT_FLAG_TOOL_ACTIVE, false); - map_invalidate_selection_rect(); - map_invalidate_map_selection_tiles(); + MapInvalidateSelectionRect(); + MapInvalidateMapSelectionTiles(); // Reset map selection gMapSelectFlags = 0; diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index 398856f6ac..c6679d2015 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -219,7 +219,7 @@ std::optional News::GetSubjectLocation(News::ItemType type, int32_t s break; } auto rideViewCentre = ride->overall_view.ToTileCentre(); - subjectLoc = CoordsXYZ{ rideViewCentre, tile_element_height(rideViewCentre) }; + subjectLoc = CoordsXYZ{ rideViewCentre, TileElementHeight(rideViewCentre) }; break; } case News::ItemType::PeepOnRide: @@ -275,7 +275,7 @@ std::optional News::GetSubjectLocation(News::ItemType type, int32_t s static_cast(subjectUnsigned >> 16) }; if (!subjectXY.IsNull()) { - subjectLoc = CoordsXYZ{ subjectXY, tile_element_height(subjectXY) }; + subjectLoc = CoordsXYZ{ subjectXY, TileElementHeight(subjectXY) }; } break; } diff --git a/src/openrct2/paint/Paint.Entity.cpp b/src/openrct2/paint/Paint.Entity.cpp index c4861fbe53..ef99d8aef1 100644 --- a/src/openrct2/paint/Paint.Entity.cpp +++ b/src/openrct2/paint/Paint.Entity.cpp @@ -38,7 +38,7 @@ void EntityPaintSetup(paint_session& session, const CoordsXY& pos) { PROFILED_FUNCTION(); - if (!map_is_location_valid(pos)) + if (!MapIsLocationValid(pos)) { return; } diff --git a/src/openrct2/paint/VirtualFloor.cpp b/src/openrct2/paint/VirtualFloor.cpp index 6597d453a1..8f3087afc3 100644 --- a/src/openrct2/paint/VirtualFloor.cpp +++ b/src/openrct2/paint/VirtualFloor.cpp @@ -239,7 +239,7 @@ static void VirtualFloorGetTileProperties( } } - *tileOwned = map_is_location_owned({ loc, height }); + *tileOwned = MapIsLocationOwned({ loc, height }); if (gCheatsSandboxMode) *tileOwned = true; diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index 838e60e4a6..0c826f8232 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -1055,7 +1055,7 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co tile_descriptor& descriptor = tileDescriptors[i + 1]; descriptor.tile_element = nullptr; - if (!map_is_location_valid(position)) + if (!MapIsLocationValid(position)) { continue; } @@ -1085,7 +1085,7 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co const int16_t x = session.MapPosition.x; const int16_t y = session.MapPosition.y; - int32_t surfaceHeight = tile_element_height({ x + 16, y + 16 }); + int32_t surfaceHeight = TileElementHeight({ x + 16, y + 16 }); int32_t dx = surfaceHeight + 3; int32_t image_id = (SPR_HEIGHT_MARKER_BASE + dx / 16); @@ -1174,7 +1174,7 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co else if (tileElement.GetOwnership() & OWNERSHIP_AVAILABLE) { const CoordsXY& pos = session.MapPosition; - const int32_t height2 = (tile_element_height({ pos.x + 16, pos.y + 16 })) + 3; + const int32_t height2 = (TileElementHeight({ pos.x + 16, pos.y + 16 })) + 3; paint_struct* backup = session.LastPS; PaintAddImageAsParent(session, ImageId(SPR_LAND_OWNERSHIP_AVAILABLE), { 16, 16, height2 }, { 1, 1, 0 }); session.LastPS = backup; @@ -1191,7 +1191,7 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co else if (tileElement.GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) { const CoordsXY& pos = session.MapPosition; - const int32_t height2 = tile_element_height({ pos.x + 16, pos.y + 16 }); + const int32_t height2 = TileElementHeight({ pos.x + 16, pos.y + 16 }); paint_struct* backup = session.LastPS; PaintAddImageAsParent( session, ImageId(SPR_LAND_CONSTRUCTION_RIGHTS_AVAILABLE), { 16, 16, height2 + 3 }, { 1, 1, 0 }); diff --git a/src/openrct2/paint/tile_element/Paint.TileElement.cpp b/src/openrct2/paint/tile_element/Paint.TileElement.cpp index e007d0346d..c2e683f96e 100644 --- a/src/openrct2/paint/tile_element/Paint.TileElement.cpp +++ b/src/openrct2/paint/tile_element/Paint.TileElement.cpp @@ -48,7 +48,7 @@ void TileElementPaintSetup(paint_session& session, const CoordsXY& mapCoords, bo { PROFILED_FUNCTION(); - if (!map_is_edge(mapCoords)) + if (!MapIsEdge(mapCoords)) { PaintUtilSetSegmentSupportHeight(session, SEGMENTS_ALL, 0xFFFF, 0); PaintUtilForceSetGeneralSupportHeight(session, -1, 0); diff --git a/src/openrct2/peep/GuestPathfinding.cpp b/src/openrct2/peep/GuestPathfinding.cpp index 459fd4d5d0..8b66d1ceb1 100644 --- a/src/openrct2/peep/GuestPathfinding.cpp +++ b/src/openrct2/peep/GuestPathfinding.cpp @@ -193,7 +193,7 @@ static int32_t guest_surface_path_finding(Peep& peep) if (!WallInTheWay(pathPos, backwardsDirection)) { - if (!map_surface_is_blocked(pathPos)) + if (!MapSurfaceIsBlocked(pathPos)) { return peep_move_one_tile(randDirection, peep); } @@ -218,7 +218,7 @@ static int32_t guest_surface_path_finding(Peep& peep) if (!WallInTheWay(pathPos, backwardsDirection)) { - if (!map_surface_is_blocked(pathPos)) + if (!MapSurfaceIsBlocked(pathPos)) { return peep_move_one_tile(randDirection, peep); } @@ -238,7 +238,7 @@ static int32_t guest_surface_path_finding(Peep& peep) if (!WallInTheWay(pathPos, backwardsDirection)) { - if (!map_surface_is_blocked(pathPos)) + if (!MapSurfaceIsBlocked(pathPos)) { return peep_move_one_tile(randDirection, peep); } @@ -1747,7 +1747,7 @@ int32_t OriginalPathfinding::GuestPathFindParkEntranceLeaving(Peep& peep, uint8_ if (peep.PeepFlags & PEEP_FLAGS_PARK_ENTRANCE_CHOSEN) { entranceGoal = peep.PathfindGoal; - auto* entranceElement = map_get_park_entrance_element_at(entranceGoal.ToCoordsXYZ(), false); + auto* entranceElement = MapGetParkEntranceElementAt(entranceGoal.ToCoordsXYZ(), false); // If entrance no longer exists, choose a new one if (entranceElement == nullptr) { @@ -1988,7 +1988,7 @@ int32_t OriginalPathfinding::CalculateNextDestination(Guest& peep) TileCoordsXYZ loc{ peep.NextLoc }; - auto* pathElement = map_get_path_element_at(loc); + auto* pathElement = MapGetPathElementAt(loc); if (pathElement == nullptr) { return 1; diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 5a88d57530..890c7f25f6 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -2538,9 +2538,9 @@ namespace RCT1 station.Entrance = entranceCoords; station.Exit = exitCoords; - auto entranceElement = map_get_ride_exit_element_at(entranceCoords.ToCoordsXYZD(), false); + auto entranceElement = MapGetRideExitElementAt(entranceCoords.ToCoordsXYZD(), false); entranceElement->SetEntranceType(ENTRANCE_TYPE_RIDE_ENTRANCE); - auto exitElement = map_get_ride_entrance_element_at(exitCoords.ToCoordsXYZD(), false); + auto exitElement = MapGetRideEntranceElementAt(exitCoords.ToCoordsXYZD(), false); exitElement->SetEntranceType(ENTRANCE_TYPE_RIDE_EXIT); // Trigger footpath update diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index 042a3b8bc2..0c7bf0880b 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -1766,7 +1766,7 @@ Staff* find_closest_mechanic(const CoordsXY& entrancePosition, int32_t forInspec } auto location = entrancePosition.ToTileStart(); - if (map_is_location_in_park(location)) + if (MapIsLocationInPark(location)) if (!peep->IsLocationInPatrol(location)) continue; @@ -2262,7 +2262,7 @@ static bool ride_entrance_exit_is_reachable(const TileCoordsXYZD& coordinates) TileCoordsXYZ loc{ coordinates.x, coordinates.y, coordinates.z }; loc -= TileDirectionDelta[coordinates.direction]; - return map_coord_is_connected(loc, coordinates.direction); + return MapCoordIsConnected(loc, coordinates.direction); } static void ride_entrance_exit_connected(Ride* ride) @@ -2354,7 +2354,7 @@ static void ride_shop_connected(Ride* ride) int32_t y2 = shopLoc.y - TileDirectionDelta[face_direction].y; int32_t x2 = shopLoc.x - TileDirectionDelta[face_direction].x; - if (map_coord_is_connected({ x2, y2, tileElement->base_height }, face_direction)) + if (MapCoordIsConnected({ x2, y2, tileElement->base_height }, face_direction)) return; } @@ -5642,7 +5642,7 @@ void determine_ride_entrance_and_exit_locations() // Skip if the station has no entrance if (!entranceLoc.IsNull()) { - const EntranceElement* entranceElement = map_get_ride_entrance_element_at(entranceLoc.ToCoordsXYZD(), false); + const EntranceElement* entranceElement = MapGetRideEntranceElementAt(entranceLoc.ToCoordsXYZD(), false); if (entranceElement == nullptr || entranceElement->GetRideIndex() != ride.id || entranceElement->GetStationIndex() != stationIndex) @@ -5657,7 +5657,7 @@ void determine_ride_entrance_and_exit_locations() if (!exitLoc.IsNull()) { - const EntranceElement* entranceElement = map_get_ride_exit_element_at(exitLoc.ToCoordsXYZD(), false); + const EntranceElement* entranceElement = MapGetRideExitElementAt(exitLoc.ToCoordsXYZD(), false); if (entranceElement == nullptr || entranceElement->GetRideIndex() != ride.id || entranceElement->GetStationIndex() != stationIndex) @@ -5778,7 +5778,7 @@ void ride_clear_leftover_entrances(Ride* ride) if (entrance->GetRideIndex() != ride->id) continue; - tile_element_remove(entrance->as()); + TileElementRemove(entrance->as()); } } } diff --git a/src/openrct2/ride/RideConstruction.cpp b/src/openrct2/ride/RideConstruction.cpp index 54ffabf74d..46db9a4c89 100644 --- a/src/openrct2/ride/RideConstruction.cpp +++ b/src/openrct2/ride/RideConstruction.cpp @@ -1288,7 +1288,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC // search for TrackElement one tile over, shifted in the search direction auto nextLocation = entranceExitCoords; nextLocation += CoordsDirectionDelta[entranceExitCoords.direction]; - if (map_is_location_valid(nextLocation)) + if (MapIsLocationValid(nextLocation)) { // iterate over every element in the tile until we find what we want auto* tileElement = MapGetFirstElementAt(nextLocation); @@ -1577,7 +1577,7 @@ void Ride::ValidateStations() FootpathRemoveEdgesAt(location, tileElement); FootpathUpdateQueueChains(); map_invalidate_tile_full(location); - tile_element_remove(tileElement); + TileElementRemove(tileElement); tileElement--; } } while (!(tileElement++)->IsLastForTile()); diff --git a/src/openrct2/ride/RideRatings.cpp b/src/openrct2/ride/RideRatings.cpp index 087f7fb581..8f4ba1989c 100644 --- a/src/openrct2/ride/RideRatings.cpp +++ b/src/openrct2/ride/RideRatings.cpp @@ -417,7 +417,7 @@ static void ride_ratings_score_close_proximity_in_direction( RideRatingUpdateState& state, TileElement* inputTileElement, int32_t direction) { auto scorePos = CoordsXY{ CoordsXY{ state.Proximity } + CoordsDirectionDelta[direction] }; - if (!map_is_location_valid(scorePos)) + if (!MapIsLocationValid(scorePos)) return; TileElement* tileElement = MapGetFirstElementAt(scorePos); @@ -1445,7 +1445,7 @@ static int32_t ride_ratings_get_scenery_score(Ride* ride) location = ride->GetStation(stationIndex).Start; } - int32_t z = tile_element_height(location); + int32_t z = TileElementHeight(location); // Check if station is underground, returns a fixed mediocre score since you can't have scenery underground if (z > ride->GetStation(stationIndex).GetBaseZ()) diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 86c262c6a4..1e99b2019b 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -1251,7 +1251,7 @@ static GameActions::Result TrackDesignPlaceSceneryElement( return GameActions::Result(); } - auto* pathElement = map_get_path_element_at(TileCoordsXYZ{ CoordsXYZ{ mapCoord.x, mapCoord.y, z } }); + auto* pathElement = MapGetPathElementAt(TileCoordsXYZ{ CoordsXYZ{ mapCoord.x, mapCoord.y, z } }); if (pathElement == nullptr) { return GameActions::Result(); @@ -1350,7 +1350,7 @@ static GameActions::Result TrackDesignPlaceMaze(TrackDesignState& tds, TrackDesi if (tds.PlaceOperation == PTD_OPERATION_DRAW_OUTLINES) { gMapSelectionTiles.clear(); - gMapSelectArrowPosition = CoordsXYZ{ coords, tile_element_height(coords) }; + gMapSelectArrowPosition = CoordsXYZ{ coords, TileElementHeight(coords) }; gMapSelectArrowDirection = _currentTrackPieceDirection; } @@ -1511,7 +1511,7 @@ static GameActions::Result TrackDesignPlaceMaze(TrackDesignState& tds, TrackDesi if (tds.PlaceOperation == PTD_OPERATION_GET_PLACE_Z) { - if (!map_is_location_valid(mapCoord)) + if (!MapIsLocationValid(mapCoord)) { continue; } @@ -1564,7 +1564,7 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi if (tds.PlaceOperation == PTD_OPERATION_DRAW_OUTLINES) { gMapSelectionTiles.clear(); - gMapSelectArrowPosition = CoordsXYZ{ origin, tile_element_height(origin) }; + gMapSelectArrowPosition = CoordsXYZ{ origin, TileElementHeight(origin) }; gMapSelectArrowDirection = _currentTrackPieceDirection; } @@ -1668,7 +1668,7 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi for (const rct_preview_track* trackBlock = ted.Block; trackBlock->index != 0xFF; trackBlock++) { auto tile = CoordsXY{ newCoords } + CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(rotation); - if (!map_is_location_valid(tile)) + if (!MapIsLocationValid(tile)) { continue; } @@ -1904,7 +1904,7 @@ static GameActions::Result TrackDesignPlaceVirtual( gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_CONSTRUCT; gMapSelectFlags |= MAP_SELECT_FLAG_ENABLE_ARROW; gMapSelectFlags &= ~MAP_SELECT_FLAG_GREEN; - map_invalidate_map_selection_tiles(); + MapInvalidateMapSelectionTiles(); } auto res = GameActions::Result(); diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index a0a77dbe62..42cfdc8a95 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -2619,7 +2619,7 @@ static rct_synchronised_vehicle* _lastSynchronisedVehicle = nullptr; static bool try_add_synchronised_station(const CoordsXYZ& coords) { // make sure we are in map bounds - if (!map_is_location_valid(coords)) + if (!MapIsLocationValid(coords)) { return false; } @@ -5415,8 +5415,8 @@ void Vehicle::UpdateCrash() continue; } - int16_t height = tile_element_height(curPos); - int16_t waterHeight = tile_element_water_height(curPos); + int16_t height = TileElementHeight(curPos); + int16_t waterHeight = TileElementWaterHeight(curPos); int16_t zDiff; if (waterHeight != 0) { @@ -5442,7 +5442,7 @@ void Vehicle::UpdateCrash() curPos.z += static_cast(curVehicle->crash_z >> 8); curVehicle->TrackLocation = { (curVehicle->crash_x << 8), (curVehicle->crash_y << 8), (curVehicle->crash_z << 8) }; - if (!map_is_location_valid(curPos)) + if (!MapIsLocationValid(curPos)) { curVehicle->CrashOnLand(); continue; @@ -6844,7 +6844,7 @@ static void play_scenery_door_close_sound(const CoordsXYZ& loc, WallElement* til template static void AnimateSceneryDoor(const CoordsXYZD& doorLocation, const CoordsXYZ& trackLocation, bool isLastVehicle) { - auto door = map_get_wall_element_at(doorLocation); + auto door = MapGetWallElementAt(doorLocation); if (door == nullptr) { return; @@ -7320,7 +7320,7 @@ void Vehicle::Sub6DBF3E() _vehicleMotionTrackFlags |= VEHICLE_UPDATE_MOTION_TRACK_FLAG_3; TileElement* tileElement = nullptr; - if (map_is_location_valid(TrackLocation)) + if (MapIsLocationValid(TrackLocation)) { tileElement = map_get_track_element_at_of_type_seq(TrackLocation, trackType, 0); } @@ -9201,7 +9201,7 @@ void Vehicle::UpdateCrossings() const while (true) { - auto* pathElement = map_get_path_element_at(TileCoordsXYZ(CoordsXYZ{ xyElement, xyElement.element->GetBaseZ() })); + auto* pathElement = MapGetPathElementAt(TileCoordsXYZ(CoordsXYZ{ xyElement, xyElement.element->GetBaseZ() })); auto curRide = GetRide(); // Many New Element parks have invisible rides hacked into the path. @@ -9263,7 +9263,7 @@ void Vehicle::UpdateCrossings() const uint8_t freeCount = travellingForwards ? 3 : 1; while (freeCount-- > 0) { - auto* pathElement = map_get_path_element_at(TileCoordsXYZ(CoordsXYZ{ xyElement, xyElement.element->GetBaseZ() })); + auto* pathElement = MapGetPathElementAt(TileCoordsXYZ(CoordsXYZ{ xyElement, xyElement.element->GetBaseZ() })); if (pathElement != nullptr) { pathElement->SetIsBlockedByVehicle(false); diff --git a/src/openrct2/scenario/Scenario.cpp b/src/openrct2/scenario/Scenario.cpp index 7e2387cdad..44bd6e0f0a 100644 --- a/src/openrct2/scenario/Scenario.cpp +++ b/src/openrct2/scenario/Scenario.cpp @@ -443,12 +443,12 @@ bool scenario_create_ducks() centrePos.x = SquareRadiusSize + (scenario_rand_max(gMapSize.x - SquareCentre) * 32); centrePos.y = SquareRadiusSize + (scenario_rand_max(gMapSize.y - SquareCentre) * 32); - Guard::Assert(map_is_location_valid(centrePos)); + Guard::Assert(MapIsLocationValid(centrePos)); - if (!map_is_location_in_park(centrePos)) + if (!MapIsLocationInPark(centrePos)) return false; - int32_t centreWaterZ = (tile_element_water_height(centrePos)); + int32_t centreWaterZ = (TileElementWaterHeight(centrePos)); if (centreWaterZ == 0) return false; @@ -458,13 +458,13 @@ bool scenario_create_ducks() { for (int32_t x = 0; x < SquareSize; x++) { - if (!map_is_location_valid(innerPos)) + if (!MapIsLocationValid(innerPos)) continue; - if (!map_is_location_in_park(innerPos)) + if (!MapIsLocationInPark(innerPos)) continue; - int32_t waterZ = (tile_element_water_height(innerPos)); + int32_t waterZ = (TileElementWaterHeight(innerPos)); if (waterZ == centreWaterZ) waterTiles++; @@ -491,7 +491,7 @@ bool scenario_create_ducks() CoordsXY targetPos{ centrePos.x + innerPos.x - SquareRadiusSize, centrePos.y + innerPos.y - SquareRadiusSize }; - Guard::Assert(map_is_location_valid(targetPos)); + Guard::Assert(MapIsLocationValid(targetPos)); Duck::Create(targetPos); } diff --git a/src/openrct2/scripting/bindings/world/ScTile.cpp b/src/openrct2/scripting/bindings/world/ScTile.cpp index e5b6a08536..89acddb65c 100644 --- a/src/openrct2/scripting/bindings/world/ScTile.cpp +++ b/src/openrct2/scripting/bindings/world/ScTile.cpp @@ -105,7 +105,7 @@ namespace OpenRCT2::Scripting auto numToInsert = numElements - currentNumElements; for (size_t i = 0; i < numToInsert; i++) { - tile_element_insert(pos, 0, TileElementType::Surface); + TileElementInsert(pos, 0, TileElementType::Surface); } // Copy data to element span @@ -150,7 +150,7 @@ namespace OpenRCT2::Scripting std::vector data(first, first + origNumElements); auto pos = TileCoordsXYZ(TileCoordsXY(_coords), 0).ToCoordsXYZ(); - auto newElement = tile_element_insert(pos, 0, TileElementType::Surface); + auto newElement = TileElementInsert(pos, 0, TileElementType::Surface); if (newElement == nullptr) { auto ctx = GetDukContext(); @@ -195,7 +195,7 @@ namespace OpenRCT2::Scripting auto first = GetFirstElement(); if (index < GetNumElements(first)) { - tile_element_remove(&first[index]); + TileElementRemove(&first[index]); map_invalidate_tile_full(_coords); } } diff --git a/src/openrct2/title/Command/SetLocation.cpp b/src/openrct2/title/Command/SetLocation.cpp index c5548f453f..67c52b56a8 100644 --- a/src/openrct2/title/Command/SetLocation.cpp +++ b/src/openrct2/title/Command/SetLocation.cpp @@ -22,7 +22,7 @@ namespace OpenRCT2::Title if (w != nullptr) { auto loc = TileCoordsXY(Location.X, Location.Y).ToCoordsXY().ToTileCentre(); - int32_t z = tile_element_height(loc); + int32_t z = TileElementHeight(loc); // Prevent scroll adjustment due to window placement when in-game auto oldScreenFlags = gScreenFlags; diff --git a/src/openrct2/world/ConstructionClearance.cpp b/src/openrct2/world/ConstructionClearance.cpp index 6647c197c3..ce463abf5f 100644 --- a/src/openrct2/world/ConstructionClearance.cpp +++ b/src/openrct2/world/ConstructionClearance.cpp @@ -47,7 +47,7 @@ static int32_t MapPlaceClearFunc( map_invalidate_tile({ coords, (*tile_element)->GetBaseZ(), (*tile_element)->GetClearanceZ() }); - tile_element_remove(*tile_element); + TileElementRemove(*tile_element); (*tile_element)--; return 0; @@ -124,7 +124,7 @@ GameActions::Result MapCanConstructWithClearAt( res.SetData(ConstructClearResult{ groundFlags }); bool canBuildCrossing = false; - if (map_is_edge(pos)) + if (MapIsEdge(pos)) { res.Error = GameActions::Status::InvalidParameters; res.ErrorMessage = STR_OFF_EDGE_OF_MAP; diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index 96b1b34b9b..fed2001622 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -214,7 +214,7 @@ void ParkEntranceFixLocations(void) gParkEntrances.erase( std::remove_if( gParkEntrances.begin(), gParkEntrances.end(), - [](const auto& entrance) { return map_get_park_entrance_element_at(entrance, false) == nullptr; }), + [](const auto& entrance) { return MapGetParkEntranceElementAt(entrance, false) == nullptr; }), gParkEntrances.end()); } diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index cbcd93d28a..71777d5a4d 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -282,7 +282,7 @@ CoordsXY FootpathGetCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32 { if (info.SpriteType != ViewportInteractionItem::Footpath) { - z = tile_element_height(position); + z = TileElementHeight(position); } position = viewport_coord_to_map_coord(start_vp_pos, z); position.x = std::clamp(position.x, minPosition.x, maxPosition.x); @@ -463,7 +463,7 @@ bool WallInTheWay(const CoordsXYRangedZ& fencePos, int32_t direction) static PathElement* FootpathConnectCornersGetNeighbour(const CoordsXYZ& footpathPos, int32_t requireEdges) { - if (!map_is_location_valid(footpathPos)) + if (!MapIsLocationValid(footpathPos)) { return nullptr; } @@ -825,7 +825,7 @@ static void loc_6A6D7E( rct_neighbour_list* neighbourList) { auto targetPos = CoordsXY{ initialTileElementPos } + CoordsDirectionDelta[direction]; - if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && map_is_edge(targetPos)) + if (((gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) || gCheatsSandboxMode) && MapIsEdge(targetPos)) { if (query) { @@ -1397,7 +1397,7 @@ static int32_t FootpathIsConnectedToMapEdgeHelper(CoordsXYZ footpathPos, int32_t // Return immediately if we are at the edge of the map and not unowning // Or if we are unowning and have no tiles left - if ((map_is_edge(targetPos) && !(flags & FOOTPATH_CONNECTED_MAP_EDGE_UNOWN))) + if ((MapIsEdge(targetPos) && !(flags & FOOTPATH_CONNECTED_MAP_EDGE_UNOWN))) { return FOOTPATH_SEARCH_SUCCESS; } @@ -2109,7 +2109,7 @@ static void FootpathRemoveEdgesTowardsHere( */ static void FootpathRemoveEdgesTowards(const CoordsXYRangedZ& footPathPos, int32_t direction, bool isQueue) { - if (!map_is_location_valid(footPathPos)) + if (!MapIsLocationValid(footPathPos)) { return; } diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 43609e31c8..af0554afcc 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -389,7 +389,7 @@ TileElement* MapGetFirstTileElementWithBaseHeightBetween(const TileCoordsXYRange void MapSetTileElement(const TileCoordsXY& tilePos, TileElement* elements) { - if (!map_is_location_valid(tilePos.ToCoordsXY())) + if (!MapIsLocationValid(tilePos.ToCoordsXY())) { log_error("Trying to access element outside of range"); return; @@ -404,7 +404,7 @@ SurfaceElement* MapGetSurfaceElementAt(const CoordsXY& coords) return *view.begin(); } -PathElement* map_get_path_element_at(const TileCoordsXYZ& loc) +PathElement* MapGetPathElementAt(const TileCoordsXYZ& loc) { for (auto* element : TileElementsView(loc.ToCoordsXY())) { @@ -517,10 +517,10 @@ void MapStripGhostFlagFromElements() * dx: return remember to & with 0xFFFF if you don't want water affecting results * rct2: 0x00662783 */ -int16_t tile_element_height(const CoordsXY& loc) +int16_t TileElementHeight(const CoordsXY& loc) { // Off the map - if (!map_is_location_valid(loc)) + if (!MapIsLocationValid(loc)) return MINIMUM_LAND_HEIGHT_BIG; // Get the surface element for the tile @@ -654,10 +654,10 @@ int16_t tile_element_height(const CoordsXY& loc) return height; } -int16_t tile_element_water_height(const CoordsXY& loc) +int16_t TileElementWaterHeight(const CoordsXY& loc) { // Off the map - if (!map_is_location_valid(loc)) + if (!MapIsLocationValid(loc)) return 0; // Get the surface element for the tile @@ -675,7 +675,7 @@ int16_t tile_element_water_height(const CoordsXY& loc) * Checks if the tile at coordinate at height counts as connected. * @return 1 if connected, 0 otherwise */ -bool map_coord_is_connected(const TileCoordsXYZ& loc, uint8_t faceDirection) +bool MapCoordIsConnected(const TileCoordsXYZ& loc, uint8_t faceDirection) { TileElement* tileElement = MapGetFirstElementAt(loc); @@ -715,7 +715,7 @@ bool map_coord_is_connected(const TileCoordsXYZ& loc, uint8_t faceDirection) * * rct2: 0x006A876D */ -void map_update_path_wide_flags() +void MapUpdatePathWideFlags() { PROFILED_FUNCTION(); @@ -772,26 +772,26 @@ int32_t MapHeightFromSlope(const CoordsXY& coords, int32_t slopeDirection, bool return 0; } -bool map_is_location_valid(const CoordsXY& coords) +bool MapIsLocationValid(const CoordsXY& coords) { const bool is_x_valid = coords.x < MAXIMUM_MAP_SIZE_BIG && coords.x >= 0; const bool is_y_valid = coords.y < MAXIMUM_MAP_SIZE_BIG && coords.y >= 0; return is_x_valid && is_y_valid; } -bool map_is_edge(const CoordsXY& coords) +bool MapIsEdge(const CoordsXY& coords) { auto mapSizeUnits = GetMapSizeUnits(); return (coords.x < 32 || coords.y < 32 || coords.x >= mapSizeUnits.x || coords.y >= mapSizeUnits.y); } -bool map_can_build_at(const CoordsXYZ& loc) +bool MapCanBuildAt(const CoordsXYZ& loc) { if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) return true; if (gCheatsSandboxMode) return true; - if (map_is_location_owned(loc)) + if (MapIsLocationOwned(loc)) return true; return false; } @@ -800,10 +800,10 @@ bool map_can_build_at(const CoordsXYZ& loc) * * rct2: 0x00664F72 */ -bool map_is_location_owned(const CoordsXYZ& loc) +bool MapIsLocationOwned(const CoordsXYZ& loc) { // This check is to avoid throwing lots of messages in logs. - if (map_is_location_valid(loc)) + if (MapIsLocationValid(loc)) { auto* surfaceElement = MapGetSurfaceElementAt(loc); if (surfaceElement != nullptr) @@ -825,9 +825,9 @@ bool map_is_location_owned(const CoordsXYZ& loc) * * rct2: 0x00664F2C */ -bool map_is_location_in_park(const CoordsXY& coords) +bool MapIsLocationInPark(const CoordsXY& coords) { - if (map_is_location_valid(coords)) + if (MapIsLocationValid(coords)) { auto surfaceElement = MapGetSurfaceElementAt(coords); if (surfaceElement == nullptr) @@ -838,9 +838,9 @@ bool map_is_location_in_park(const CoordsXY& coords) return false; } -bool map_is_location_owned_or_has_rights(const CoordsXY& loc) +bool MapIsLocationOwnedOrHasRights(const CoordsXY& loc) { - if (map_is_location_valid(loc)) + if (MapIsLocationValid(loc)) { auto surfaceElement = MapGetSurfaceElementAt(loc); if (surfaceElement == nullptr) @@ -997,7 +997,7 @@ int32_t tile_element_get_corner_height(const SurfaceElement* surfaceElement, int return map_get_corner_height(z, slope, direction); } -uint8_t map_get_lowest_land_height(const MapRange& range) +uint8_t MapGetLowestLandHeight(const MapRange& range) { auto mapSizeMax = GetMapSizeMaxXY(); MapRange validRange = { std::max(range.GetLeft(), 32), std::max(range.GetTop(), 32), @@ -1014,7 +1014,7 @@ uint8_t map_get_lowest_land_height(const MapRange& range) { if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(CoordsXY{ xi, yi })) + if (!MapIsLocationInPark(CoordsXY{ xi, yi })) { continue; } @@ -1027,7 +1027,7 @@ uint8_t map_get_lowest_land_height(const MapRange& range) return min_height; } -uint8_t map_get_highest_land_height(const MapRange& range) +uint8_t MapGetHighestLandHeight(const MapRange& range) { auto mapSizeMax = GetMapSizeMaxXY(); MapRange validRange = { std::max(range.GetLeft(), 32), std::max(range.GetTop(), 32), @@ -1043,7 +1043,7 @@ uint8_t map_get_highest_land_height(const MapRange& range) { if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) { - if (!map_is_location_in_park(CoordsXY{ xi, yi })) + if (!MapIsLocationInPark(CoordsXY{ xi, yi })) { continue; } @@ -1071,7 +1071,7 @@ bool map_is_location_at_edge(const CoordsXY& loc) * * rct2: 0x0068B280 */ -void tile_element_remove(TileElement* tileElement) +void TileElementRemove(TileElement* tileElement) { // Replace Nth element by (N+1)th element. // This loop will make tileElement point to the old last element position, @@ -1098,7 +1098,7 @@ void tile_element_remove(TileElement* tileElement) * * rct2: 0x00675A8E */ -void map_remove_all_rides() +void MapRemoveAllRides() { tile_element_iterator it; @@ -1121,7 +1121,7 @@ void map_remove_all_rides() case TileElementType::Track: FootpathQueueChainReset(); FootpathRemoveEdgesAt(TileCoordsXY{ it.x, it.y }.ToCoordsXY(), it.element); - tile_element_remove(it.element); + TileElementRemove(it.element); tile_element_iterator_restart_for_tile(&it); break; default: @@ -1134,7 +1134,7 @@ void map_remove_all_rides() * * rct2: 0x0068AB1B */ -void map_invalidate_map_selection_tiles() +void MapInvalidateMapSelectionTiles() { if (!(gMapSelectFlags & MAP_SELECT_FLAG_ENABLE_CONSTRUCT)) return; @@ -1176,7 +1176,7 @@ static void map_get_bounding_box(const MapRange& _range, int32_t* left, int32_t* * * rct2: 0x0068AAE1 */ -void map_invalidate_selection_rect() +void MapInvalidateSelectionRect() { int32_t x0, y0, x1, y1, left, right, top, bottom; @@ -1225,7 +1225,7 @@ static TileElement* AllocateTileElements(size_t numElementsOnTile, size_t numNew * * rct2: 0x0068B1F6 */ -TileElement* tile_element_insert(const CoordsXYZ& loc, int32_t occupiedQuadrants, TileElementType type) +TileElement* TileElementInsert(const CoordsXYZ& loc, int32_t occupiedQuadrants, TileElementType type) { const auto& tileLoc = TileCoordsXYZ(loc); @@ -1344,7 +1344,7 @@ void map_update_tiles() } } -void map_remove_provisional_elements() +void MapRemoveProvisionalElements() { PROFILED_FUNCTION(); @@ -1367,7 +1367,7 @@ void map_remove_provisional_elements() } } -void map_restore_provisional_elements() +void MapRestoreProvisionalElements() { PROFILED_FUNCTION(); @@ -1547,7 +1547,7 @@ static void clear_element_at(const CoordsXY& loc, TileElement** elementPtr) // If asking nicely did not work, forcibly remove this to avoid an infinite loop. if (result.Error != GameActions::Status::Ok) { - tile_element_remove(element); + TileElementRemove(element); } break; } @@ -1559,7 +1559,7 @@ static void clear_element_at(const CoordsXY& loc, TileElement** elementPtr) // If asking nicely did not work, forcibly remove this to avoid an infinite loop. if (result.Error != GameActions::Status::Ok) { - tile_element_remove(element); + TileElementRemove(element); } } break; @@ -1571,7 +1571,7 @@ static void clear_element_at(const CoordsXY& loc, TileElement** elementPtr) // If asking nicely did not work, forcibly remove this to avoid an infinite loop. if (result.Error != GameActions::Status::Ok) { - tile_element_remove(element); + TileElementRemove(element); } } break; @@ -1583,12 +1583,12 @@ static void clear_element_at(const CoordsXY& loc, TileElement** elementPtr) // If asking nicely did not work, forcibly remove this to avoid an infinite loop. if (result.Error != GameActions::Status::Ok) { - tile_element_remove(element); + TileElementRemove(element); } break; } default: - tile_element_remove(element); + TileElementRemove(element); break; } } @@ -1660,7 +1660,7 @@ LargeSceneryElement* map_get_large_scenery_segment(const CoordsXYZD& sceneryPos, return nullptr; } -EntranceElement* map_get_park_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost) +EntranceElement* MapGetParkEntranceElementAt(const CoordsXYZ& entranceCoords, bool ghost) { auto entranceTileCoords = TileCoordsXYZ(entranceCoords); TileElement* tileElement = MapGetFirstElementAt(entranceCoords); @@ -1686,7 +1686,7 @@ EntranceElement* map_get_park_entrance_element_at(const CoordsXYZ& entranceCoord return nullptr; } -EntranceElement* map_get_ride_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost) +EntranceElement* MapGetRideEntranceElementAt(const CoordsXYZ& entranceCoords, bool ghost) { auto entranceTileCoords = TileCoordsXYZ{ entranceCoords }; TileElement* tileElement = MapGetFirstElementAt(entranceCoords); @@ -1712,7 +1712,7 @@ EntranceElement* map_get_ride_entrance_element_at(const CoordsXYZ& entranceCoord return nullptr; } -EntranceElement* map_get_ride_exit_element_at(const CoordsXYZ& exitCoords, bool ghost) +EntranceElement* MapGetRideExitElementAt(const CoordsXYZ& exitCoords, bool ghost) { auto exitTileCoords = TileCoordsXYZ{ exitCoords }; TileElement* tileElement = MapGetFirstElementAt(exitCoords); @@ -1738,7 +1738,7 @@ EntranceElement* map_get_ride_exit_element_at(const CoordsXYZ& exitCoords, bool return nullptr; } -SmallSceneryElement* map_get_small_scenery_element_at(const CoordsXYZ& sceneryCoords, int32_t type, uint8_t quadrant) +SmallSceneryElement* MapGetSmallSceneryElementAt(const CoordsXYZ& sceneryCoords, int32_t type, uint8_t quadrant) { auto sceneryTileCoords = TileCoordsXYZ{ sceneryCoords }; TileElement* tileElement = MapGetFirstElementAt(sceneryCoords); @@ -1933,9 +1933,9 @@ int32_t map_get_tile_quadrant(const CoordsXY& mapPos) * * rct2: 0x00693BFF */ -bool map_surface_is_blocked(const CoordsXY& mapCoords) +bool MapSurfaceIsBlocked(const CoordsXY& mapCoords) { - if (!map_is_location_valid(mapCoords)) + if (!MapIsLocationValid(mapCoords)) return true; auto surfaceElement = MapGetSurfaceElementAt(mapCoords); @@ -2205,7 +2205,7 @@ TileElement* map_get_track_element_at_with_direction_from_ride(const CoordsXYZD& return nullptr; }; -WallElement* map_get_wall_element_at(const CoordsXYRangedZ& coords) +WallElement* MapGetWallElementAt(const CoordsXYRangedZ& coords) { auto tileElement = MapGetFirstElementAt(coords); @@ -2224,7 +2224,7 @@ WallElement* map_get_wall_element_at(const CoordsXYRangedZ& coords) return nullptr; } -WallElement* map_get_wall_element_at(const CoordsXYZD& wallCoords) +WallElement* MapGetWallElementAt(const CoordsXYZD& wallCoords) { auto tileWallCoords = TileCoordsXYZ(wallCoords); TileElement* tileElement = MapGetFirstElementAt(wallCoords); diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index d06b202c0c..8a223379e0 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -169,34 +169,34 @@ void MapSetTileElement(const TileCoordsXY& tilePos, TileElement* elements); int32_t MapHeightFromSlope(const CoordsXY& coords, int32_t slopeDirection, bool isSloped); BannerElement* MapGetBannerElementAt(const CoordsXYZ& bannerPos, uint8_t direction); SurfaceElement* MapGetSurfaceElementAt(const CoordsXY& coords); -PathElement* map_get_path_element_at(const TileCoordsXYZ& loc); -WallElement* map_get_wall_element_at(const CoordsXYZD& wallCoords); -WallElement* map_get_wall_element_at(const CoordsXYRangedZ& coords); -SmallSceneryElement* map_get_small_scenery_element_at(const CoordsXYZ& sceneryCoords, int32_t type, uint8_t quadrant); -EntranceElement* map_get_park_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost); -EntranceElement* map_get_ride_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost); -EntranceElement* map_get_ride_exit_element_at(const CoordsXYZ& exitCoords, bool ghost); -int16_t tile_element_height(const CoordsXY& loc); -int16_t tile_element_water_height(const CoordsXY& loc); -uint8_t map_get_highest_land_height(const MapRange& range); -uint8_t map_get_lowest_land_height(const MapRange& range); -bool map_coord_is_connected(const TileCoordsXYZ& loc, uint8_t faceDirection); -void map_remove_provisional_elements(); -void map_restore_provisional_elements(); -void map_update_path_wide_flags(); -bool map_is_location_valid(const CoordsXY& coords); -bool map_is_edge(const CoordsXY& coords); -bool map_can_build_at(const CoordsXYZ& loc); -bool map_is_location_owned(const CoordsXYZ& loc); -bool map_is_location_in_park(const CoordsXY& coords); -bool map_is_location_owned_or_has_rights(const CoordsXY& loc); -bool map_surface_is_blocked(const CoordsXY& mapCoords); -void tile_element_remove(TileElement* tileElement); -void map_remove_all_rides(); -void map_invalidate_map_selection_tiles(); -void map_invalidate_selection_rect(); +PathElement* MapGetPathElementAt(const TileCoordsXYZ& loc); +WallElement* MapGetWallElementAt(const CoordsXYZD& wallCoords); +WallElement* MapGetWallElementAt(const CoordsXYRangedZ& coords); +SmallSceneryElement* MapGetSmallSceneryElementAt(const CoordsXYZ& sceneryCoords, int32_t type, uint8_t quadrant); +EntranceElement* MapGetParkEntranceElementAt(const CoordsXYZ& entranceCoords, bool ghost); +EntranceElement* MapGetRideEntranceElementAt(const CoordsXYZ& entranceCoords, bool ghost); +EntranceElement* MapGetRideExitElementAt(const CoordsXYZ& exitCoords, bool ghost); +uint8_t MapGetHighestLandHeight(const MapRange& range); +uint8_t MapGetLowestLandHeight(const MapRange& range); +bool MapCoordIsConnected(const TileCoordsXYZ& loc, uint8_t faceDirection); +void MapRemoveProvisionalElements(); +void MapRestoreProvisionalElements(); +void MapUpdatePathWideFlags(); +bool MapIsLocationValid(const CoordsXY& coords); +bool MapIsEdge(const CoordsXY& coords); +bool MapCanBuildAt(const CoordsXYZ& loc); +bool MapIsLocationOwned(const CoordsXYZ& loc); +bool MapIsLocationInPark(const CoordsXY& coords); +bool MapIsLocationOwnedOrHasRights(const CoordsXY& loc); +bool MapSurfaceIsBlocked(const CoordsXY& mapCoords); +void MapRemoveAllRides(); +void MapInvalidateMapSelectionTiles(); +void MapInvalidateSelectionRect(); bool MapCheckCapacityAndReorganise(const CoordsXY& loc, size_t numElements = 1); -TileElement* tile_element_insert(const CoordsXYZ& loc, int32_t occupiedQuadrants, TileElementType type); +int16_t TileElementHeight(const CoordsXY& loc); +int16_t TileElementWaterHeight(const CoordsXY& loc); +void TileElementRemove(TileElement* tileElement); +TileElement* TileElementInsert(const CoordsXYZ& loc, int32_t occupiedQuadrants, TileElementType type); template T* MapGetFirstTileElementWithBaseHeightBetween(const TileCoordsXYRangedZ& loc) { @@ -206,7 +206,7 @@ template T* MapGetFirstTileElementWithBaseHeightBetwee template T* TileElementInsert(const CoordsXYZ& loc, int32_t occupiedQuadrants) { - auto* element = tile_element_insert(loc, occupiedQuadrants, T::ElementType); + auto* element = TileElementInsert(loc, occupiedQuadrants, T::ElementType); return (element != nullptr) ? element->template as() : nullptr; } diff --git a/src/openrct2/world/MapGen.cpp b/src/openrct2/world/MapGen.cpp index 1a9b049ef4..64befbe128 100644 --- a/src/openrct2/world/MapGen.cpp +++ b/src/openrct2/world/MapGen.cpp @@ -259,7 +259,7 @@ static void MapGenPlaceTree(ObjectEntryIndex type, const CoordsXY& loc) return; } - int32_t surfaceZ = tile_element_height(loc.ToTileCentre()); + int32_t surfaceZ = TileElementHeight(loc.ToTileCentre()); auto* sceneryElement = TileElementInsert({ loc, surfaceZ }, 0b1111); Guard::Assert(sceneryElement != nullptr); diff --git a/src/openrct2/world/Park.cpp b/src/openrct2/world/Park.cpp index b599deddb4..bd28a5b116 100644 --- a/src/openrct2/world/Park.cpp +++ b/src/openrct2/world/Park.cpp @@ -104,7 +104,7 @@ void ParkSetOpen(bool open) */ void ParkUpdateFences(const CoordsXY& coords) { - if (map_is_edge(coords)) + if (MapIsEdge(coords)) return; auto surfaceElement = MapGetSurfaceElementAt(coords); @@ -137,22 +137,22 @@ void ParkUpdateFences(const CoordsXY& coords) if (fenceRequired) { - if (map_is_location_in_park({ coords.x - COORDS_XY_STEP, coords.y })) + if (MapIsLocationInPark({ coords.x - COORDS_XY_STEP, coords.y })) { newFences |= 0x8; } - if (map_is_location_in_park({ coords.x, coords.y - COORDS_XY_STEP })) + if (MapIsLocationInPark({ coords.x, coords.y - COORDS_XY_STEP })) { newFences |= 0x4; } - if (map_is_location_in_park({ coords.x + COORDS_XY_STEP, coords.y })) + if (MapIsLocationInPark({ coords.x + COORDS_XY_STEP, coords.y })) { newFences |= 0x2; } - if (map_is_location_in_park({ coords.x, coords.y + COORDS_XY_STEP })) + if (MapIsLocationInPark({ coords.x, coords.y + COORDS_XY_STEP })) { newFences |= 0x1; } diff --git a/src/openrct2/world/Surface.cpp b/src/openrct2/world/Surface.cpp index 139564b993..8d7726b418 100644 --- a/src/openrct2/world/Surface.cpp +++ b/src/openrct2/world/Surface.cpp @@ -122,7 +122,7 @@ void SurfaceElement::UpdateGrassLength(const CoordsXY& coords) uint8_t grassLengthTmp = GrassLength & 7; // Check if grass is underwater or outside park - if (GetWaterHeight() > GetBaseZ() || !map_is_location_in_park(coords)) + if (GetWaterHeight() > GetBaseZ() || !MapIsLocationInPark(coords)) { if (grassLengthTmp != GRASS_LENGTH_CLEAR_0) SetGrassLengthAndInvalidate(GRASS_LENGTH_CLEAR_0, coords); diff --git a/src/openrct2/world/TileElementBase.cpp b/src/openrct2/world/TileElementBase.cpp index 50066035e1..d5ea3f84ed 100644 --- a/src/openrct2/world/TileElementBase.cpp +++ b/src/openrct2/world/TileElementBase.cpp @@ -82,7 +82,7 @@ void TileElementBase::SetGhost(bool isGhost) void TileElementBase::Remove() { - tile_element_remove(static_cast(this)); + TileElementRemove(static_cast(this)); } uint8_t TileElementBase::GetOccupiedQuadrants() const diff --git a/src/openrct2/world/TileInspector.cpp b/src/openrct2/world/TileInspector.cpp index b149d56930..a874a9176b 100644 --- a/src/openrct2/world/TileInspector.cpp +++ b/src/openrct2/world/TileInspector.cpp @@ -162,7 +162,7 @@ namespace OpenRCT2::TileInspector tileElement->RemoveBannerEntry(); } - tile_element_remove(tileElement); + TileElementRemove(tileElement); map_invalidate_tile_full(loc); if (auto* inspector = GetTileInspectorWithPos(loc); inspector != nullptr) @@ -353,8 +353,7 @@ namespace OpenRCT2::TileInspector // The occupiedQuadrants will be automatically set when the element is copied over, so it's not necessary to set // them correctly _here_. - TileElement* const pastedElement = tile_element_insert( - { loc, element.GetBaseZ() }, 0b0000, TileElementType::Surface); + TileElement* const pastedElement = TileElementInsert({ loc, element.GetBaseZ() }, 0b0000, TileElementType::Surface); bool lastForTile = pastedElement->IsLastForTile(); *pastedElement = element; diff --git a/src/openrct2/world/Wall.cpp b/src/openrct2/world/Wall.cpp index a92fa46923..50fbab8f51 100644 --- a/src/openrct2/world/Wall.cpp +++ b/src/openrct2/world/Wall.cpp @@ -34,12 +34,11 @@ */ void WallRemoveAt(const CoordsXYRangedZ& wallPos) { - for (auto wallElement = map_get_wall_element_at(wallPos); wallElement != nullptr; - wallElement = map_get_wall_element_at(wallPos)) + for (auto wallElement = MapGetWallElementAt(wallPos); wallElement != nullptr; wallElement = MapGetWallElementAt(wallPos)) { reinterpret_cast(wallElement)->RemoveBannerEntry(); map_invalidate_tile_zoom1({ wallPos, wallElement->GetBaseZ(), wallElement->GetBaseZ() + 72 }); - tile_element_remove(reinterpret_cast(wallElement)); + TileElementRemove(reinterpret_cast(wallElement)); } } @@ -76,7 +75,7 @@ void WallRemoveIntersectingWalls(const CoordsXYRangedZ& wallPos, Direction direc tileElement->RemoveBannerEntry(); map_invalidate_tile_zoom1({ wallPos, tileElement->GetBaseZ(), tileElement->GetBaseZ() + 72 }); - tile_element_remove(tileElement); + TileElementRemove(tileElement); tileElement--; } while (!(tileElement++)->IsLastForTile()); } diff --git a/test/tests/TileElements.cpp b/test/tests/TileElements.cpp index 2e1c25c7cc..a88503919c 100644 --- a/test/tests/TileElements.cpp +++ b/test/tests/TileElements.cpp @@ -103,8 +103,7 @@ TEST_F(TileElementWantsFootpathConnection, Stall) TEST_F(TileElementWantsFootpathConnection, RideEntrance) { // Ride entrances and exits want a connection in one direction - const EntranceElement* const entranceElement = map_get_ride_entrance_element_at( - TileCoordsXYZ{ 18, 8, 14 }.ToCoordsXYZ(), false); + const EntranceElement* const entranceElement = MapGetRideEntranceElementAt(TileCoordsXYZ{ 18, 8, 14 }.ToCoordsXYZ(), false); ASSERT_NE(entranceElement, nullptr); EXPECT_TRUE(TileElementWantsPathConnectionTowards({ 18, 8, 14, 0 }, nullptr)); EXPECT_FALSE(TileElementWantsPathConnectionTowards({ 18, 8, 14, 1 }, nullptr)); @@ -116,7 +115,7 @@ TEST_F(TileElementWantsFootpathConnection, RideEntrance) TEST_F(TileElementWantsFootpathConnection, RideExit) { // The exit has been rotated; it wants a path connection in direction 1, but not 0 like the entrance - const EntranceElement* const exitElement = map_get_ride_exit_element_at(TileCoordsXYZ{ 18, 10, 14 }.ToCoordsXYZ(), false); + const EntranceElement* const exitElement = MapGetRideExitElementAt(TileCoordsXYZ{ 18, 10, 14 }.ToCoordsXYZ(), false); ASSERT_NE(exitElement, nullptr); EXPECT_FALSE(TileElementWantsPathConnectionTowards({ 18, 10, 14, 0 }, nullptr)); EXPECT_TRUE(TileElementWantsPathConnectionTowards({ 18, 10, 14, 1 }, nullptr));