Code style: Remove snakes from everything world apart from Map.h (#18273)

* Remove remaining snakes from world (outside of map)

* Initial few desnaking of Map.h
This commit is contained in:
Duncan 2022-10-11 19:39:24 +01:00 committed by GitHub
parent 0c78a27d9f
commit 67bbc8560d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
90 changed files with 404 additions and 404 deletions

View File

@ -520,7 +520,7 @@ static void ShortcutToggleVisibility()
return; return;
extern TileCoordsXY windowTileInspectorTile; extern TileCoordsXY windowTileInspectorTile;
TileElement* tileElement = map_get_nth_element_at(windowTileInspectorTile.ToCoordsXY(), windowTileInspectorSelectedIndex); TileElement* tileElement = MapGetNthElementAt(windowTileInspectorTile.ToCoordsXY(), windowTileInspectorSelectedIndex);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
tileElement->SetInvisible(!tileElement->IsInvisible()); tileElement->SetInvisible(!tileElement->IsInvisible());

View File

@ -622,7 +622,7 @@ static void ViewportInteractionRemoveFootpath(TileElement* tileElement, const Co
if (w != nullptr) if (w != nullptr)
FootpathProvisionalUpdate(); FootpathProvisionalUpdate();
tileElement2 = map_get_first_element_at(mapCoords); tileElement2 = MapGetFirstElementAt(mapCoords);
if (tileElement2 == nullptr) if (tileElement2 == nullptr)
return; return;
do do

View File

@ -199,7 +199,7 @@ namespace OpenRCT2::Scripting
else if (info.Element != nullptr) else if (info.Element != nullptr)
{ {
int32_t index = 0; int32_t index = 0;
auto el = map_get_first_element_at(info.Loc); auto el = MapGetFirstElementAt(info.Loc);
if (el != nullptr) if (el != nullptr)
{ {
do do

View File

@ -100,7 +100,7 @@ private:
return nullptr; return nullptr;
} }
TileElement* tileElement = map_get_first_element_at(banner->position); TileElement* tileElement = MapGetFirstElementAt(banner->position);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
return nullptr; return nullptr;

View File

@ -1123,7 +1123,7 @@ private:
z = std::min(255 * COORDS_Z_STEP, gFootpathConstructFromPosition.z); z = std::min(255 * COORDS_Z_STEP, gFootpathConstructFromPosition.z);
zLow = z - PATH_HEIGHT_STEP; zLow = z - PATH_HEIGHT_STEP;
tileElement = map_get_first_element_at(gFootpathConstructFromPosition); tileElement = MapGetFirstElementAt(gFootpathConstructFromPosition);
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)

View File

@ -458,7 +458,7 @@ public:
if (parkEntranceMapPosition.IsNull()) if (parkEntranceMapPosition.IsNull())
return parkEntranceMapPosition; return parkEntranceMapPosition;
auto surfaceElement = map_get_surface_element_at(mapCoords); auto surfaceElement = MapGetSurfaceElementAt(mapCoords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
parkEntranceMapPosition.SetNull(); parkEntranceMapPosition.SetNull();
@ -1066,7 +1066,7 @@ private:
uint16_t GetPixelColourPeep(const CoordsXY& c) uint16_t GetPixelColourPeep(const CoordsXY& c)
{ {
auto* surfaceElement = map_get_surface_element_at(c); auto* surfaceElement = MapGetSurfaceElementAt(c);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
return 0; return 0;
@ -1109,7 +1109,7 @@ private:
uint16_t colourB = MapColour(PALETTE_INDEX_13); // surface colour (dark grey) uint16_t colourB = MapColour(PALETTE_INDEX_13); // surface colour (dark grey)
// as an improvement we could use first_element to show underground stuff? // as an improvement we could use first_element to show underground stuff?
TileElement* tileElement = reinterpret_cast<TileElement*>(map_get_surface_element_at(c)); TileElement* tileElement = reinterpret_cast<TileElement*>(MapGetSurfaceElementAt(c));
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)

View File

@ -2673,16 +2673,16 @@ private:
auto southTileCoords = centreTileCoords + TileDirectionDelta[TILE_ELEMENT_DIRECTION_SOUTH]; auto southTileCoords = centreTileCoords + TileDirectionDelta[TILE_ELEMENT_DIRECTION_SOUTH];
// Replace map elements with temporary ones containing track // Replace map elements with temporary ones containing track
backupTileElementArrays[0] = map_get_first_element_at(centreTileCoords); backupTileElementArrays[0] = MapGetFirstElementAt(centreTileCoords);
backupTileElementArrays[1] = map_get_first_element_at(eastTileCoords); backupTileElementArrays[1] = MapGetFirstElementAt(eastTileCoords);
backupTileElementArrays[2] = map_get_first_element_at(westTileCoords); backupTileElementArrays[2] = MapGetFirstElementAt(westTileCoords);
backupTileElementArrays[3] = map_get_first_element_at(northTileCoords); backupTileElementArrays[3] = MapGetFirstElementAt(northTileCoords);
backupTileElementArrays[4] = map_get_first_element_at(southTileCoords); backupTileElementArrays[4] = MapGetFirstElementAt(southTileCoords);
map_set_tile_element(centreTileCoords, &tempTrackTileElement); MapSetTileElement(centreTileCoords, &tempTrackTileElement);
map_set_tile_element(eastTileCoords, &tempSideTrackTileElement); MapSetTileElement(eastTileCoords, &tempSideTrackTileElement);
map_set_tile_element(westTileCoords, &tempSideTrackTileElement); MapSetTileElement(westTileCoords, &tempSideTrackTileElement);
map_set_tile_element(northTileCoords, &tempSideTrackTileElement); MapSetTileElement(northTileCoords, &tempSideTrackTileElement);
map_set_tile_element(southTileCoords, &tempSideTrackTileElement); MapSetTileElement(southTileCoords, &tempSideTrackTileElement);
// Set the temporary track element // Set the temporary track element
tempTrackTileElement.SetOccupiedQuadrants(quarterTile.GetBaseQuarterOccupied()); tempTrackTileElement.SetOccupiedQuadrants(quarterTile.GetBaseQuarterOccupied());
@ -2694,11 +2694,11 @@ private:
TileElementPaintSetup(*session, coords, true); TileElementPaintSetup(*session, coords, true);
// Restore map elements // Restore map elements
map_set_tile_element(centreTileCoords, backupTileElementArrays[0]); MapSetTileElement(centreTileCoords, backupTileElementArrays[0]);
map_set_tile_element(eastTileCoords, backupTileElementArrays[1]); MapSetTileElement(eastTileCoords, backupTileElementArrays[1]);
map_set_tile_element(westTileCoords, backupTileElementArrays[2]); MapSetTileElement(westTileCoords, backupTileElementArrays[2]);
map_set_tile_element(northTileCoords, backupTileElementArrays[3]); MapSetTileElement(northTileCoords, backupTileElementArrays[3]);
map_set_tile_element(southTileCoords, backupTileElementArrays[4]); MapSetTileElement(southTileCoords, backupTileElementArrays[4]);
trackBlock++; trackBlock++;
} }
@ -2982,7 +2982,7 @@ static std::optional<CoordsXY> RideGetPlacePositionFromScreenPosition(ScreenCoor
_trackPlaceZ = 0; _trackPlaceZ = 0;
if (_trackPlaceShiftState) if (_trackPlaceShiftState)
{ {
auto surfaceElement = map_get_surface_element_at(mapCoords); auto surfaceElement = MapGetSurfaceElementAt(mapCoords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
return std::nullopt; return std::nullopt;
auto mapZ = floor2(surfaceElement->GetBaseZ(), 16); auto mapZ = floor2(surfaceElement->GetBaseZ(), 16);

View File

@ -428,7 +428,7 @@ public:
} }
else else
{ // small scenery { // small scenery
gCurrentToolId = static_cast<Tool>(get_small_scenery_entry(tabSelectedScenery.EntryIndex)->tool_id); gCurrentToolId = static_cast<Tool>(GetSmallSceneryEntry(tabSelectedScenery.EntryIndex)->tool_id);
} }
} }
} }
@ -530,7 +530,7 @@ public:
widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = WindowWidgetType::FlatBtn; widgets[WIDX_SCENERY_BUILD_CLUSTER_BUTTON].type = WindowWidgetType::FlatBtn;
} }
auto* sceneryEntry = get_small_scenery_entry(tabSelectedScenery.EntryIndex); auto* sceneryEntry = GetSmallSceneryEntry(tabSelectedScenery.EntryIndex);
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE)) if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_ROTATABLE))
{ {
widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WindowWidgetType::FlatBtn; widgets[WIDX_SCENERY_ROTATE_OBJECTS_BUTTON].type = WindowWidgetType::FlatBtn;
@ -601,7 +601,7 @@ public:
} }
else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_SMALL) else if (tabSelectedScenery.SceneryType == SCENERY_TYPE_SMALL)
{ {
auto* sceneryEntry = get_small_scenery_entry(tabSelectedScenery.EntryIndex); auto* sceneryEntry = GetSmallSceneryEntry(tabSelectedScenery.EntryIndex);
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS)) if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR | SMALL_SCENERY_FLAG_HAS_GLASS))
{ {
@ -775,7 +775,7 @@ public:
// small scenery // small scenery
for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_SMALL_SCENERY_OBJECTS; sceneryId++) for (ObjectEntryIndex sceneryId = 0; sceneryId < MAX_SMALL_SCENERY_OBJECTS; sceneryId++)
{ {
const auto* sceneryEntry = get_small_scenery_entry(sceneryId); const auto* sceneryEntry = GetSmallSceneryEntry(sceneryId);
if (sceneryEntry != nullptr) if (sceneryEntry != nullptr)
{ {
InitSceneryEntry({ SCENERY_TYPE_SMALL, sceneryId }, sceneryEntry->scenery_tab_id); InitSceneryEntry({ SCENERY_TYPE_SMALL, sceneryId }, sceneryEntry->scenery_tab_id);
@ -1121,7 +1121,7 @@ private:
{ {
case SCENERY_TYPE_SMALL: case SCENERY_TYPE_SMALL:
{ {
auto* sceneryEntry = get_small_scenery_entry(selectedScenery.EntryIndex); auto* sceneryEntry = GetSmallSceneryEntry(selectedScenery.EntryIndex);
if (sceneryEntry != nullptr) if (sceneryEntry != nullptr)
{ {
price = sceneryEntry->price; price = sceneryEntry->price;
@ -1254,7 +1254,7 @@ private:
} }
else else
{ {
auto sceneryEntry = get_small_scenery_entry(scenerySelection.EntryIndex); auto sceneryEntry = GetSmallSceneryEntry(scenerySelection.EntryIndex);
auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation); auto imageId = ImageId(sceneryEntry->image + gWindowSceneryRotation);
if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR)) if (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_HAS_PRIMARY_COLOUR))
{ {

View File

@ -1551,7 +1551,7 @@ public:
int32_t i = 0; int32_t i = 0;
char buffer[256]; char buffer[256];
const TileElement* tileElement = map_get_first_element_at(_toolMap); const TileElement* tileElement = MapGetFirstElementAt(_toolMap);
do do
{ {
@ -1775,7 +1775,7 @@ private:
windowTileInspectorSelectedIndex = -1; windowTileInspectorSelectedIndex = -1;
scrolls[0].v_top = 0; scrolls[0].v_top = 0;
TileElement* element = map_get_first_element_at(_toolMap); TileElement* element = MapGetFirstElementAt(_toolMap);
int16_t numItems = 0; int16_t numItems = 0;
do do
{ {
@ -1967,7 +1967,7 @@ private:
openrct2_assert( openrct2_assert(
windowTileInspectorSelectedIndex >= 0 && windowTileInspectorSelectedIndex < windowTileInspectorElementCount, windowTileInspectorSelectedIndex >= 0 && windowTileInspectorSelectedIndex < windowTileInspectorElementCount,
"Selected list item out of range"); "Selected list item out of range");
return map_get_first_element_at(_toolMap) + windowTileInspectorSelectedIndex; return MapGetFirstElementAt(_toolMap) + windowTileInspectorSelectedIndex;
} }
void OnPrepareDraw() override void OnPrepareDraw() override

View File

@ -1103,7 +1103,7 @@ static void SceneryEyedropperToolDown(const ScreenCoordsXY& windowPos, WidgetInd
{ {
SmallSceneryElement* sceneryElement = info.Element->AsSmallScenery(); SmallSceneryElement* sceneryElement = info.Element->AsSmallScenery();
auto entryIndex = sceneryElement->GetEntryIndex(); auto entryIndex = sceneryElement->GetEntryIndex();
auto* sceneryEntry = get_small_scenery_entry(entryIndex); auto* sceneryEntry = GetSmallSceneryEntry(entryIndex);
if (sceneryEntry != nullptr) if (sceneryEntry != nullptr)
{ {
WindowScenerySetSelectedItem( WindowScenerySetSelectedItem(
@ -1256,7 +1256,7 @@ static void Sub6E1F34SmallScenery(
uint16_t maxPossibleHeight = ZoomLevel::max().ApplyTo(std::numeric_limits<decltype(TileElement::base_height)>::max() - 32); uint16_t maxPossibleHeight = ZoomLevel::max().ApplyTo(std::numeric_limits<decltype(TileElement::base_height)>::max() - 32);
bool can_raise_item = false; bool can_raise_item = false;
const auto* sceneryEntry = get_small_scenery_entry(sceneryIndex); const auto* sceneryEntry = GetSmallSceneryEntry(sceneryIndex);
if (sceneryEntry == nullptr) if (sceneryEntry == nullptr)
{ {
gridPos.SetNull(); gridPos.SetNull();
@ -1292,7 +1292,7 @@ static void Sub6E1F34SmallScenery(
// If SHIFT pressed // If SHIFT pressed
if (gSceneryShiftPressed) if (gSceneryShiftPressed)
{ {
auto* surfaceElement = map_get_surface_element_at(gridPos); auto* surfaceElement = MapGetSurfaceElementAt(gridPos);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
@ -1375,7 +1375,7 @@ static void Sub6E1F34SmallScenery(
// If SHIFT pressed // If SHIFT pressed
if (gSceneryShiftPressed) if (gSceneryShiftPressed)
{ {
auto surfaceElement = map_get_surface_element_at(gridPos); auto surfaceElement = MapGetSurfaceElementAt(gridPos);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
@ -1510,7 +1510,7 @@ static void Sub6E1F34Wall(
// If SHIFT pressed // If SHIFT pressed
if (gSceneryShiftPressed) if (gSceneryShiftPressed)
{ {
auto* surfaceElement = map_get_surface_element_at(gridPos); auto* surfaceElement = MapGetSurfaceElementAt(gridPos);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
@ -1601,7 +1601,7 @@ static void Sub6E1F34LargeScenery(
// If SHIFT pressed // If SHIFT pressed
if (gSceneryShiftPressed) if (gSceneryShiftPressed)
{ {
auto* surfaceElement = map_get_surface_element_at(gridPos); auto* surfaceElement = MapGetSurfaceElementAt(gridPos);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
@ -1768,7 +1768,7 @@ static void WindowTopToolbarSceneryToolDown(const ScreenCoordsXY& windowPos, rct
for (int32_t q = 0; q < quantity; q++) for (int32_t q = 0; q < quantity; q++)
{ {
int32_t zCoordinate = gSceneryPlaceZ; int32_t zCoordinate = gSceneryPlaceZ;
auto* sceneryEntry = get_small_scenery_entry(selectedScenery); auto* sceneryEntry = GetSmallSceneryEntry(selectedScenery);
int16_t cur_grid_x = gridPos.x; int16_t cur_grid_x = gridPos.x;
int16_t cur_grid_y = gridPos.y; int16_t cur_grid_y = gridPos.y;
@ -2671,7 +2671,7 @@ static void TopToolbarToolUpdateScenery(const ScreenCoordsXY& screenPos)
gMapSelectPositionB.y = mapTile.y; gMapSelectPositionB.y = mapTile.y;
} }
auto* sceneryEntry = get_small_scenery_entry(selection.EntryIndex); auto* sceneryEntry = GetSmallSceneryEntry(selection.EntryIndex);
gMapSelectType = MAP_SELECT_TYPE_FULL; gMapSelectType = MAP_SELECT_TYPE_FULL;
if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE) && !gWindowSceneryScatterEnabled) if (!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE) && !gWindowSceneryScatterEnabled)

View File

@ -402,7 +402,7 @@ private:
int32_t GetBaseZ(const CoordsXY& loc) int32_t GetBaseZ(const CoordsXY& loc)
{ {
auto surfaceElement = map_get_surface_element_at(loc); auto surfaceElement = MapGetSurfaceElementAt(loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
return 0; return 0;

View File

@ -413,7 +413,7 @@ void game_fix_save_vars()
{ {
for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++)
{ {
auto* surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto* surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {

View File

@ -63,7 +63,7 @@ void GameState::InitAll(const TileCoordsXY& mapSize)
gInMapInitCode = true; gInMapInitCode = true;
gCurrentTicks = 0; gCurrentTicks = 0;
map_init(mapSize); MapInit(mapSize);
_park->Initialise(); _park->Initialise();
finance_init(); finance_init();
BannerInit(); BannerInit();

View File

@ -79,7 +79,7 @@ GameActions::Result BannerPlaceAction::Query() const
} }
auto baseHeight = _loc.z + PATH_HEIGHT_STEP; auto baseHeight = _loc.z + PATH_HEIGHT_STEP;
BannerElement* existingBannerElement = map_get_banner_element_at({ _loc.x, _loc.y, baseHeight }, _loc.direction); BannerElement* existingBannerElement = MapGetBannerElementAt({ _loc.x, _loc.y, baseHeight }, _loc.direction);
if (existingBannerElement != nullptr) if (existingBannerElement != nullptr)
{ {
return GameActions::Result( return GameActions::Result(

View File

@ -75,7 +75,7 @@ GameActions::Result BannerSetColourAction::QueryExecute(bool isExecuting) const
return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK); return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_REPAINT_THIS, STR_LAND_NOT_OWNED_BY_PARK);
} }
auto bannerElement = map_get_banner_element_at(_loc, _loc.direction); auto bannerElement = MapGetBannerElementAt(_loc, _loc.direction);
if (bannerElement == nullptr) if (bannerElement == nullptr)
{ {

View File

@ -116,7 +116,7 @@ money32 ClearAction::ClearSceneryFromTile(const CoordsXY& tilePos, bool executin
do do
{ {
tileEdited = false; tileEdited = false;
tileElement = map_get_first_element_at(tilePos); tileElement = MapGetFirstElementAt(tilePos);
if (tileElement == nullptr) if (tileElement == nullptr)
return totalCost; return totalCost;
do do
@ -211,7 +211,7 @@ void ClearAction::ResetClearLargeSceneryFlag()
{ {
for (int32_t x = 0; x < gMapSize.x; x++) for (int32_t x = 0; x < gMapSize.x; x++)
{ {
auto tileElement = map_get_first_element_at(TileCoordsXY{ x, y }); auto tileElement = MapGetFirstElementAt(TileCoordsXY{ x, y });
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)

View File

@ -135,10 +135,10 @@ GameActions::Result FootpathPlaceAction::Execute() const
// It is possible, let's remove walls between the old and new piece of path // It is possible, let's remove walls between the old and new piece of path
auto zLow = _loc.z; auto zLow = _loc.z;
auto zHigh = zLow + PATH_CLEARANCE; auto zHigh = zLow + PATH_CLEARANCE;
wall_remove_intersecting_walls( WallRemoveIntersectingWalls(
{ _loc, zLow, zHigh + ((_slope & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK) ? 16 : 0) }, { _loc, zLow, zHigh + ((_slope & TILE_ELEMENT_SURFACE_RAISED_CORNERS_MASK) ? 16 : 0) },
DirectionReverse(_direction)); DirectionReverse(_direction));
wall_remove_intersecting_walls( WallRemoveIntersectingWalls(
{ _loc.x - CoordsDirectionDelta[_direction].x, _loc.y - CoordsDirectionDelta[_direction].y, zLow, zHigh }, { _loc.x - CoordsDirectionDelta[_direction].x, _loc.y - CoordsDirectionDelta[_direction].y, zLow, zHigh },
_direction); _direction);
} }
@ -318,7 +318,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertQuery(GameActions::Result
GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_CANT_BUILD_THIS_UNDERWATER); GameActions::Status::Disallowed, STR_CANT_BUILD_FOOTPATH_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
} }
auto surfaceElement = map_get_surface_element_at(_loc); auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE);
@ -381,7 +381,7 @@ GameActions::Result FootpathPlaceAction::ElementInsertExecute(GameActions::Resul
const auto clearanceData = canBuild.GetData<ConstructClearResult>(); const auto clearanceData = canBuild.GetData<ConstructClearResult>();
gFootpathGroundFlags = clearanceData.GroundFlags; gFootpathGroundFlags = clearanceData.GroundFlags;
auto surfaceElement = map_get_surface_element_at(_loc); auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_FOOTPATH_HERE, STR_NONE);
@ -489,8 +489,8 @@ void FootpathPlaceAction::RemoveIntersectingWalls(PathElement* pathElement) cons
{ {
auto direction = pathElement->GetSlopeDirection(); auto direction = pathElement->GetSlopeDirection();
int32_t z = pathElement->GetBaseZ(); int32_t z = pathElement->GetBaseZ();
wall_remove_intersecting_walls({ _loc, z, z + (6 * COORDS_Z_STEP) }, DirectionReverse(direction)); WallRemoveIntersectingWalls({ _loc, z, z + (6 * COORDS_Z_STEP) }, DirectionReverse(direction));
wall_remove_intersecting_walls({ _loc, z, z + (6 * COORDS_Z_STEP) }, direction); WallRemoveIntersectingWalls({ _loc, z, z + (6 * COORDS_Z_STEP) }, direction);
// Removing walls may have made the pointer invalid, so find it again // Removing walls may have made the pointer invalid, so find it again
auto tileElement = MapGetFootpathElement(CoordsXYZ(_loc, z)); auto tileElement = MapGetFootpathElement(CoordsXYZ(_loc, z));
if (tileElement == nullptr) if (tileElement == nullptr)

View File

@ -160,7 +160,7 @@ GameActions::Result FootpathPlaceFromTrackAction::ElementInsertQuery(GameActions
GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER); GameActions::Status::Disallowed, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_CANT_BUILD_THIS_UNDERWATER);
} }
auto surfaceElement = map_get_surface_element_at(_loc); auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
return GameActions::Result( return GameActions::Result(
@ -224,7 +224,7 @@ GameActions::Result FootpathPlaceFromTrackAction::ElementInsertExecute(GameActio
const auto clearanceData = canBuild.GetData<ConstructClearResult>(); const auto clearanceData = canBuild.GetData<ConstructClearResult>();
gFootpathGroundFlags = clearanceData.GroundFlags; gFootpathGroundFlags = clearanceData.GroundFlags;
auto surfaceElement = map_get_surface_element_at(_loc); auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
return GameActions::Result( return GameActions::Result(

View File

@ -95,7 +95,7 @@ GameActions::Result LandBuyRightsAction::QueryExecute(bool isExecuting) const
} }
if (isExecuting) if (isExecuting)
{ {
map_count_remaining_land_rights(); MapCountRemainingLandRights();
} }
return res; return res;
} }
@ -108,7 +108,7 @@ GameActions::Result LandBuyRightsAction::map_buy_land_rights_for_tile(const Coor
return GameActions::Result(GameActions::Status::InvalidParameters, _ErrorTitles[0], STR_NONE); return GameActions::Result(GameActions::Status::InvalidParameters, _ErrorTitles[0], STR_NONE);
} }
SurfaceElement* surfaceElement = map_get_surface_element_at(loc); SurfaceElement* surfaceElement = MapGetSurfaceElementAt(loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
log_error("Could not find surface. x = %d, y = %d", loc.x, loc.y); log_error("Could not find surface. x = %d, y = %d", loc.x, loc.y);

View File

@ -81,7 +81,7 @@ GameActions::Result LandLowerAction::QueryExecute(bool isExecuting) const
{ {
if (!LocationValid({ x, y })) if (!LocationValid({ x, y }))
continue; continue;
auto* surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;

View File

@ -82,7 +82,7 @@ GameActions::Result LandRaiseAction::QueryExecute(bool isExecuting) const
{ {
if (!LocationValid({ x, y })) if (!LocationValid({ x, y }))
continue; continue;
auto* surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;

View File

@ -93,7 +93,7 @@ GameActions::Result LandSetHeightAction::Query() const
} }
} }
auto* surfaceElement = map_get_surface_element_at(_coords); auto* surfaceElement = MapGetSurfaceElementAt(_coords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -149,12 +149,12 @@ GameActions::Result LandSetHeightAction::Execute() const
if (!gCheatsDisableClearanceChecks) if (!gCheatsDisableClearanceChecks)
{ {
wall_remove_at({ _coords, _height * 8 - 16, _height * 8 + 32 }); WallRemoveAt({ _coords, _height * 8 - 16, _height * 8 + 32 });
cost += GetSmallSceneryRemovalCost(); cost += GetSmallSceneryRemovalCost();
SmallSceneryRemoval(); SmallSceneryRemoval();
} }
auto* surfaceElement = map_get_surface_element_at(_coords); auto* surfaceElement = MapGetSurfaceElementAt(_coords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -246,7 +246,7 @@ money32 LandSetHeightAction::GetSmallSceneryRemovalCost() const
void LandSetHeightAction::SmallSceneryRemoval() const void LandSetHeightAction::SmallSceneryRemoval() const
{ {
TileElement* tileElement = map_get_first_element_at(_coords); TileElement* tileElement = MapGetFirstElementAt(_coords);
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)

View File

@ -97,7 +97,7 @@ GameActions::Result LandSetRightsAction::QueryExecute(bool isExecuting) const
if (isExecuting) if (isExecuting)
{ {
map_count_remaining_land_rights(); MapCountRemainingLandRights();
OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, centre); OpenRCT2::Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, centre);
} }
return res; return res;
@ -105,7 +105,7 @@ GameActions::Result LandSetRightsAction::QueryExecute(bool isExecuting) const
GameActions::Result LandSetRightsAction::map_buy_land_rights_for_tile(const CoordsXY& loc, bool isExecuting) const GameActions::Result LandSetRightsAction::map_buy_land_rights_for_tile(const CoordsXY& loc, bool isExecuting) const
{ {
SurfaceElement* surfaceElement = map_get_surface_element_at(loc); SurfaceElement* surfaceElement = MapGetSurfaceElementAt(loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
log_error("Could not find surface. x = %d, y = %d", loc.x, loc.y); log_error("Could not find surface. x = %d, y = %d", loc.x, loc.y);

View File

@ -99,8 +99,8 @@ money32 LandSmoothAction::SmoothLandRowByEdge(
{ {
return 0; return 0;
} }
auto surfaceElement = map_get_surface_element_at(loc); auto surfaceElement = MapGetSurfaceElementAt(loc);
auto nextSurfaceElement = map_get_surface_element_at(CoordsXY{ loc.x + stepX, loc.y + stepY }); auto nextSurfaceElement = MapGetSurfaceElementAt(CoordsXY{ loc.x + stepX, loc.y + stepY });
if (surfaceElement == nullptr || nextSurfaceElement == nullptr) if (surfaceElement == nullptr || nextSurfaceElement == nullptr)
{ {
return 0; return 0;
@ -138,7 +138,7 @@ money32 LandSmoothAction::SmoothLandRowByEdge(
else else
{ {
surfaceElement = nextSurfaceElement; surfaceElement = nextSurfaceElement;
nextSurfaceElement = map_get_surface_element_at(CoordsXY{ nextLoc.x + stepX, nextLoc.y + stepY }); nextSurfaceElement = MapGetSurfaceElementAt(CoordsXY{ nextLoc.x + stepX, nextLoc.y + stepY });
if (nextSurfaceElement == nullptr) if (nextSurfaceElement == nullptr)
{ {
shouldContinue &= ~0x3; shouldContinue &= ~0x3;
@ -251,8 +251,8 @@ money32 LandSmoothAction::SmoothLandRowByCorner(
{ {
return 0; return 0;
} }
auto surfaceElement = map_get_surface_element_at(loc); auto surfaceElement = MapGetSurfaceElementAt(loc);
auto nextSurfaceElement = map_get_surface_element_at(CoordsXY{ loc.x + stepX, loc.y + stepY }); auto nextSurfaceElement = MapGetSurfaceElementAt(CoordsXY{ loc.x + stepX, loc.y + stepY });
if (surfaceElement == nullptr || nextSurfaceElement == nullptr) if (surfaceElement == nullptr || nextSurfaceElement == nullptr)
{ {
return 0; return 0;
@ -281,7 +281,7 @@ money32 LandSmoothAction::SmoothLandRowByCorner(
else else
{ {
surfaceElement = nextSurfaceElement; surfaceElement = nextSurfaceElement;
nextSurfaceElement = map_get_surface_element_at(CoordsXY{ nextLoc.x + stepX, nextLoc.y + stepY }); nextSurfaceElement = MapGetSurfaceElementAt(CoordsXY{ nextLoc.x + stepX, nextLoc.y + stepY });
if (nextSurfaceElement == nullptr) if (nextSurfaceElement == nullptr)
{ {
shouldContinue = false; shouldContinue = false;
@ -347,7 +347,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const
// Smooth the 4 corners // Smooth the 4 corners
{ // top-left { // top-left
auto surfaceElement = map_get_surface_element_at(CoordsXY{ validRange.GetLeft(), validRange.GetTop() }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetLeft(), validRange.GetTop() });
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
int32_t z = std::clamp( int32_t z = std::clamp(
@ -357,7 +357,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const
} }
} }
{ // bottom-left { // bottom-left
auto surfaceElement = map_get_surface_element_at(CoordsXY{ validRange.GetLeft(), validRange.GetBottom() }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetLeft(), validRange.GetBottom() });
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
int32_t z = std::clamp( int32_t z = std::clamp(
@ -367,7 +367,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const
} }
} }
{ // bottom-right { // bottom-right
auto surfaceElement = map_get_surface_element_at(CoordsXY{ validRange.GetRight(), validRange.GetBottom() }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetRight(), validRange.GetBottom() });
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
int32_t z = std::clamp( int32_t z = std::clamp(
@ -377,7 +377,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const
} }
} }
{ // top-right { // top-right
auto surfaceElement = map_get_surface_element_at(CoordsXY{ validRange.GetRight(), validRange.GetTop() }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetRight(), validRange.GetTop() });
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
int32_t z = std::clamp( int32_t z = std::clamp(
@ -391,7 +391,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const
int32_t z1, z2; int32_t z1, z2;
for (int32_t y = validRange.GetTop(); y <= validRange.GetBottom(); y += COORDS_XY_STEP) for (int32_t y = validRange.GetTop(); y <= validRange.GetBottom(); y += COORDS_XY_STEP)
{ {
auto surfaceElement = map_get_surface_element_at(CoordsXY{ validRange.GetLeft(), y }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetLeft(), y });
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
z1 = std::clamp( z1 = std::clamp(
@ -401,7 +401,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const
res.Cost += SmoothLandRowByEdge(isExecuting, { validRange.GetLeft(), y }, z1, z2, -32, 0, 0, 1, 3, 2); res.Cost += SmoothLandRowByEdge(isExecuting, { validRange.GetLeft(), y }, z1, z2, -32, 0, 0, 1, 3, 2);
} }
surfaceElement = map_get_surface_element_at(CoordsXY{ validRange.GetRight(), y }); surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetRight(), y });
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
z1 = std::clamp( z1 = std::clamp(
@ -414,7 +414,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const
for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += COORDS_XY_STEP) for (int32_t x = validRange.GetLeft(); x <= validRange.GetRight(); x += COORDS_XY_STEP)
{ {
auto surfaceElement = map_get_surface_element_at(CoordsXY{ x, validRange.GetTop() }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, validRange.GetTop() });
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
z1 = std::clamp( z1 = std::clamp(
@ -424,7 +424,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const
res.Cost += SmoothLandRowByEdge(isExecuting, { x, validRange.GetTop() }, z1, z2, 0, -32, 0, 3, 1, 2); res.Cost += SmoothLandRowByEdge(isExecuting, { x, validRange.GetTop() }, z1, z2, 0, -32, 0, 3, 1, 2);
} }
surfaceElement = map_get_surface_element_at(CoordsXY{ x, validRange.GetBottom() }); surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, validRange.GetBottom() });
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
z1 = std::clamp( z1 = std::clamp(
@ -441,7 +441,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const
case MAP_SELECT_TYPE_CORNER_2: case MAP_SELECT_TYPE_CORNER_2:
case MAP_SELECT_TYPE_CORNER_3: case MAP_SELECT_TYPE_CORNER_3:
{ {
auto surfaceElement = map_get_surface_element_at(CoordsXY{ validRange.GetLeft(), validRange.GetTop() }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetLeft(), validRange.GetTop() });
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
break; break;
uint8_t newBaseZ = surfaceElement->base_height; uint8_t newBaseZ = surfaceElement->base_height;
@ -537,7 +537,7 @@ GameActions::Result LandSmoothAction::SmoothLand(bool isExecuting) const
{ {
// TODO: Handle smoothing by edge // TODO: Handle smoothing by edge
// Get the two corners to raise // Get the two corners to raise
auto surfaceElement = map_get_surface_element_at(CoordsXY{ validRange.GetLeft(), validRange.GetTop() }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ validRange.GetLeft(), validRange.GetTop() });
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
break; break;
uint8_t newBaseZ = surfaceElement->base_height; uint8_t newBaseZ = surfaceElement->base_height;

View File

@ -277,7 +277,7 @@ GameActions::Result LargeSceneryPlaceAction::Execute() const
FootpathRemoveLitter({ curTile, zLow }); FootpathRemoveLitter({ curTile, zLow });
if (!gCheatsDisableClearanceChecks) if (!gCheatsDisableClearanceChecks)
{ {
wall_remove_at({ curTile, zLow, zHigh }); WallRemoveAt({ curTile, zLow, zHigh });
} }
} }
@ -351,7 +351,7 @@ int16_t LargeSceneryPlaceAction::GetMaxSurfaceHeight(rct_large_scenery_tile* til
continue; continue;
} }
auto* surfaceElement = map_get_surface_element_at(curTile); auto* surfaceElement = MapGetSurfaceElementAt(curTile);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;

View File

@ -63,7 +63,7 @@ GameActions::Result MazePlaceTrackAction::Query() const
res.ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED; res.ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED;
return res; return res;
} }
auto surfaceElement = map_get_surface_element_at(_loc); auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
res.Error = GameActions::Status::Unknown; res.Error = GameActions::Status::Unknown;
@ -145,7 +145,7 @@ GameActions::Result MazePlaceTrackAction::Execute() const
if (!(flags & GAME_COMMAND_FLAG_GHOST)) if (!(flags & GAME_COMMAND_FLAG_GHOST))
{ {
FootpathRemoveLitter(_loc); FootpathRemoveLitter(_loc);
wall_remove_at({ _loc.ToTileStart(), _loc.z, _loc.z + 32 }); WallRemoveAt({ _loc.ToTileStart(), _loc.z, _loc.z + 32 });
} }
auto baseHeight = _loc.z; auto baseHeight = _loc.z;

View File

@ -74,7 +74,7 @@ GameActions::Result MazeSetTrackAction::Query() const
res.ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED; res.ErrorMessage = STR_TILE_ELEMENT_LIMIT_REACHED;
return res; return res;
} }
auto surfaceElement = map_get_surface_element_at(_loc); auto surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
res.Error = GameActions::Status::Unknown; res.Error = GameActions::Status::Unknown;
@ -167,7 +167,7 @@ GameActions::Result MazeSetTrackAction::Execute() const
if (!(flags & GAME_COMMAND_FLAG_GHOST)) if (!(flags & GAME_COMMAND_FLAG_GHOST))
{ {
FootpathRemoveLitter(_loc); FootpathRemoveLitter(_loc);
wall_remove_at({ _loc.ToTileStart(), _loc.z, _loc.z + 32 }); WallRemoveAt({ _loc.ToTileStart(), _loc.z, _loc.z + 32 });
} }
auto tileElement = map_get_track_element_at_of_type_from_ride(_loc, TrackElemType::Maze, _rideIndex); auto tileElement = map_get_track_element_at_of_type_from_ride(_loc, TrackElemType::Maze, _rideIndex);

View File

@ -131,7 +131,7 @@ GameActions::Result PlaceParkEntranceAction::Execute() const
if (!(flags & GAME_COMMAND_FLAG_GHOST)) if (!(flags & GAME_COMMAND_FLAG_GHOST))
{ {
SurfaceElement* surfaceElement = map_get_surface_element_at(entranceLoc); SurfaceElement* surfaceElement = MapGetSurfaceElementAt(entranceLoc);
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
surfaceElement->SetOwnership(OWNERSHIP_UNOWNED); surfaceElement->SetOwnership(OWNERSHIP_UNOWNED);

View File

@ -63,7 +63,7 @@ GameActions::Result PlacePeepSpawnAction::Query() const
} }
// Verify location is unowned // Verify location is unowned
auto surfaceMapElement = map_get_surface_element_at(_location); auto surfaceMapElement = MapGetSurfaceElementAt(_location);
if (surfaceMapElement == nullptr) if (surfaceMapElement == nullptr)
{ {
return GameActions::Result(GameActions::Status::Unknown, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_ERR_CANT_PLACE_PEEP_SPAWN_HERE, STR_NONE);

View File

@ -206,7 +206,7 @@ money32 RideDemolishAction::DemolishTracks() const
while (!lastForTileReached) while (!lastForTileReached)
{ {
offset++; offset++;
auto* tileElement = map_get_first_element_at(tileCoords) + offset; auto* tileElement = MapGetFirstElementAt(tileCoords) + offset;
if (tileElement == nullptr) if (tileElement == nullptr)
break; break;

View File

@ -165,7 +165,7 @@ GameActions::Result RideEntranceExitPlaceAction::Execute() const
if (!(GetFlags() & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST)) if (!(GetFlags() & GAME_COMMAND_FLAG_ALLOW_DURING_PAUSED) && !(GetFlags() & GAME_COMMAND_FLAG_GHOST))
{ {
FootpathRemoveLitter({ _loc, z }); FootpathRemoveLitter({ _loc, z });
wall_remove_at_z({ _loc, z }); WallRemoveAtZ({ _loc, z });
} }
auto clear_z = z + (_isExit ? RideExitHeight : RideEntranceHeight); auto clear_z = z + (_isExit ? RideExitHeight : RideEntranceHeight);

View File

@ -361,7 +361,7 @@ void SetCheatAction::SetGrassLength(int32_t length) const
{ {
for (int32_t x = 0; x < gMapSize.x; x++) for (int32_t x = 0; x < gMapSize.x; x++)
{ {
auto surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;
@ -690,7 +690,7 @@ void SetCheatAction::OwnAllLand() const
{ {
for (coords.x = min.x; coords.x <= max.x; coords.x += COORDS_XY_STEP) for (coords.x = min.x; coords.x <= max.x; coords.x += COORDS_XY_STEP)
{ {
auto* surfaceElement = map_get_surface_element_at(coords); auto* surfaceElement = MapGetSurfaceElementAt(coords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;
@ -714,7 +714,7 @@ void SetCheatAction::OwnAllLand() const
// Completely unown peep spawn points // Completely unown peep spawn points
for (const auto& spawn : gPeepSpawns) for (const auto& spawn : gPeepSpawns)
{ {
auto* surfaceElement = map_get_surface_element_at(spawn); auto* surfaceElement = MapGetSurfaceElementAt(spawn);
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
surfaceElement->SetOwnership(OWNERSHIP_UNOWNED); surfaceElement->SetOwnership(OWNERSHIP_UNOWNED);
@ -724,7 +724,7 @@ void SetCheatAction::OwnAllLand() const
} }
} }
map_count_remaining_land_rights(); MapCountRemainingLandRights();
} }
void SetCheatAction::ParkSetOpen(bool isOpen) const void SetCheatAction::ParkSetOpen(bool isOpen) const

View File

@ -111,7 +111,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
} }
auto* sceneryEntry = get_small_scenery_entry(_sceneryType); auto* sceneryEntry = GetSmallSceneryEntry(_sceneryType);
if (sceneryEntry == nullptr) if (sceneryEntry == nullptr)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
@ -164,7 +164,7 @@ GameActions::Result SmallSceneryPlaceAction::Query() const
return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK); return GameActions::Result(GameActions::Status::NotOwned, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
} }
auto* surfaceElement = map_get_surface_element_at(_loc); auto* surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement != nullptr && !gCheatsDisableClearanceChecks && surfaceElement->GetWaterHeight() > 0) if (surfaceElement != nullptr && !gCheatsDisableClearanceChecks && surfaceElement->GetWaterHeight() > 0)
{ {
@ -303,7 +303,7 @@ GameActions::Result SmallSceneryPlaceAction::Execute() const
res.Position.z = surfaceHeight; res.Position.z = surfaceHeight;
} }
auto* sceneryEntry = get_small_scenery_entry(_sceneryType); auto* sceneryEntry = GetSmallSceneryEntry(_sceneryType);
if (sceneryEntry == nullptr) if (sceneryEntry == nullptr)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_POSITION_THIS_HERE, STR_NONE);
@ -353,7 +353,7 @@ GameActions::Result SmallSceneryPlaceAction::Execute() const
FootpathRemoveLitter({ _loc, targetHeight }); FootpathRemoveLitter({ _loc, targetHeight });
if (!gCheatsDisableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_NO_WALLS))) if (!gCheatsDisableClearanceChecks && (sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_NO_WALLS)))
{ {
wall_remove_at({ _loc, targetHeight, targetHeight + sceneryEntry->height }); WallRemoveAt({ _loc, targetHeight, targetHeight + sceneryEntry->height });
} }
} }

View File

@ -61,7 +61,7 @@ GameActions::Result SmallSceneryRemoveAction::Query() const
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
} }
auto* entry = get_small_scenery_entry(_sceneryType); auto* entry = GetSmallSceneryEntry(_sceneryType);
if (entry == nullptr) if (entry == nullptr)
{ {
return GameActions::Result( return GameActions::Result(
@ -110,7 +110,7 @@ GameActions::Result SmallSceneryRemoveAction::Execute() const
{ {
GameActions::Result res = GameActions::Result(); GameActions::Result res = GameActions::Result();
auto* entry = get_small_scenery_entry(_sceneryType); auto* entry = GetSmallSceneryEntry(_sceneryType);
if (entry == nullptr) if (entry == nullptr)
{ {
return GameActions::Result( return GameActions::Result(

View File

@ -108,7 +108,7 @@ GameActions::Result SurfaceSetStyleAction::Query() const
continue; continue;
} }
auto surfaceElement = map_get_surface_element_at(coords); auto surfaceElement = MapGetSurfaceElementAt(coords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
continue; continue;
@ -176,7 +176,7 @@ GameActions::Result SurfaceSetStyleAction::Execute() const
continue; continue;
} }
auto surfaceElement = map_get_surface_element_at(coords); auto surfaceElement = MapGetSurfaceElementAt(coords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
continue; continue;

View File

@ -307,7 +307,7 @@ GameActions::Result TrackPlaceAction::Query() const
if ((rideTypeFlags & RIDE_TYPE_FLAG_TRACK_MUST_BE_ON_WATER) && !_trackDesignDrawingPreview) if ((rideTypeFlags & RIDE_TYPE_FLAG_TRACK_MUST_BE_ON_WATER) && !_trackDesignDrawingPreview)
{ {
auto surfaceElement = map_get_surface_element_at(mapLoc); auto surfaceElement = MapGetSurfaceElementAt(mapLoc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
return GameActions::Result( return GameActions::Result(
@ -355,7 +355,7 @@ GameActions::Result TrackPlaceAction::Query() const
} }
// 6c5648 12 push // 6c5648 12 push
auto surfaceElement = map_get_surface_element_at(mapLoc); auto surfaceElement = MapGetSurfaceElementAt(mapLoc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE);
@ -481,7 +481,7 @@ GameActions::Result TrackPlaceAction::Execute() const
FootpathRemoveLitter(mapLoc); FootpathRemoveLitter(mapLoc);
if (rideTypeFlags & RIDE_TYPE_FLAG_TRACK_NO_WALLS) if (rideTypeFlags & RIDE_TYPE_FLAG_TRACK_NO_WALLS)
{ {
wall_remove_at(mapLocWithClearance); WallRemoveAt(mapLocWithClearance);
} }
else else
{ {
@ -493,7 +493,7 @@ GameActions::Result TrackPlaceAction::Execute() const
{ {
if (intersectingDirections & (1 << i)) if (intersectingDirections & (1 << i))
{ {
wall_remove_intersecting_walls(mapLocWithClearance, i); WallRemoveIntersectingWalls(mapLocWithClearance, i);
} }
} }
} }
@ -511,7 +511,7 @@ GameActions::Result TrackPlaceAction::Execute() const
resultData.GroundFlags = mapGroundFlags; resultData.GroundFlags = mapGroundFlags;
// 6c5648 12 push // 6c5648 12 push
auto surfaceElement = map_get_surface_element_at(mapLoc); auto surfaceElement = MapGetSurfaceElementAt(mapLoc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_NONE);
@ -663,7 +663,7 @@ GameActions::Result TrackPlaceAction::Execute() const
tempLoc.x += CoordsDirectionDelta[tempDirection].x; tempLoc.x += CoordsDirectionDelta[tempDirection].x;
tempLoc.y += CoordsDirectionDelta[tempDirection].y; tempLoc.y += CoordsDirectionDelta[tempDirection].y;
tempDirection = DirectionReverse(tempDirection); tempDirection = DirectionReverse(tempDirection);
wall_remove_intersecting_walls({ tempLoc, baseZ, clearanceZ }, tempDirection & 3); WallRemoveIntersectingWalls({ tempLoc, baseZ, clearanceZ }, tempDirection & 3);
} }
} }
} }
@ -686,7 +686,7 @@ GameActions::Result TrackPlaceAction::Execute() const
if (rideTypeFlags & RIDE_TYPE_FLAG_TRACK_MUST_BE_ON_WATER) if (rideTypeFlags & RIDE_TYPE_FLAG_TRACK_MUST_BE_ON_WATER)
{ {
auto* waterSurfaceElement = map_get_surface_element_at(mapLoc); auto* waterSurfaceElement = MapGetSurfaceElementAt(mapLoc);
if (waterSurfaceElement != nullptr) if (waterSurfaceElement != nullptr)
{ {
waterSurfaceElement->SetHasTrackThatNeedsWater(true); waterSurfaceElement->SetHasTrackThatNeedsWater(true);

View File

@ -68,7 +68,7 @@ GameActions::Result TrackRemoveAction::Query() const
bool found = false; bool found = false;
bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST; bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
TileElement* tileElement = map_get_first_element_at(_origin); TileElement* tileElement = MapGetFirstElementAt(_origin);
do do
{ {
@ -167,7 +167,7 @@ GameActions::Result TrackRemoveAction::Query() const
map_invalidate_tile_full(mapLoc); map_invalidate_tile_full(mapLoc);
found = false; found = false;
tileElement = map_get_first_element_at(mapLoc); tileElement = MapGetFirstElementAt(mapLoc);
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)
@ -214,7 +214,7 @@ GameActions::Result TrackRemoveAction::Query() const
} }
} }
auto* surfaceElement = map_get_surface_element_at(mapLoc); auto* surfaceElement = MapGetSurfaceElementAt(mapLoc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
log_warning("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y); log_warning("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y);
@ -264,7 +264,7 @@ GameActions::Result TrackRemoveAction::Execute() const
bool found = false; bool found = false;
bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST; bool isGhost = GetFlags() & GAME_COMMAND_FLAG_GHOST;
TileElement* tileElement = map_get_first_element_at(_origin); TileElement* tileElement = MapGetFirstElementAt(_origin);
do do
{ {
@ -346,7 +346,7 @@ GameActions::Result TrackRemoveAction::Execute() const
map_invalidate_tile_full(mapLoc); map_invalidate_tile_full(mapLoc);
found = false; found = false;
tileElement = map_get_first_element_at(mapLoc); tileElement = MapGetFirstElementAt(mapLoc);
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)
@ -393,7 +393,7 @@ GameActions::Result TrackRemoveAction::Execute() const
} }
} }
auto* surfaceElement = map_get_surface_element_at(mapLoc); auto* surfaceElement = MapGetSurfaceElementAt(mapLoc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
log_warning("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y); log_warning("Surface Element not found. x = %d, y = %d", mapLoc.x, mapLoc.y);

View File

@ -108,7 +108,7 @@ GameActions::Result WallPlaceAction::Query() const
auto targetHeight = _loc.z; auto targetHeight = _loc.z;
if (targetHeight == 0) if (targetHeight == 0)
{ {
auto* surfaceElement = map_get_surface_element_at(_loc); auto* surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
log_error("Surface element not found at %d, %d.", _loc.x, _loc.y); log_error("Surface element not found at %d, %d.", _loc.x, _loc.y);
@ -125,7 +125,7 @@ GameActions::Result WallPlaceAction::Query() const
} }
} }
auto* surfaceElement = map_get_surface_element_at(_loc); auto* surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
log_error("Surface element not found at %d, %d.", _loc.x, _loc.y); log_error("Surface element not found at %d, %d.", _loc.x, _loc.y);
@ -287,7 +287,7 @@ GameActions::Result WallPlaceAction::Execute() const
auto targetHeight = _loc.z; auto targetHeight = _loc.z;
if (targetHeight == 0) if (targetHeight == 0)
{ {
auto* surfaceElement = map_get_surface_element_at(_loc); auto* surfaceElement = MapGetSurfaceElementAt(_loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
log_error("Surface element not found at %d, %d.", _loc.x, _loc.y); log_error("Surface element not found at %d, %d.", _loc.x, _loc.y);
@ -501,7 +501,7 @@ GameActions::Result WallPlaceAction::WallCheckObstruction(
return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_OFF_EDGE_OF_MAP); return GameActions::Result(GameActions::Status::InvalidParameters, STR_CANT_BUILD_THIS_HERE, STR_OFF_EDGE_OF_MAP);
} }
TileElement* tileElement = map_get_first_element_at(_loc); TileElement* tileElement = MapGetFirstElementAt(_loc);
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)

View File

@ -67,7 +67,7 @@ GameActions::Result WaterLowerAction::QueryExecute(bool isExecuting) const
if (!LocationValid({ x, y })) if (!LocationValid({ x, y }))
continue; continue;
auto* surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;
@ -138,7 +138,7 @@ uint8_t WaterLowerAction::GetLowestHeight(const MapRange& validRange) const
} }
} }
auto* surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;

View File

@ -67,7 +67,7 @@ GameActions::Result WaterRaiseAction::QueryExecute(bool isExecuting) const
if (!LocationValid({ x, y })) if (!LocationValid({ x, y }))
continue; continue;
auto surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;
@ -144,7 +144,7 @@ uint16_t WaterRaiseAction::GetHighestHeight(const MapRange& validRange) const
} }
} }
auto* surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;

View File

@ -64,7 +64,7 @@ GameActions::Result WaterSetHeightAction::Query() const
} }
} }
SurfaceElement* surfaceElement = map_get_surface_element_at(_coords); SurfaceElement* surfaceElement = MapGetSurfaceElementAt(_coords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
log_error("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); log_error("Could not find surface element at: x %u, y %u", _coords.x, _coords.y);
@ -107,9 +107,9 @@ GameActions::Result WaterSetHeightAction::Execute() const
int32_t surfaceHeight = tile_element_height(_coords); int32_t surfaceHeight = tile_element_height(_coords);
FootpathRemoveLitter({ _coords, surfaceHeight }); FootpathRemoveLitter({ _coords, surfaceHeight });
if (!gCheatsDisableClearanceChecks) if (!gCheatsDisableClearanceChecks)
wall_remove_at_z({ _coords, surfaceHeight }); WallRemoveAtZ({ _coords, surfaceHeight });
SurfaceElement* surfaceElement = map_get_surface_element_at(_coords); SurfaceElement* surfaceElement = MapGetSurfaceElementAt(_coords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
log_error("Could not find surface element at: x %u, y %u", _coords.x, _coords.y); log_error("Could not find surface element at: x %u, y %u", _coords.x, _coords.y);

View File

@ -163,7 +163,7 @@ namespace OpenRCT2::Audio
params.volume = 0; params.volume = 0;
params.pan = 0; params.pan = 0;
auto element = map_get_surface_element_at(location); auto element = MapGetSurfaceElementAt(location);
if (element != nullptr && (element->GetBaseZ()) - 5 > location.z) if (element != nullptr && (element->GetBaseZ()) - 5 > location.z)
{ {
volumeDown = 10; volumeDown = 10;

View File

@ -103,7 +103,7 @@ void Duck::UpdateFlyToWater()
auto destination = CoordsXYZ{ CoordsXY{ x, y } + DuckMoveOffset[direction], 0 }; auto destination = CoordsXYZ{ CoordsXY{ x, y } + DuckMoveOffset[direction], 0 };
int32_t manhattanDistanceN = abs(target_x - destination.x) + abs(target_y - destination.y); int32_t manhattanDistanceN = abs(target_x - destination.x) + abs(target_y - destination.y);
auto surfaceElement = map_get_surface_element_at(CoordsXY{ target_x, target_y }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ target_x, target_y });
int32_t waterHeight = surfaceElement != nullptr ? surfaceElement->GetWaterHeight() : 0; int32_t waterHeight = surfaceElement != nullptr ? surfaceElement->GetWaterHeight() : 0;
if (waterHeight == 0) if (waterHeight == 0)
{ {

View File

@ -250,7 +250,7 @@ bool JumpingFountain::IsJumpingFountain(const JumpingFountainType newType, const
const int32_t pathBitFlagMask = newType == JumpingFountainType::Snow ? PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW const int32_t pathBitFlagMask = newType == JumpingFountainType::Snow ? PATH_BIT_FLAG_JUMPING_FOUNTAIN_SNOW
: PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER; : PATH_BIT_FLAG_JUMPING_FOUNTAIN_WATER;
TileElement* tileElement = map_get_first_element_at(newLoc); TileElement* tileElement = MapGetFirstElementAt(newLoc);
if (tileElement == nullptr) if (tileElement == nullptr)
return false; return false;
do do

View File

@ -4872,7 +4872,7 @@ void Guest::UpdateRideMazePathfinding()
}; };
maze_type mazeType = maze_type::invalid; maze_type mazeType = maze_type::invalid;
auto tileElement = map_get_first_element_at(targetLoc); auto tileElement = MapGetFirstElementAt(targetLoc);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -4967,7 +4967,7 @@ void Guest::UpdateRideLeaveExit()
// Find the station track element // Find the station track element
for (auto* pathElement : TileElementsView<PathElement>(targetLoc)) for (auto* pathElement : TileElementsView<PathElement>(targetLoc))
{ {
int16_t height = map_height_from_slope(targetLoc, pathElement->GetSlopeDirection(), pathElement->IsSloped()); int16_t height = MapHeightFromSlope(targetLoc, pathElement->GetSlopeDirection(), pathElement->IsSloped());
height += pathElement->GetBaseZ(); height += pathElement->GetBaseZ();
int16_t z_diff = z - height; int16_t z_diff = z - height;
@ -5302,7 +5302,7 @@ void Guest::UpdateWalking()
if (GetNextIsSurface()) if (GetNextIsSurface())
{ {
auto surfaceElement = map_get_surface_element_at(NextLoc); auto surfaceElement = MapGetSurfaceElementAt(NextLoc);
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
@ -5351,7 +5351,7 @@ void Guest::UpdateWalking()
if (GetNextIsSurface() || GetNextIsSloped()) if (GetNextIsSurface() || GetNextIsSloped())
return; return;
TileElement* tileElement = map_get_first_element_at(NextLoc); TileElement* tileElement = MapGetFirstElementAt(NextLoc);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
@ -6242,7 +6242,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, RideId* rideToVi
{ {
TileElement* tileElement; TileElement* tileElement;
auto surfaceElement = map_get_surface_element_at(peep->NextLoc); auto surfaceElement = MapGetSurfaceElementAt(peep->NextLoc);
tileElement = reinterpret_cast<TileElement*>(surfaceElement); tileElement = reinterpret_cast<TileElement*>(surfaceElement);
if (tileElement == nullptr) if (tileElement == nullptr)
@ -6281,7 +6281,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, RideId* rideToVi
return false; return false;
} }
surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
tileElement = reinterpret_cast<TileElement*>(surfaceElement); tileElement = reinterpret_cast<TileElement*>(surfaceElement);
if (tileElement == nullptr) if (tileElement == nullptr)
@ -6398,7 +6398,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, RideId* rideToVi
return false; return false;
} }
surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
// TODO: extract loop A // TODO: extract loop A
tileElement = reinterpret_cast<TileElement*>(surfaceElement); tileElement = reinterpret_cast<TileElement*>(surfaceElement);
@ -6515,7 +6515,7 @@ static bool peep_find_ride_to_look_at(Peep* peep, uint8_t edge, RideId* rideToVi
return false; return false;
} }
surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
// TODO: extract loop A // TODO: extract loop A
tileElement = reinterpret_cast<TileElement*>(surfaceElement); tileElement = reinterpret_cast<TileElement*>(surfaceElement);
@ -6701,7 +6701,7 @@ void Guest::UpdateSpriteType()
CoordsXY loc = { x, y }; CoordsXY loc = { x, y };
if (map_is_location_valid(loc.ToTileStart())) if (map_is_location_valid(loc.ToTileStart()))
{ {
TileElement* tileElement = map_get_first_element_at(loc); TileElement* tileElement = MapGetFirstElementAt(loc);
while (true) while (true)
{ {
if (tileElement == nullptr) if (tileElement == nullptr)

View File

@ -23,7 +23,7 @@ static bool isLocationLitterable(const CoordsXYZ& mapPos)
if (!map_is_location_owned(mapPos)) if (!map_is_location_owned(mapPos))
return false; return false;
tileElement = map_get_first_element_at(mapPos); tileElement = MapGetFirstElementAt(mapPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return false; return false;
do do
@ -35,7 +35,7 @@ static bool isLocationLitterable(const CoordsXYZ& mapPos)
if (pathZ < mapPos.z || pathZ >= mapPos.z + PATH_CLEARANCE) if (pathZ < mapPos.z || pathZ >= mapPos.z + PATH_CLEARANCE)
continue; continue;
return !tile_element_is_underground(tileElement); return !TileElementIsUnderground(tileElement);
} while (!(tileElement++)->IsLastForTile()); } while (!(tileElement++)->IsLastForTile());
return false; return false;
} }

View File

@ -218,7 +218,7 @@ void CrashSplashParticle::Paint(paint_session& session, int32_t imageDirection)
*/ */
void SteamParticle::Create(const CoordsXYZ& coords) void SteamParticle::Create(const CoordsXYZ& coords)
{ {
auto surfaceElement = map_get_surface_element_at(coords); auto surfaceElement = MapGetSurfaceElementAt(coords);
if (surfaceElement != nullptr && coords.z > surfaceElement->GetBaseZ()) if (surfaceElement != nullptr && coords.z > surfaceElement->GetBaseZ())
{ {
SteamParticle* steam = CreateEntity<SteamParticle>(); SteamParticle* steam = CreateEntity<SteamParticle>();

View File

@ -294,7 +294,7 @@ bool Peep::CheckForPath()
return true; return true;
} }
TileElement* tile_element = map_get_first_element_at(NextLoc); TileElement* tile_element = MapGetFirstElementAt(NextLoc);
auto mapType = TileElementType::Path; auto mapType = TileElementType::Path;
if (GetNextIsSurface()) if (GetNextIsSurface())
@ -624,7 +624,7 @@ GameActions::Result Peep::Place(const TileCoordsXYZ& location, bool apply)
TileElement* tileElement = reinterpret_cast<TileElement*>(pathElement); TileElement* tileElement = reinterpret_cast<TileElement*>(pathElement);
if (pathElement == nullptr) if (pathElement == nullptr)
{ {
tileElement = reinterpret_cast<TileElement*>(map_get_surface_element_at(location.ToCoordsXYZ())); tileElement = reinterpret_cast<TileElement*>(MapGetSurfaceElementAt(location.ToCoordsXYZ()));
} }
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
@ -759,7 +759,7 @@ void Peep::UpdateFalling()
} }
// If not drowning then falling. Note: peeps 'fall' after leaving a ride/enter the park. // If not drowning then falling. Note: peeps 'fall' after leaving a ride/enter the park.
TileElement* tile_element = map_get_first_element_at(CoordsXY{ x, y }); TileElement* tile_element = MapGetFirstElementAt(CoordsXY{ x, y });
TileElement* saved_map = nullptr; TileElement* saved_map = nullptr;
int32_t saved_height = 0; int32_t saved_height = 0;
@ -770,7 +770,7 @@ void Peep::UpdateFalling()
// If a path check if we are on it // If a path check if we are on it
if (tile_element->GetType() == TileElementType::Path) if (tile_element->GetType() == TileElementType::Path)
{ {
int32_t height = map_height_from_slope( int32_t height = MapHeightFromSlope(
{ x, y }, tile_element->AsPath()->GetSlopeDirection(), tile_element->AsPath()->IsSloped()) { x, y }, tile_element->AsPath()->GetSlopeDirection(), tile_element->AsPath()->IsSloped())
+ tile_element->GetBaseZ(); + tile_element->GetBaseZ();
@ -1886,7 +1886,7 @@ static bool peep_interact_with_entrance(Peep* peep, const CoordsXYE& coords, uin
auto nextLoc = coords.ToTileStart() + CoordsDirectionDelta[entranceDirection]; auto nextLoc = coords.ToTileStart() + CoordsDirectionDelta[entranceDirection];
// Make sure there is a path right behind the entrance, otherwise turn around // Make sure there is a path right behind the entrance, otherwise turn around
TileElement* nextTileElement = map_get_first_element_at(nextLoc); TileElement* nextTileElement = MapGetFirstElementAt(nextLoc);
do do
{ {
if (nextTileElement == nullptr) if (nextTileElement == nullptr)
@ -2420,7 +2420,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result)
return; return;
} }
TileElement* tileElement = map_get_first_element_at(newLoc); TileElement* tileElement = MapGetFirstElementAt(newLoc);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
int16_t base_z = std::max(0, (z / 8) - 2); int16_t base_z = std::max(0, (z / 8) - 2);
@ -2478,7 +2478,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result)
return; return;
} }
auto surfaceElement = map_get_surface_element_at(newLoc); auto surfaceElement = MapGetSurfaceElementAt(newLoc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
peep_return_to_centre_of_tile(this); peep_return_to_centre_of_tile(this);
@ -2532,7 +2532,7 @@ int32_t Peep::GetZOnSlope(int32_t tile_x, int32_t tile_y)
} }
uint8_t slope = GetNextDirection(); uint8_t slope = GetNextDirection();
return NextLoc.z + map_height_from_slope({ tile_x, tile_y }, slope, GetNextIsSloped()); return NextLoc.z + MapHeightFromSlope({ tile_x, tile_y }, slope, GetNextIsSloped());
} }
StringId get_real_name_string_id_from_id(uint32_t id) StringId get_real_name_string_id_from_id(uint32_t id)

View File

@ -168,7 +168,7 @@ bool Staff::CanIgnoreWideFlag(const CoordsXYZ& staffPos, TileElement* path) cons
} }
/* Search through all adjacent map elements */ /* Search through all adjacent map elements */
TileElement* test_element = map_get_first_element_at(adjacPos); TileElement* test_element = MapGetFirstElementAt(adjacPos);
if (test_element == nullptr) if (test_element == nullptr)
return false; return false;
bool pathfound = false; bool pathfound = false;
@ -360,7 +360,7 @@ Direction Staff::HandymanDirectionToNearestLitter() const
int16_t nextZ = ((z + COORDS_Z_STEP) & 0xFFF0) / COORDS_Z_STEP; int16_t nextZ = ((z + COORDS_Z_STEP) & 0xFFF0) / COORDS_Z_STEP;
TileElement* tileElement = map_get_first_element_at(nextTile); TileElement* tileElement = MapGetFirstElementAt(nextTile);
if (tileElement == nullptr) if (tileElement == nullptr)
return INVALID_DIRECTION; return INVALID_DIRECTION;
do do
@ -375,7 +375,7 @@ Direction Staff::HandymanDirectionToNearestLitter() const
nextTile = CoordsXY(x, y).ToTileStart() + CoordsDirectionDelta[nextDirection]; nextTile = CoordsXY(x, y).ToTileStart() + CoordsDirectionDelta[nextDirection];
tileElement = map_get_first_element_at(nextTile); tileElement = MapGetFirstElementAt(nextTile);
if (tileElement == nullptr) if (tileElement == nullptr)
return INVALID_DIRECTION; return INVALID_DIRECTION;
@ -400,7 +400,7 @@ uint8_t Staff::HandymanDirectionToUncutGrass(uint8_t valid_directions) const
{ {
if (!(GetNextIsSurface())) if (!(GetNextIsSurface()))
{ {
auto surfaceElement = map_get_surface_element_at(NextLoc); auto surfaceElement = MapGetSurfaceElementAt(NextLoc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
return INVALID_DIRECTION; return INVALID_DIRECTION;
@ -431,7 +431,7 @@ uint8_t Staff::HandymanDirectionToUncutGrass(uint8_t valid_directions) const
if (!map_is_location_valid(chosenTile)) if (!map_is_location_valid(chosenTile))
continue; continue;
auto surfaceElement = map_get_surface_element_at(chosenTile); auto surfaceElement = MapGetSurfaceElementAt(chosenTile);
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
if (std::abs(surfaceElement->GetBaseZ() - NextLoc.z) <= 2 * COORDS_Z_STEP) if (std::abs(surfaceElement->GetBaseZ() - NextLoc.z) <= 2 * COORDS_Z_STEP)
@ -1098,7 +1098,7 @@ void Staff::UpdateMowing()
if (Var37 != 7) if (Var37 != 7)
continue; continue;
auto surfaceElement = map_get_surface_element_at(NextLoc); auto surfaceElement = MapGetSurfaceElementAt(NextLoc);
if (surfaceElement != nullptr && surfaceElement->CanGrassGrow()) if (surfaceElement != nullptr && surfaceElement->CanGrassGrow())
{ {
surfaceElement->SetGrassLength(GRASS_LENGTH_MOWED); surfaceElement->SetGrassLength(GRASS_LENGTH_MOWED);
@ -1145,7 +1145,7 @@ void Staff::UpdateWatering()
auto actionLoc = CoordsXY{ NextLoc } + CoordsDirectionDelta[Var37]; auto actionLoc = CoordsXY{ NextLoc } + CoordsDirectionDelta[Var37];
TileElement* tile_element = map_get_first_element_at(actionLoc); TileElement* tile_element = MapGetFirstElementAt(actionLoc);
if (tile_element == nullptr) if (tile_element == nullptr)
return; return;
@ -1212,7 +1212,7 @@ void Staff::UpdateEmptyingBin()
if (ActionFrame != 11) if (ActionFrame != 11)
return; return;
TileElement* tile_element = map_get_first_element_at(NextLoc); TileElement* tile_element = MapGetFirstElementAt(NextLoc);
if (tile_element == nullptr) if (tile_element == nullptr)
return; return;
@ -1524,7 +1524,7 @@ bool Staff::UpdatePatrollingFindWatering()
auto chosenLoc = CoordsXY{ NextLoc } + CoordsDirectionDelta[chosen_position]; auto chosenLoc = CoordsXY{ NextLoc } + CoordsDirectionDelta[chosen_position];
TileElement* tile_element = map_get_first_element_at(chosenLoc); TileElement* tile_element = MapGetFirstElementAt(chosenLoc);
// This seems to happen in some SV4 files. // This seems to happen in some SV4 files.
if (tile_element == nullptr) if (tile_element == nullptr)
@ -1591,7 +1591,7 @@ bool Staff::UpdatePatrollingFindBin()
if (GetNextIsSurface()) if (GetNextIsSurface())
return false; return false;
TileElement* tileElement = map_get_first_element_at(NextLoc); TileElement* tileElement = MapGetFirstElementAt(NextLoc);
if (tileElement == nullptr) if (tileElement == nullptr)
return false; return false;
@ -1658,7 +1658,7 @@ bool Staff::UpdatePatrollingFindGrass()
if (!(GetNextIsSurface())) if (!(GetNextIsSurface()))
return false; return false;
auto surfaceElement = map_get_surface_element_at(NextLoc); auto surfaceElement = MapGetSurfaceElementAt(NextLoc);
if (surfaceElement != nullptr && surfaceElement->CanGrassGrow()) if (surfaceElement != nullptr && surfaceElement->CanGrassGrow())
{ {
if ((surfaceElement->GetGrassLength() & 0x7) >= GRASS_LENGTH_CLEAR_1) if ((surfaceElement->GetGrassLength() & 0x7) >= GRASS_LENGTH_CLEAR_1)
@ -1791,7 +1791,7 @@ void Staff::UpdatePatrolling()
if (GetNextIsSurface()) if (GetNextIsSurface())
{ {
auto surfaceElement = map_get_surface_element_at(NextLoc); auto surfaceElement = MapGetSurfaceElementAt(NextLoc);
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {

View File

@ -215,7 +215,7 @@ std::string screenshot_dump_png_32bpp(int32_t width, int32_t height, const void*
static int32_t GetHighestBaseClearanceZ(const CoordsXY& location, const bool useViewClipping) static int32_t GetHighestBaseClearanceZ(const CoordsXY& location, const bool useViewClipping)
{ {
int32_t z = 0; int32_t z = 0;
auto element = map_get_first_element_at(location); auto element = MapGetFirstElementAt(location);
if (element != nullptr) if (element != nullptr)
{ {
do do

View File

@ -868,7 +868,7 @@ static FootpathPaintInfo GetFootpathPaintInfo(const PathElement& pathEl)
static bool ShouldDrawSupports(paint_session& session, const PathElement& pathEl, uint16_t height) static bool ShouldDrawSupports(paint_session& session, const PathElement& pathEl, uint16_t height)
{ {
auto surface = map_get_surface_element_at(session.MapPosition); auto surface = MapGetSurfaceElementAt(session.MapPosition);
if (surface == nullptr) if (surface == nullptr)
{ {
return true; return true;

View File

@ -1060,7 +1060,7 @@ void PaintSurface(paint_session& session, uint8_t direction, uint16_t height, co
continue; continue;
} }
auto surfaceElement = map_get_surface_element_at(position); auto surfaceElement = MapGetSurfaceElementAt(position);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
continue; continue;

View File

@ -136,7 +136,7 @@ static void PaintTileElementBase(paint_session& session, const CoordsXY& origCoo
session.MapPosition.x = coords.x; session.MapPosition.x = coords.x;
session.MapPosition.y = coords.y; session.MapPosition.y = coords.y;
auto* tile_element = map_get_first_element_at(session.MapPosition); auto* tile_element = MapGetFirstElementAt(session.MapPosition);
if (tile_element == nullptr) if (tile_element == nullptr)
return; return;
uint8_t rotation = session.CurrentRotation; uint8_t rotation = session.CurrentRotation;

View File

@ -1034,7 +1034,7 @@ namespace OpenRCT2
{ {
for (int32_t x = 0; x < gMapSize.x; x++) for (int32_t x = 0; x < gMapSize.x; x++)
{ {
TileElement* tileElement = map_get_first_element_at(TileCoordsXY{ x, y }); TileElement* tileElement = MapGetFirstElementAt(TileCoordsXY{ x, y });
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;
do do

View File

@ -280,7 +280,7 @@ static uint8_t footpath_element_next_in_direction(TileCoordsXYZ loc, PathElement
} }
loc += TileDirectionDelta[chosenDirection]; loc += TileDirectionDelta[chosenDirection];
nextTileElement = map_get_first_element_at(loc); nextTileElement = MapGetFirstElementAt(loc);
do do
{ {
if (nextTileElement == nullptr) if (nextTileElement == nullptr)
@ -330,7 +330,7 @@ static uint8_t footpath_element_dest_in_dir(TileCoordsXYZ loc, Direction chosenD
return PATH_SEARCH_LIMIT_REACHED; return PATH_SEARCH_LIMIT_REACHED;
loc += TileDirectionDelta[chosenDirection]; loc += TileDirectionDelta[chosenDirection];
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
return PATH_SEARCH_FAILED; return PATH_SEARCH_FAILED;
@ -742,7 +742,7 @@ static void peep_pathfind_heuristic_search(
/* Get the next map element of interest in the direction of test_edge. */ /* Get the next map element of interest in the direction of test_edge. */
bool found = false; bool found = false;
TileElement* tileElement = map_get_first_element_at(loc); TileElement* tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
return; return;
@ -1286,7 +1286,7 @@ Direction OriginalPathfinding::ChooseDirection(const TileCoordsXYZ& loc, Peep& p
#endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1 #endif // defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
// Get the path element at this location // Get the path element at this location
TileElement* dest_tile_element = map_get_first_element_at(loc); TileElement* dest_tile_element = MapGetFirstElementAt(loc);
/* Where there are multiple matching map elements placed with zero /* Where there are multiple matching map elements placed with zero
* clearance, save the first one for later use to determine the path * clearance, save the first one for later use to determine the path
* slope - this maintains the original behaviour (which only processes * slope - this maintains the original behaviour (which only processes
@ -1797,7 +1797,7 @@ int32_t OriginalPathfinding::GuestPathFindParkEntranceLeaving(Peep& peep, uint8_
static void get_ride_queue_end(TileCoordsXYZ& loc) static void get_ride_queue_end(TileCoordsXYZ& loc)
{ {
TileCoordsXY queueEnd = { 0, 0 }; TileCoordsXY queueEnd = { 0, 0 };
TileElement* tileElement = map_get_first_element_at(loc); TileElement* tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
@ -1845,7 +1845,7 @@ static void get_ride_queue_end(TileCoordsXYZ& loc)
} }
nextTile += TileDirectionDelta[direction]; nextTile += TileDirectionDelta[direction];
tileElement = map_get_first_element_at(nextTile); tileElement = MapGetFirstElementAt(nextTile);
found = false; found = false;
if (tileElement == nullptr) if (tileElement == nullptr)
break; break;

View File

@ -196,7 +196,7 @@ namespace RCT1
SetDefaultNames(); SetDefaultNames();
determine_ride_entrance_and_exit_locations(); determine_ride_entrance_and_exit_locations();
map_count_remaining_land_rights(); MapCountRemainingLandRights();
research_determine_first_of_type(); research_determine_first_of_type();
CheatsReset(); CheatsReset();
@ -1519,7 +1519,7 @@ namespace RCT1
auto tileAdded = false; auto tileAdded = false;
if (coords.x < maxSize && coords.y < maxSize) if (coords.x < maxSize && coords.y < maxSize)
{ {
// This is the equivalent of map_get_first_element_at(x, y), but on S4 data. // This is the equivalent of MapGetFirstElementAt(x, y), but on S4 data.
RCT12TileElement* srcElement = tilePointerIndex.GetFirstElementAt(coords); RCT12TileElement* srcElement = tilePointerIndex.GetFirstElementAt(coords);
do do
{ {
@ -2563,7 +2563,7 @@ namespace RCT1
{ {
for (int32_t y = 0; y < Limits::MaxMapSize; y++) for (int32_t y = 0; y < Limits::MaxMapSize; y++)
{ {
TileElement* tileElement = map_get_first_element_at(TileCoordsXY{ x, y }); TileElement* tileElement = MapGetFirstElementAt(TileCoordsXY{ x, y });
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;
do do

View File

@ -499,9 +499,9 @@ namespace RCT2
// pad_13CE778 // pad_13CE778
// Fix and set dynamic variables // Fix and set dynamic variables
map_strip_ghost_flag_from_elements(); MapStripGhostFlagFromElements();
ConvertScenarioStringsToUTF8(); ConvertScenarioStringsToUTF8();
map_count_remaining_land_rights(); MapCountRemainingLandRights();
determine_ride_entrance_and_exit_locations(); determine_ride_entrance_and_exit_locations();
park.Name = GetUserString(_s6.park_name); park.Name = GetUserString(_s6.park_name);
@ -653,7 +653,7 @@ namespace RCT2
}; };
for (const auto& tile : tilesToUncovered) for (const auto& tile : tilesToUncovered)
{ {
auto* tileElement = map_get_first_element_at(tile); auto* tileElement = MapGetFirstElementAt(tile);
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;
@ -678,7 +678,7 @@ namespace RCT2
}; };
for (const auto& tile : tilesToCovered) for (const auto& tile : tilesToCovered)
{ {
auto* tileElement = map_get_first_element_at(tile); auto* tileElement = MapGetFirstElementAt(tile);
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;

View File

@ -479,7 +479,7 @@ bool track_block_get_next_from_zero(
trackPos += CoordsDirectionDelta[direction_start]; trackPos += CoordsDirectionDelta[direction_start];
} }
TileElement* tileElement = map_get_first_element_at(trackPos); TileElement* tileElement = MapGetFirstElementAt(trackPos);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
output->element = nullptr; output->element = nullptr;
@ -611,7 +611,7 @@ bool track_block_get_previous_from_zero(
trackPos += CoordsDirectionDelta[direction]; trackPos += CoordsDirectionDelta[direction];
} }
TileElement* tileElement = map_get_first_element_at(trackPos); TileElement* tileElement = MapGetFirstElementAt(trackPos);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
outTrackBeginEnd->end_x = trackPos.x; outTrackBeginEnd->end_x = trackPos.x;
@ -2308,7 +2308,7 @@ static void ride_shop_connected(Ride* ride)
return; return;
TrackElement* trackElement = nullptr; TrackElement* trackElement = nullptr;
TileElement* tileElement = map_get_first_element_at(shopLoc); TileElement* tileElement = MapGetFirstElementAt(shopLoc);
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)
@ -2653,7 +2653,7 @@ void Ride::ChainQueues() const
// This will fire for every entrance on this x, y and z, regardless whether that actually belongs to // This will fire for every entrance on this x, y and z, regardless whether that actually belongs to
// the ride or not. // the ride or not.
TileElement* tileElement = map_get_first_element_at(station.Entrance); TileElement* tileElement = MapGetFirstElementAt(station.Entrance);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -2994,7 +2994,7 @@ static void ride_set_maze_entrance_exit_points(Ride* ride)
{ {
auto entranceExitMapPos = position->ToCoordsXYZ(); auto entranceExitMapPos = position->ToCoordsXYZ();
TileElement* tileElement = map_get_first_element_at(*position); TileElement* tileElement = MapGetFirstElementAt(*position);
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)
@ -3626,7 +3626,7 @@ static ResultWithMessage ride_initialise_cable_lift_track(Ride* ride, bool isApp
} }
bool success = false; bool success = false;
TileElement* tileElement = map_get_first_element_at(location); TileElement* tileElement = MapGetFirstElementAt(location);
if (tileElement == nullptr) if (tileElement == nullptr)
return { false }; return { false };
do do
@ -3864,7 +3864,7 @@ static void ride_scroll_to_track_error(const CoordsXYE& trackElement)
TrackElement* Ride::GetOriginElement(StationIndex stationIndex) const TrackElement* Ride::GetOriginElement(StationIndex stationIndex) const
{ {
auto stationLoc = GetStation(stationIndex).Start; auto stationLoc = GetStation(stationIndex).Start;
TileElement* tileElement = map_get_first_element_at(stationLoc); TileElement* tileElement = MapGetFirstElementAt(stationLoc);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
do do
@ -5039,7 +5039,7 @@ static int32_t ride_get_track_length(Ride* ride)
if (trackStart.IsNull()) if (trackStart.IsNull())
continue; continue;
tileElement = map_get_first_element_at(trackStart); tileElement = MapGetFirstElementAt(trackStart);
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;
do do
@ -5412,7 +5412,7 @@ money16 ride_get_price(const Ride* ride)
TileElement* get_station_platform(const CoordsXYRangedZ& coords) TileElement* get_station_platform(const CoordsXYRangedZ& coords)
{ {
bool foundTileElement = false; bool foundTileElement = false;
TileElement* tileElement = map_get_first_element_at(coords); TileElement* tileElement = MapGetFirstElementAt(coords);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -5683,7 +5683,7 @@ void determine_ride_entrance_and_exit_locations()
{ {
for (int32_t x = 1; x < gMapSize.x - 1; x++) for (int32_t x = 1; x < gMapSize.x - 1; x++)
{ {
TileElement* tileElement = map_get_first_element_at(TileCoordsXY{ x, y }); TileElement* tileElement = MapGetFirstElementAt(TileCoordsXY{ x, y });
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
@ -5847,7 +5847,7 @@ void Ride::UpdateRideTypeForAllPieces()
{ {
for (int32_t x = 0; x < gMapSize.x; x++) for (int32_t x = 0; x < gMapSize.x; x++)
{ {
auto* tileElement = map_get_first_element_at(TileCoordsXY(x, y)); auto* tileElement = MapGetFirstElementAt(TileCoordsXY(x, y));
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;

View File

@ -1291,7 +1291,7 @@ CoordsXYZD ride_get_entrance_or_exit_position_from_screen_position(const ScreenC
if (map_is_location_valid(nextLocation)) if (map_is_location_valid(nextLocation))
{ {
// iterate over every element in the tile until we find what we want // iterate over every element in the tile until we find what we want
auto* tileElement = map_get_first_element_at(nextLocation); auto* tileElement = MapGetFirstElementAt(nextLocation);
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;
do do
@ -1361,7 +1361,7 @@ void Ride::ValidateStations()
location.x -= CoordsDirectionDelta[direction].x; location.x -= CoordsDirectionDelta[direction].x;
location.y -= CoordsDirectionDelta[direction].y; location.y -= CoordsDirectionDelta[direction].y;
} }
tileElement = map_get_first_element_at(location); tileElement = MapGetFirstElementAt(location);
if (tileElement == nullptr) if (tileElement == nullptr)
break; break;
@ -1418,7 +1418,7 @@ void Ride::ValidateStations()
CoordsXYZ blockLocation = location + CoordsXYZ{ CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(direction), 0 }; CoordsXYZ blockLocation = location + CoordsXYZ{ CoordsXY{ trackBlock->x, trackBlock->y }.Rotate(direction), 0 };
bool trackFound = false; bool trackFound = false;
tileElement = map_get_first_element_at(blockLocation); tileElement = MapGetFirstElementAt(blockLocation);
if (tileElement == nullptr) if (tileElement == nullptr)
break; break;
// find the target TrackElement on the tile it's supposed to appear on // find the target TrackElement on the tile it's supposed to appear on
@ -1490,7 +1490,7 @@ void Ride::ValidateStations()
// if it's not a duplicate location // if it's not a duplicate location
CoordsXY location = locationCoords.ToCoordsXY(); CoordsXY location = locationCoords.ToCoordsXY();
TileElement* tileElement = map_get_first_element_at(location); TileElement* tileElement = MapGetFirstElementAt(location);
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;
do do
@ -1512,7 +1512,7 @@ void Ride::ValidateStations()
// if there's no connected station, remove the ride entrance (see below) // if there's no connected station, remove the ride entrance (see below)
bool shouldRemove = true; bool shouldRemove = true;
TileElement* trackElement = map_get_first_element_at(nextLocation); TileElement* trackElement = MapGetFirstElementAt(nextLocation);
if (trackElement == nullptr) if (trackElement == nullptr)
continue; continue;
do do

View File

@ -209,7 +209,7 @@ static void ride_ratings_update_state_2(RideRatingUpdateState& state)
auto loc = state.Proximity; auto loc = state.Proximity;
track_type_t trackType = state.ProximityTrackType; track_type_t trackType = state.ProximityTrackType;
TileElement* tileElement = map_get_first_element_at(loc); TileElement* tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
state.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE; state.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
@ -315,7 +315,7 @@ static void ride_ratings_update_state_5(RideRatingUpdateState& state)
auto loc = state.Proximity; auto loc = state.Proximity;
track_type_t trackType = state.ProximityTrackType; track_type_t trackType = state.ProximityTrackType;
TileElement* tileElement = map_get_first_element_at(loc); TileElement* tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
state.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE; state.State = RIDE_RATINGS_STATE_FIND_NEXT_RIDE;
@ -420,7 +420,7 @@ static void ride_ratings_score_close_proximity_in_direction(
if (!map_is_location_valid(scorePos)) if (!map_is_location_valid(scorePos))
return; return;
TileElement* tileElement = map_get_first_element_at(scorePos); TileElement* tileElement = MapGetFirstElementAt(scorePos);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -476,7 +476,7 @@ static void ride_ratings_score_close_proximity_in_direction(
static void ride_ratings_score_close_proximity_loops_helper(RideRatingUpdateState& state, const CoordsXYE& coordsElement) static void ride_ratings_score_close_proximity_loops_helper(RideRatingUpdateState& state, const CoordsXYE& coordsElement)
{ {
TileElement* tileElement = map_get_first_element_at(coordsElement); TileElement* tileElement = MapGetFirstElementAt(coordsElement);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -544,7 +544,7 @@ static void ride_ratings_score_close_proximity(RideRatingUpdateState& state, Til
} }
state.ProximityTotal++; state.ProximityTotal++;
TileElement* tileElement = map_get_first_element_at(state.Proximity); TileElement* tileElement = MapGetFirstElementAt(state.Proximity);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -1461,7 +1461,7 @@ static int32_t ride_ratings_get_scenery_score(Ride* ride)
for (int32_t xx = std::max(tileLocation.x - 5, 0); xx <= std::min(tileLocation.x + 5, gMapSize.x - 1); xx++) for (int32_t xx = std::max(tileLocation.x - 5, 0); xx <= std::min(tileLocation.x + 5, gMapSize.x - 1); xx++)
{ {
// Count scenery items on this tile // Count scenery items on this tile
TileElement* tileElement = map_get_first_element_at(TileCoordsXY{ xx, yy }); TileElement* tileElement = MapGetFirstElementAt(TileCoordsXY{ xx, yy });
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;
do do

View File

@ -338,7 +338,7 @@ TileElement* ride_get_station_start_track_element(const Ride* ride, StationIndex
auto stationStart = ride->GetStation(stationIndex).GetStart(); auto stationStart = ride->GetStation(stationIndex).GetStart();
// Find the station track element // Find the station track element
TileElement* tileElement = map_get_first_element_at(stationStart); TileElement* tileElement = MapGetFirstElementAt(stationStart);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
do do
@ -354,7 +354,7 @@ TileElement* ride_get_station_start_track_element(const Ride* ride, StationIndex
TileElement* ride_get_station_exit_element(const CoordsXYZ& elementPos) TileElement* ride_get_station_exit_element(const CoordsXYZ& elementPos)
{ {
// Find the station track element // Find the station track element
TileElement* tileElement = map_get_first_element_at(elementPos); TileElement* tileElement = MapGetFirstElementAt(elementPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
do do

View File

@ -72,7 +72,7 @@ int32_t track_is_connected_by_shape(TileElement* a, TileElement* b)
static TileElement* find_station_element(const CoordsXYZD& loc, RideId rideIndex) static TileElement* find_station_element(const CoordsXYZD& loc, RideId rideIndex)
{ {
TileElement* tileElement = map_get_first_element_at(loc); TileElement* tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
do do

View File

@ -289,7 +289,7 @@ StringId TrackDesign::CreateTrackDesignTrack(TrackDesignState& tds, const Ride&
CoordsXY mapLocation = location.ToCoordsXY(); CoordsXY mapLocation = location.ToCoordsXY();
TileElement* tileElement = map_get_first_element_at(mapLocation); TileElement* tileElement = MapGetFirstElementAt(mapLocation);
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;
@ -368,7 +368,7 @@ StringId TrackDesign::CreateTrackDesignMaze(TrackDesignState& tds, const Ride& r
{ {
for (; x < MAXIMUM_MAP_SIZE_BIG; x += COORDS_XY_STEP) for (; x < MAXIMUM_MAP_SIZE_BIG; x += COORDS_XY_STEP)
{ {
auto tileElement = map_get_first_element_at(CoordsXY{ x, y }); auto tileElement = MapGetFirstElementAt(CoordsXY{ x, y });
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)
@ -402,7 +402,7 @@ StringId TrackDesign::CreateTrackDesignMaze(TrackDesignState& tds, const Ride& r
} }
CoordsXY entranceLoc = location.ToCoordsXY(); CoordsXY entranceLoc = location.ToCoordsXY();
auto tileElement = map_get_first_element_at(entranceLoc); auto tileElement = MapGetFirstElementAt(entranceLoc);
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)
@ -431,7 +431,7 @@ StringId TrackDesign::CreateTrackDesignMaze(TrackDesignState& tds, const Ride& r
} }
CoordsXY exitLoc = location.ToCoordsXY(); CoordsXY exitLoc = location.ToCoordsXY();
tileElement = map_get_first_element_at(exitLoc); tileElement = MapGetFirstElementAt(exitLoc);
if (tileElement == nullptr) if (tileElement == nullptr)
return STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY; return STR_TRACK_TOO_LARGE_OR_TOO_MUCH_SCENERY;
do do
@ -474,7 +474,7 @@ CoordsXYE TrackDesign::MazeGetFirstElement(const Ride& ride)
{ {
for (tile.x = 0; tile.x < MAXIMUM_MAP_SIZE_BIG; tile.x += COORDS_XY_STEP) for (tile.x = 0; tile.x < MAXIMUM_MAP_SIZE_BIG; tile.x += COORDS_XY_STEP)
{ {
tile.element = map_get_first_element_at(CoordsXY{ tile.x, tile.y }); tile.element = MapGetFirstElementAt(CoordsXY{ tile.x, tile.y });
do do
{ {
if (tile.element == nullptr) if (tile.element == nullptr)
@ -990,7 +990,7 @@ static GameActions::Result TrackDesignPlaceSceneryElementRemoveGhost(
uint8_t quadrant = (scenery.flags >> 2) + _currentTrackPieceDirection; uint8_t quadrant = (scenery.flags >> 2) + _currentTrackPieceDirection;
quadrant &= 3; quadrant &= 3;
auto* sceneryEntry = get_small_scenery_entry(entryInfo->Index); auto* sceneryEntry = GetSmallSceneryEntry(entryInfo->Index);
if (!(!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE) && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_DIAGONAL)) if (!(!sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_FULL_TILE) && sceneryEntry->HasFlag(SMALL_SCENERY_FLAG_DIAGONAL))
&& sceneryEntry->HasFlag( && sceneryEntry->HasFlag(
SMALL_SCENERY_FLAG_DIAGONAL | SMALL_SCENERY_FLAG_HALF_SPACE | SMALL_SCENERY_FLAG_THREE_QUARTERS)) SMALL_SCENERY_FLAG_DIAGONAL | SMALL_SCENERY_FLAG_HALF_SPACE | SMALL_SCENERY_FLAG_THREE_QUARTERS))
@ -1516,7 +1516,7 @@ static GameActions::Result TrackDesignPlaceMaze(TrackDesignState& tds, TrackDesi
continue; continue;
} }
auto surfaceElement = map_get_surface_element_at(mapCoord); auto surfaceElement = MapGetSurfaceElementAt(mapCoord);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;
int16_t surfaceZ = surfaceElement->GetBaseZ(); int16_t surfaceZ = surfaceElement->GetBaseZ();
@ -1673,7 +1673,7 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi
continue; continue;
} }
auto surfaceElement = map_get_surface_element_at(tile); auto surfaceElement = MapGetSurfaceElementAt(tile);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::InvalidParameters, STR_NONE, STR_NONE);
@ -1744,7 +1744,7 @@ static GameActions::Result TrackDesignPlaceRide(TrackDesignState& tds, TrackDesi
if (tds.PlaceOperation != PTD_OPERATION_PLACE_QUERY) if (tds.PlaceOperation != PTD_OPERATION_PLACE_QUERY)
{ {
auto tile = CoordsXY{ newCoords } + CoordsDirectionDelta[rotation]; auto tile = CoordsXY{ newCoords } + CoordsDirectionDelta[rotation];
TileElement* tile_element = map_get_first_element_at(tile); TileElement* tile_element = MapGetFirstElementAt(tile);
newCoords.z = tds.Origin.z / COORDS_Z_STEP; newCoords.z = tds.Origin.z / COORDS_Z_STEP;
newCoords.z += entrance.z; newCoords.z += entrance.z;
if (tile_element == nullptr) if (tile_element == nullptr)

View File

@ -618,7 +618,7 @@ static void track_design_save_select_nearby_scenery_for_tile(RideId rideIndex, i
{ {
for (int32_t x = cx - TRACK_NEARBY_SCENERY_DISTANCE; x <= cx + TRACK_NEARBY_SCENERY_DISTANCE; x++) for (int32_t x = cx - TRACK_NEARBY_SCENERY_DISTANCE; x <= cx + TRACK_NEARBY_SCENERY_DISTANCE; x++)
{ {
tileElement = map_get_first_element_at(TileCoordsXY{ x, y }); tileElement = MapGetFirstElementAt(TileCoordsXY{ x, y });
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;
do do

View File

@ -898,7 +898,7 @@ OpenRCT2::Audio::VehicleSoundParams Vehicle::CreateSoundParam(uint16_t priority)
if (x != LOCATION_NULL) if (x != LOCATION_NULL)
{ {
auto surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
// vehicle underground // vehicle underground
if (surfaceElement != nullptr && surfaceElement->GetBaseZ() > z) if (surfaceElement != nullptr && surfaceElement->GetBaseZ() > z)
@ -1737,13 +1737,13 @@ void Vehicle::UpdateMeasurements()
return; return;
} }
auto surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
// If vehicle above ground. // If vehicle above ground.
if (surfaceElement != nullptr && surfaceElement->GetBaseZ() <= z) if (surfaceElement != nullptr && surfaceElement->GetBaseZ() <= z)
{ {
// Set tile_element to first element. Since elements aren't always ordered by base height, // Set tile_element to first element. Since elements aren't always ordered by base height,
// we must start at the first element and iterate through each tile element. // we must start at the first element and iterate through each tile element.
auto tileElement = map_get_first_element_at(CoordsXY{ x, y }); auto tileElement = MapGetFirstElementAt(CoordsXY{ x, y });
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
@ -4615,7 +4615,7 @@ void Vehicle::UpdateBoatLocation()
*/ */
static bool vehicle_boat_is_location_accessible(const CoordsXYZ& location) static bool vehicle_boat_is_location_accessible(const CoordsXYZ& location)
{ {
TileElement* tileElement = map_get_first_element_at(location); TileElement* tileElement = MapGetFirstElementAt(location);
if (tileElement == nullptr) if (tileElement == nullptr)
return false; return false;
do do
@ -5121,7 +5121,7 @@ void Vehicle::UpdateDoingCircusShow()
*/ */
static TileElement* vehicle_check_collision(const CoordsXYZ& vehiclePosition) static TileElement* vehicle_check_collision(const CoordsXYZ& vehiclePosition)
{ {
TileElement* tileElement = map_get_first_element_at(vehiclePosition); TileElement* tileElement = MapGetFirstElementAt(vehiclePosition);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
return nullptr; return nullptr;

View File

@ -202,7 +202,7 @@ money64 MazeCalculateCost(money32 constructionCost, const Ride& ride, const Coor
const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze); const auto& ted = GetTrackElementDescriptor(TrackElemType::Maze);
money64 price = (ride.GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16; money64 price = (ride.GetRideTypeDescriptor().BuildCosts.TrackPrice * ted.PriceModifier) >> 16;
auto surfaceElement = map_get_surface_element_at(loc); auto surfaceElement = MapGetSurfaceElementAt(loc);
auto heightDifference = (loc.z - surfaceElement->GetBaseZ()) / COORDS_Z_PER_TINY_Z; auto heightDifference = (loc.z - surfaceElement->GetBaseZ()) / COORDS_Z_PER_TINY_Z;
money64 supportCost = heightDifference * ride.GetRideTypeDescriptor().BuildCosts.SupportPrice; money64 supportCost = heightDifference * ride.GetRideTypeDescriptor().BuildCosts.SupportPrice;

View File

@ -114,7 +114,7 @@ static void chairlift_paint_util_draw_supports(paint_session& session, int32_t s
static const TrackElement* chairlift_paint_util_map_get_track_element_at_from_ride_fuzzy( static const TrackElement* chairlift_paint_util_map_get_track_element_at_from_ride_fuzzy(
int32_t x, int32_t y, int32_t z, const Ride& ride) int32_t x, int32_t y, int32_t z, const Ride& ride)
{ {
const TileElement* tileElement = map_get_first_element_at(CoordsXY{ x, y }); const TileElement* tileElement = MapGetFirstElementAt(CoordsXY{ x, y });
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
return nullptr; return nullptr;

View File

@ -161,7 +161,7 @@ void scenario_reset()
date_reset(); date_reset();
Duck::RemoveAll(); Duck::RemoveAll();
ParkCalculateSize(); ParkCalculateSize();
map_count_remaining_land_rights(); MapCountRemainingLandRights();
Staff::ResetStats(); Staff::ResetStats();
auto& objManager = GetContext()->GetObjectManager(); auto& objManager = GetContext()->GetObjectManager();

View File

@ -22,7 +22,7 @@ using namespace OpenRCT2::TrackMetaData;
std::shared_ptr<ScTrackIterator> ScTrackIterator::FromElement(const CoordsXY& position, int32_t elementIndex) std::shared_ptr<ScTrackIterator> ScTrackIterator::FromElement(const CoordsXY& position, int32_t elementIndex)
{ {
auto el = map_get_nth_element_at(position, elementIndex); auto el = MapGetNthElementAt(position, elementIndex);
auto origin = GetTrackSegmentOrigin(CoordsXYE(position, el)); auto origin = GetTrackSegmentOrigin(CoordsXYE(position, el));
if (!origin) if (!origin)
return nullptr; return nullptr;

View File

@ -69,7 +69,7 @@ namespace OpenRCT2::Scripting
DukValue ScTile::data_get() const DukValue ScTile::data_get() const
{ {
auto ctx = GetDukContext(); auto ctx = GetDukContext();
auto first = map_get_first_element_at(_coords); auto first = MapGetFirstElementAt(_coords);
auto dataLen = GetNumElements(first) * sizeof(TileElement); auto dataLen = GetNumElements(first) * sizeof(TileElement);
auto data = duk_push_fixed_buffer(ctx, dataLen); auto data = duk_push_fixed_buffer(ctx, dataLen);
if (first != nullptr) if (first != nullptr)
@ -92,7 +92,7 @@ namespace OpenRCT2::Scripting
auto numElements = dataLen / sizeof(TileElement); auto numElements = dataLen / sizeof(TileElement);
if (numElements == 0) if (numElements == 0)
{ {
map_set_tile_element(TileCoordsXY(_coords), nullptr); MapSetTileElement(TileCoordsXY(_coords), nullptr);
} }
else else
{ {
@ -109,7 +109,7 @@ namespace OpenRCT2::Scripting
} }
// Copy data to element span // Copy data to element span
first = map_get_first_element_at(_coords); first = MapGetFirstElementAt(_coords);
currentNumElements = GetNumElements(first); currentNumElements = GetNumElements(first);
if (currentNumElements != 0) if (currentNumElements != 0)
{ {
@ -202,7 +202,7 @@ namespace OpenRCT2::Scripting
TileElement* ScTile::GetFirstElement() const TileElement* ScTile::GetFirstElement() const
{ {
return map_get_first_element_at(_coords); return MapGetFirstElementAt(_coords);
} }
size_t ScTile::GetNumElements(const TileElement* first) size_t ScTile::GetNumElements(const TileElement* first)

View File

@ -89,7 +89,7 @@ void Banner::FormatTextTo(Formatter& ft) const
*/ */
static RideId BannerGetRideIndexAt(const CoordsXYZ& bannerCoords) static RideId BannerGetRideIndexAt(const CoordsXYZ& bannerCoords)
{ {
TileElement* tileElement = map_get_first_element_at(bannerCoords); TileElement* tileElement = MapGetFirstElementAt(bannerCoords);
RideId resultRideIndex = RideId::GetNull(); RideId resultRideIndex = RideId::GetNull();
if (tileElement == nullptr) if (tileElement == nullptr)
return resultRideIndex; return resultRideIndex;
@ -146,7 +146,7 @@ TileElement* BannerGetTileElement(BannerIndex bannerIndex)
auto banner = GetBanner(bannerIndex); auto banner = GetBanner(bannerIndex);
if (banner != nullptr) if (banner != nullptr)
{ {
auto tileElement = map_get_first_element_at(banner->position); auto tileElement = MapGetFirstElementAt(banner->position);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -167,7 +167,7 @@ WallElement* BannerGetScrollingWallTileElement(BannerIndex bannerIndex)
if (banner == nullptr) if (banner == nullptr)
return nullptr; return nullptr;
auto tileElement = map_get_first_element_at(banner->position); auto tileElement = MapGetFirstElementAt(banner->position);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;

View File

@ -137,7 +137,7 @@ GameActions::Result MapCanConstructWithClearAt(
return res; return res;
} }
TileElement* tileElement = map_get_first_element_at(pos); TileElement* tileElement = MapGetFirstElementAt(pos);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
res.Error = GameActions::Status::Unknown; res.Error = GameActions::Status::Unknown;

View File

@ -139,7 +139,7 @@ void MazeEntranceHedgeReplacement(const CoordsXYE& entrance)
int32_t z = entrance.element->GetBaseZ(); int32_t z = entrance.element->GetBaseZ();
RideId rideIndex = entrance.element->AsEntrance()->GetRideIndex(); RideId rideIndex = entrance.element->AsEntrance()->GetRideIndex();
auto tileElement = map_get_first_element_at(hedgePos); auto tileElement = MapGetFirstElementAt(hedgePos);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -176,7 +176,7 @@ void MazeEntranceHedgeRemoval(const CoordsXYE& entrance)
int32_t z = entrance.element->GetBaseZ(); int32_t z = entrance.element->GetBaseZ();
RideId rideIndex = entrance.element->AsEntrance()->GetRideIndex(); RideId rideIndex = entrance.element->AsEntrance()->GetRideIndex();
auto tileElement = map_get_first_element_at(hedgePos); auto tileElement = MapGetFirstElementAt(hedgePos);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do

View File

@ -118,7 +118,7 @@ static bool entrance_has_direction(const EntranceElement& entranceElement, int32
TileElement* MapGetFootpathElement(const CoordsXYZ& coords) TileElement* MapGetFootpathElement(const CoordsXYZ& coords)
{ {
TileElement* tileElement = map_get_first_element_at(coords); TileElement* tileElement = MapGetFirstElementAt(coords);
do do
{ {
if (tileElement == nullptr) if (tileElement == nullptr)
@ -440,7 +440,7 @@ bool WallInTheWay(const CoordsXYRangedZ& fencePos, int32_t direction)
{ {
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(fencePos); tileElement = MapGetFirstElementAt(fencePos);
if (tileElement == nullptr) if (tileElement == nullptr)
return false; return false;
do do
@ -468,7 +468,7 @@ static PathElement* FootpathConnectCornersGetNeighbour(const CoordsXYZ& footpath
return nullptr; return nullptr;
} }
TileElement* tileElement = map_get_first_element_at(footpathPos); TileElement* tileElement = MapGetFirstElementAt(footpathPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
do do
@ -641,7 +641,7 @@ static void FoopathNeighbourListSort(rct_neighbour_list* neighbourList)
static TileElement* FootpathGetElement(const CoordsXYRangedZ& footpathPos, int32_t direction) static TileElement* FootpathGetElement(const CoordsXYRangedZ& footpathPos, int32_t direction)
{ {
TileElement* tileElement = map_get_first_element_at(footpathPos); TileElement* tileElement = MapGetFirstElementAt(footpathPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
do do
@ -835,7 +835,7 @@ static void loc_6A6D7E(
} }
else else
{ {
TileElement* tileElement = map_get_first_element_at(targetPos); TileElement* tileElement = MapGetFirstElementAt(targetPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -1093,7 +1093,7 @@ void FootpathChainRideQueue(
} }
auto targetQueuePos = curQueuePos + CoordsDirectionDelta[direction]; auto targetQueuePos = curQueuePos + CoordsDirectionDelta[direction];
tileElement = map_get_first_element_at(targetQueuePos); tileElement = MapGetFirstElementAt(targetQueuePos);
bool foundQueue = false; bool foundQueue = false;
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
@ -1223,7 +1223,7 @@ void FootpathUpdateQueueChains()
if (station.Entrance.IsNull()) if (station.Entrance.IsNull())
continue; continue;
TileElement* tileElement = map_get_first_element_at(station.Entrance); TileElement* tileElement = MapGetFirstElementAt(station.Entrance);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -1250,7 +1250,7 @@ void FootpathUpdateQueueChains()
*/ */
static void FootpathFixOwnership(const CoordsXY& mapPos) static void FootpathFixOwnership(const CoordsXY& mapPos)
{ {
const auto* surfaceElement = map_get_surface_element_at(mapPos); const auto* surfaceElement = MapGetSurfaceElementAt(mapPos);
uint16_t ownership; uint16_t ownership;
// Unlikely to be NULL unless deliberate. // Unlikely to be NULL unless deliberate.
@ -1402,7 +1402,7 @@ static int32_t FootpathIsConnectedToMapEdgeHelper(CoordsXYZ footpathPos, int32_t
return FOOTPATH_SEARCH_SUCCESS; return FOOTPATH_SEARCH_SUCCESS;
} }
tileElement = map_get_first_element_at(targetPos); tileElement = MapGetFirstElementAt(targetPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return currentTile.level == 1 ? FOOTPATH_SEARCH_NOT_FOUND : FOOTPATH_SEARCH_INCOMPLETE; return currentTile.level == 1 ? FOOTPATH_SEARCH_NOT_FOUND : FOOTPATH_SEARCH_INCOMPLETE;
@ -1778,7 +1778,7 @@ void PathElement::SetShouldDrawPathOverSupports(bool on)
*/ */
static void FootpathClearWide(const CoordsXY& footpathPos) static void FootpathClearWide(const CoordsXY& footpathPos)
{ {
TileElement* tileElement = map_get_first_element_at(footpathPos); TileElement* tileElement = MapGetFirstElementAt(footpathPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -1797,7 +1797,7 @@ static void FootpathClearWide(const CoordsXY& footpathPos)
*/ */
static TileElement* FootpathCanBeWide(const CoordsXYZ& footpathPos) static TileElement* FootpathCanBeWide(const CoordsXYZ& footpathPos)
{ {
TileElement* tileElement = map_get_first_element_at(footpathPos); TileElement* tileElement = MapGetFirstElementAt(footpathPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
do do
@ -1844,7 +1844,7 @@ void FootpathUpdatePathWideFlags(const CoordsXY& footpathPos)
// FootpathClearWide(x, y); // FootpathClearWide(x, y);
// y -= 0x20; // y -= 0x20;
TileElement* tileElement = map_get_first_element_at(footpathPos); TileElement* tileElement = MapGetFirstElementAt(footpathPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -2083,7 +2083,7 @@ static void FootpathRemoveEdgesTowardsHere(
Direction shiftedDirection = (direction + 1) & 3; Direction shiftedDirection = (direction + 1) & 3;
auto targetFootPathPos = CoordsXYZ{ CoordsXY{ footpathPos } + CoordsDirectionDelta[shiftedDirection], footpathPos.z }; auto targetFootPathPos = CoordsXYZ{ CoordsXY{ footpathPos } + CoordsDirectionDelta[shiftedDirection], footpathPos.z };
tileElement = map_get_first_element_at(targetFootPathPos); tileElement = MapGetFirstElementAt(targetFootPathPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -2114,7 +2114,7 @@ static void FootpathRemoveEdgesTowards(const CoordsXYRangedZ& footPathPos, int32
return; return;
} }
TileElement* tileElement = map_get_first_element_at(footPathPos); TileElement* tileElement = MapGetFirstElementAt(footPathPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -2153,7 +2153,7 @@ static void FootpathRemoveEdgesTowards(const CoordsXYRangedZ& footPathPos, int32
// entrances and exits, shops, paths). // entrances and exits, shops, paths).
bool TileElementWantsPathConnectionTowards(const TileCoordsXYZD& coords, const TileElement* const elementToBeRemoved) bool TileElementWantsPathConnectionTowards(const TileCoordsXYZD& coords, const TileElement* const elementToBeRemoved)
{ {
TileElement* tileElement = map_get_first_element_at(coords); TileElement* tileElement = MapGetFirstElementAt(coords);
if (tileElement == nullptr) if (tileElement == nullptr)
return false; return false;
do do
@ -2245,7 +2245,7 @@ static void FootpathFixCornersAround(const TileCoordsXY& footpathPos, TileElemen
if (xOffset == 0 && yOffset == 0) if (xOffset == 0 && yOffset == 0)
continue; continue;
TileElement* tileElement = map_get_first_element_at( TileElement* tileElement = MapGetFirstElementAt(
TileCoordsXY{ footpathPos.x + xOffset, footpathPos.y + yOffset }.ToCoordsXY()); TileCoordsXY{ footpathPos.x + xOffset, footpathPos.y + yOffset }.ToCoordsXY());
if (tileElement == nullptr) if (tileElement == nullptr)
continue; continue;

View File

@ -174,7 +174,7 @@ std::vector<TileElement> GetReorganisedTileElementsWithoutGhosts()
auto oldSize = newElements.size(); auto oldSize = newElements.size();
// Add all non-ghost elements // Add all non-ghost elements
const auto* element = map_get_first_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); const auto* element = MapGetFirstElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (element != nullptr) if (element != nullptr)
{ {
do do
@ -211,7 +211,7 @@ static void ReorganiseTileElements(size_t capacity)
{ {
for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) for (int32_t x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++)
{ {
const auto* element = map_get_first_element_at(TileCoordsXY{ x, y }); const auto* element = MapGetFirstElementAt(TileCoordsXY{ x, y });
if (element == nullptr) if (element == nullptr)
{ {
newElements.push_back(GetDefaultSurfaceElement()); newElements.push_back(GetDefaultSurfaceElement());
@ -282,14 +282,14 @@ void tile_element_iterator_begin(tile_element_iterator* it)
{ {
it->x = 0; it->x = 0;
it->y = 0; it->y = 0;
it->element = map_get_first_element_at(TileCoordsXY{ 0, 0 }); it->element = MapGetFirstElementAt(TileCoordsXY{ 0, 0 });
} }
int32_t tile_element_iterator_next(tile_element_iterator* it) int32_t tile_element_iterator_next(tile_element_iterator* it)
{ {
if (it->element == nullptr) if (it->element == nullptr)
{ {
it->element = map_get_first_element_at(TileCoordsXY{ it->x, it->y }); it->element = MapGetFirstElementAt(TileCoordsXY{ it->x, it->y });
return 1; return 1;
} }
@ -302,7 +302,7 @@ int32_t tile_element_iterator_next(tile_element_iterator* it)
if (it->y < (MAXIMUM_MAP_SIZE_TECHNICAL - 1)) if (it->y < (MAXIMUM_MAP_SIZE_TECHNICAL - 1))
{ {
it->y++; it->y++;
it->element = map_get_first_element_at(TileCoordsXY{ it->x, it->y }); it->element = MapGetFirstElementAt(TileCoordsXY{ it->x, it->y });
return 1; return 1;
} }
@ -310,7 +310,7 @@ int32_t tile_element_iterator_next(tile_element_iterator* it)
{ {
it->y = 0; it->y = 0;
it->x++; it->x++;
it->element = map_get_first_element_at(TileCoordsXY{ it->x, it->y }); it->element = MapGetFirstElementAt(TileCoordsXY{ it->x, it->y });
return 1; return 1;
} }
@ -329,7 +329,7 @@ static bool IsTileLocationValid(const TileCoordsXY& coords)
return is_x_valid && is_y_valid; return is_x_valid && is_y_valid;
} }
TileElement* map_get_first_element_at(const TileCoordsXY& tilePos) TileElement* MapGetFirstElementAt(const TileCoordsXY& tilePos)
{ {
if (!IsTileLocationValid(tilePos)) if (!IsTileLocationValid(tilePos))
{ {
@ -339,14 +339,14 @@ TileElement* map_get_first_element_at(const TileCoordsXY& tilePos)
return _tileIndex.GetFirstElementAt(tilePos); return _tileIndex.GetFirstElementAt(tilePos);
} }
TileElement* map_get_first_element_at(const CoordsXY& elementPos) TileElement* MapGetFirstElementAt(const CoordsXY& elementPos)
{ {
return map_get_first_element_at(TileCoordsXY{ elementPos }); return MapGetFirstElementAt(TileCoordsXY{ elementPos });
} }
TileElement* map_get_nth_element_at(const CoordsXY& coords, int32_t n) TileElement* MapGetNthElementAt(const CoordsXY& coords, int32_t n)
{ {
TileElement* tileElement = map_get_first_element_at(coords); TileElement* tileElement = MapGetFirstElementAt(coords);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
return nullptr; return nullptr;
@ -373,7 +373,7 @@ TileElement* map_get_nth_element_at(const CoordsXY& coords, int32_t n)
TileElement* MapGetFirstTileElementWithBaseHeightBetween(const TileCoordsXYRangedZ& loc, TileElementType type) TileElement* MapGetFirstTileElementWithBaseHeightBetween(const TileCoordsXYRangedZ& loc, TileElementType type)
{ {
TileElement* tileElement = map_get_first_element_at(loc.ToCoordsXY()); TileElement* tileElement = MapGetFirstElementAt(loc.ToCoordsXY());
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
do do
@ -387,7 +387,7 @@ TileElement* MapGetFirstTileElementWithBaseHeightBetween(const TileCoordsXYRange
return nullptr; return nullptr;
} }
void map_set_tile_element(const TileCoordsXY& tilePos, TileElement* elements) void MapSetTileElement(const TileCoordsXY& tilePos, TileElement* elements)
{ {
if (!map_is_location_valid(tilePos.ToCoordsXY())) if (!map_is_location_valid(tilePos.ToCoordsXY()))
{ {
@ -397,7 +397,7 @@ void map_set_tile_element(const TileCoordsXY& tilePos, TileElement* elements)
_tileIndex.SetTile(tilePos, elements); _tileIndex.SetTile(tilePos, elements);
} }
SurfaceElement* map_get_surface_element_at(const CoordsXY& coords) SurfaceElement* MapGetSurfaceElementAt(const CoordsXY& coords)
{ {
auto view = TileElementsView<SurfaceElement>(coords); auto view = TileElementsView<SurfaceElement>(coords);
@ -417,7 +417,7 @@ PathElement* map_get_path_element_at(const TileCoordsXYZ& loc)
return nullptr; return nullptr;
} }
BannerElement* map_get_banner_element_at(const CoordsXYZ& bannerPos, uint8_t position) BannerElement* MapGetBannerElementAt(const CoordsXYZ& bannerPos, uint8_t position)
{ {
const auto bannerTilePos = TileCoordsXYZ{ bannerPos }; const auto bannerTilePos = TileCoordsXYZ{ bannerPos };
for (auto* element : TileElementsView<BannerElement>(bannerPos)) for (auto* element : TileElementsView<BannerElement>(bannerPos))
@ -435,7 +435,7 @@ BannerElement* map_get_banner_element_at(const CoordsXYZ& bannerPos, uint8_t pos
* *
* rct2: 0x0068AB4C * rct2: 0x0068AB4C
*/ */
void map_init(const TileCoordsXY& size) void MapInit(const TileCoordsXY& size)
{ {
auto numTiles = MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL; auto numTiles = MAXIMUM_MAP_SIZE_TECHNICAL * MAXIMUM_MAP_SIZE_TECHNICAL;
SetTileElements(std::vector<TileElement>(numTiles, GetDefaultSurfaceElement())); SetTileElements(std::vector<TileElement>(numTiles, GetDefaultSurfaceElement()));
@ -456,7 +456,7 @@ void map_init(const TileCoordsXY& size)
* but haven't been bought yet. It updates gLandRemainingOwnershipSales and * but haven't been bought yet. It updates gLandRemainingOwnershipSales and
* gLandRemainingConstructionSales. * gLandRemainingConstructionSales.
*/ */
void map_count_remaining_land_rights() void MapCountRemainingLandRights()
{ {
gLandRemainingOwnershipSales = 0; gLandRemainingOwnershipSales = 0;
gLandRemainingConstructionSales = 0; gLandRemainingConstructionSales = 0;
@ -465,7 +465,7 @@ void map_count_remaining_land_rights()
{ {
for (int32_t x = 0; x < gMapSize.x; x++) for (int32_t x = 0; x < gMapSize.x; x++)
{ {
auto* surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto* surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
// Surface elements are sometimes hacked out to save some space for other map elements // Surface elements are sometimes hacked out to save some space for other map elements
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
@ -501,7 +501,7 @@ void map_count_remaining_land_rights()
* This is less invasive than removing ghost elements themselves, as they can * This is less invasive than removing ghost elements themselves, as they can
* contain valid data. * contain valid data.
*/ */
void map_strip_ghost_flag_from_elements() void MapStripGhostFlagFromElements()
{ {
for (auto& element : _tileElements) for (auto& element : _tileElements)
{ {
@ -524,7 +524,7 @@ int16_t tile_element_height(const CoordsXY& loc)
return MINIMUM_LAND_HEIGHT_BIG; return MINIMUM_LAND_HEIGHT_BIG;
// Get the surface element for the tile // Get the surface element for the tile
auto surfaceElement = map_get_surface_element_at(loc); auto surfaceElement = MapGetSurfaceElementAt(loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
@ -661,7 +661,7 @@ int16_t tile_element_water_height(const CoordsXY& loc)
return 0; return 0;
// Get the surface element for the tile // Get the surface element for the tile
auto surfaceElement = map_get_surface_element_at(loc); auto surfaceElement = MapGetSurfaceElementAt(loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
@ -677,7 +677,7 @@ int16_t tile_element_water_height(const CoordsXY& loc)
*/ */
bool map_coord_is_connected(const TileCoordsXYZ& loc, uint8_t faceDirection) bool map_coord_is_connected(const TileCoordsXYZ& loc, uint8_t faceDirection)
{ {
TileElement* tileElement = map_get_first_element_at(loc); TileElement* tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return false; return false;
@ -753,7 +753,7 @@ void map_update_path_wide_flags()
* *
* rct2: 0x006A7B84 * rct2: 0x006A7B84
*/ */
int32_t map_height_from_slope(const CoordsXY& coords, int32_t slopeDirection, bool isSloped) int32_t MapHeightFromSlope(const CoordsXY& coords, int32_t slopeDirection, bool isSloped)
{ {
if (!isSloped) if (!isSloped)
return 0; return 0;
@ -805,7 +805,7 @@ bool map_is_location_owned(const CoordsXYZ& loc)
// This check is to avoid throwing lots of messages in logs. // This check is to avoid throwing lots of messages in logs.
if (map_is_location_valid(loc)) if (map_is_location_valid(loc))
{ {
auto* surfaceElement = map_get_surface_element_at(loc); auto* surfaceElement = MapGetSurfaceElementAt(loc);
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
if (surfaceElement->GetOwnership() & OWNERSHIP_OWNED) if (surfaceElement->GetOwnership() & OWNERSHIP_OWNED)
@ -829,7 +829,7 @@ bool map_is_location_in_park(const CoordsXY& coords)
{ {
if (map_is_location_valid(coords)) if (map_is_location_valid(coords))
{ {
auto surfaceElement = map_get_surface_element_at(coords); auto surfaceElement = MapGetSurfaceElementAt(coords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
return false; return false;
if (surfaceElement->GetOwnership() & OWNERSHIP_OWNED) if (surfaceElement->GetOwnership() & OWNERSHIP_OWNED)
@ -842,7 +842,7 @@ bool map_is_location_owned_or_has_rights(const CoordsXY& loc)
{ {
if (map_is_location_valid(loc)) if (map_is_location_valid(loc))
{ {
auto surfaceElement = map_get_surface_element_at(loc); auto surfaceElement = MapGetSurfaceElementAt(loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
return false; return false;
@ -1008,7 +1008,7 @@ uint8_t map_get_lowest_land_height(const MapRange& range)
{ {
for (int32_t xi = validRange.GetLeft(); xi <= validRange.GetRight(); xi += COORDS_XY_STEP) for (int32_t xi = validRange.GetLeft(); xi <= validRange.GetRight(); xi += COORDS_XY_STEP)
{ {
auto* surfaceElement = map_get_surface_element_at(CoordsXY{ xi, yi }); auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ xi, yi });
if (surfaceElement != nullptr && min_height > surfaceElement->base_height) if (surfaceElement != nullptr && min_height > surfaceElement->base_height)
{ {
@ -1038,7 +1038,7 @@ uint8_t map_get_highest_land_height(const MapRange& range)
{ {
for (int32_t xi = validRange.GetLeft(); xi <= validRange.GetRight(); xi += COORDS_XY_STEP) for (int32_t xi = validRange.GetLeft(); xi <= validRange.GetRight(); xi += COORDS_XY_STEP)
{ {
auto* surfaceElement = map_get_surface_element_at(CoordsXY{ xi, yi }); auto* surfaceElement = MapGetSurfaceElementAt(CoordsXY{ xi, yi });
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode) if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !gCheatsSandboxMode)
@ -1330,7 +1330,7 @@ void map_update_tiles()
for (int32_t blockX = 0; blockX < gMapSize.x; blockX += 256) for (int32_t blockX = 0; blockX < gMapSize.x; blockX += 256)
{ {
auto mapPos = TileCoordsXY{ blockX + x, blockY + y }.ToCoordsXY(); auto mapPos = TileCoordsXY{ blockX + x, blockY + y }.ToCoordsXY();
auto* surfaceElement = map_get_surface_element_at(mapPos); auto* surfaceElement = MapGetSurfaceElementAt(mapPos);
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
surfaceElement->UpdateGrassLength(mapPos); surfaceElement->UpdateGrassLength(mapPos);
@ -1415,7 +1415,7 @@ void map_remove_out_of_range_elements()
if (x == 0 || y == 0 || x >= mapSizeMax.x || y >= mapSizeMax.y) if (x == 0 || y == 0 || x >= mapSizeMax.x || y >= mapSizeMax.y)
{ {
// Note this purposely does not use LandSetRightsAction as X Y coordinates are outside of normal range. // Note this purposely does not use LandSetRightsAction as X Y coordinates are outside of normal range.
auto surfaceElement = map_get_surface_element_at(CoordsXY{ x, y }); auto surfaceElement = MapGetSurfaceElementAt(CoordsXY{ x, y });
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
surfaceElement->SetOwnership(OWNERSHIP_UNOWNED); surfaceElement->SetOwnership(OWNERSHIP_UNOWNED);
@ -1475,8 +1475,8 @@ void map_extend_boundary_surface_y()
auto y = gMapSize.y - 2; auto y = gMapSize.y - 2;
for (auto x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++) for (auto x = 0; x < MAXIMUM_MAP_SIZE_TECHNICAL; x++)
{ {
auto existingTileElement = map_get_surface_element_at(TileCoordsXY{ x, y - 1 }.ToCoordsXY()); auto existingTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y - 1 }.ToCoordsXY());
auto newTileElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto newTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (existingTileElement != nullptr && newTileElement != nullptr) if (existingTileElement != nullptr && newTileElement != nullptr)
{ {
@ -1495,8 +1495,8 @@ void map_extend_boundary_surface_x()
auto x = gMapSize.x - 2; auto x = gMapSize.x - 2;
for (auto y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++) for (auto y = 0; y < MAXIMUM_MAP_SIZE_TECHNICAL; y++)
{ {
auto existingTileElement = map_get_surface_element_at(TileCoordsXY{ x - 1, y }.ToCoordsXY()); auto existingTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x - 1, y }.ToCoordsXY());
auto newTileElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto newTileElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (existingTileElement != nullptr && newTileElement != nullptr) if (existingTileElement != nullptr && newTileElement != nullptr)
{ {
map_extend_boundary_surface_extend_tile(*existingTileElement, *newTileElement); map_extend_boundary_surface_extend_tile(*existingTileElement, *newTileElement);
@ -1606,7 +1606,7 @@ static void clear_elements_at(const CoordsXY& loc)
[loc](const CoordsXY& spawn) { return spawn.ToTileStart() == loc.ToTileStart(); }), [loc](const CoordsXY& spawn) { return spawn.ToTileStart() == loc.ToTileStart(); }),
gPeepSpawns.end()); gPeepSpawns.end());
TileElement* tileElement = map_get_first_element_at(loc); TileElement* tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
@ -1620,7 +1620,7 @@ static void clear_elements_at(const CoordsXY& loc)
int32_t map_get_highest_z(const CoordsXY& loc) int32_t map_get_highest_z(const CoordsXY& loc)
{ {
auto surfaceElement = map_get_surface_element_at(loc); auto surfaceElement = MapGetSurfaceElementAt(loc);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
return -1; return -1;
@ -1638,7 +1638,7 @@ int32_t map_get_highest_z(const CoordsXY& loc)
LargeSceneryElement* map_get_large_scenery_segment(const CoordsXYZD& sceneryPos, int32_t sequence) LargeSceneryElement* map_get_large_scenery_segment(const CoordsXYZD& sceneryPos, int32_t sequence)
{ {
TileElement* tileElement = map_get_first_element_at(sceneryPos); TileElement* tileElement = MapGetFirstElementAt(sceneryPos);
if (tileElement == nullptr) if (tileElement == nullptr)
{ {
return nullptr; return nullptr;
@ -1663,7 +1663,7 @@ LargeSceneryElement* map_get_large_scenery_segment(const CoordsXYZD& sceneryPos,
EntranceElement* map_get_park_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost) EntranceElement* map_get_park_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost)
{ {
auto entranceTileCoords = TileCoordsXYZ(entranceCoords); auto entranceTileCoords = TileCoordsXYZ(entranceCoords);
TileElement* tileElement = map_get_first_element_at(entranceCoords); TileElement* tileElement = MapGetFirstElementAt(entranceCoords);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -1689,7 +1689,7 @@ EntranceElement* map_get_park_entrance_element_at(const CoordsXYZ& entranceCoord
EntranceElement* map_get_ride_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost) EntranceElement* map_get_ride_entrance_element_at(const CoordsXYZ& entranceCoords, bool ghost)
{ {
auto entranceTileCoords = TileCoordsXYZ{ entranceCoords }; auto entranceTileCoords = TileCoordsXYZ{ entranceCoords };
TileElement* tileElement = map_get_first_element_at(entranceCoords); TileElement* tileElement = MapGetFirstElementAt(entranceCoords);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -1715,7 +1715,7 @@ EntranceElement* map_get_ride_entrance_element_at(const CoordsXYZ& entranceCoord
EntranceElement* map_get_ride_exit_element_at(const CoordsXYZ& exitCoords, bool ghost) EntranceElement* map_get_ride_exit_element_at(const CoordsXYZ& exitCoords, bool ghost)
{ {
auto exitTileCoords = TileCoordsXYZ{ exitCoords }; auto exitTileCoords = TileCoordsXYZ{ exitCoords };
TileElement* tileElement = map_get_first_element_at(exitCoords); TileElement* tileElement = MapGetFirstElementAt(exitCoords);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -1741,7 +1741,7 @@ EntranceElement* map_get_ride_exit_element_at(const CoordsXYZ& exitCoords, bool
SmallSceneryElement* map_get_small_scenery_element_at(const CoordsXYZ& sceneryCoords, int32_t type, uint8_t quadrant) SmallSceneryElement* map_get_small_scenery_element_at(const CoordsXYZ& sceneryCoords, int32_t type, uint8_t quadrant)
{ {
auto sceneryTileCoords = TileCoordsXYZ{ sceneryCoords }; auto sceneryTileCoords = TileCoordsXYZ{ sceneryCoords };
TileElement* tileElement = map_get_first_element_at(sceneryCoords); TileElement* tileElement = MapGetFirstElementAt(sceneryCoords);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -1938,7 +1938,7 @@ bool map_surface_is_blocked(const CoordsXY& mapCoords)
if (!map_is_location_valid(mapCoords)) if (!map_is_location_valid(mapCoords))
return true; return true;
auto surfaceElement = map_get_surface_element_at(mapCoords); auto surfaceElement = MapGetSurfaceElementAt(mapCoords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
{ {
@ -1999,7 +1999,7 @@ void map_clear_all_elements()
*/ */
TrackElement* map_get_track_element_at(const CoordsXYZ& trackPos) TrackElement* map_get_track_element_at(const CoordsXYZ& trackPos)
{ {
TileElement* tileElement = map_get_first_element_at(trackPos); TileElement* tileElement = MapGetFirstElementAt(trackPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
do do
@ -2023,7 +2023,7 @@ TrackElement* map_get_track_element_at(const CoordsXYZ& trackPos)
*/ */
TileElement* map_get_track_element_at_of_type(const CoordsXYZ& trackPos, track_type_t trackType) TileElement* map_get_track_element_at_of_type(const CoordsXYZ& trackPos, track_type_t trackType)
{ {
TileElement* tileElement = map_get_first_element_at(trackPos); TileElement* tileElement = MapGetFirstElementAt(trackPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
auto trackTilePos = TileCoordsXYZ{ trackPos }; auto trackTilePos = TileCoordsXYZ{ trackPos };
@ -2050,7 +2050,7 @@ TileElement* map_get_track_element_at_of_type(const CoordsXYZ& trackPos, track_t
*/ */
TileElement* map_get_track_element_at_of_type_seq(const CoordsXYZ& trackPos, track_type_t trackType, int32_t sequence) TileElement* map_get_track_element_at_of_type_seq(const CoordsXYZ& trackPos, track_type_t trackType, int32_t sequence)
{ {
TileElement* tileElement = map_get_first_element_at(trackPos); TileElement* tileElement = MapGetFirstElementAt(trackPos);
auto trackTilePos = TileCoordsXYZ{ trackPos }; auto trackTilePos = TileCoordsXYZ{ trackPos };
do do
{ {
@ -2073,7 +2073,7 @@ TileElement* map_get_track_element_at_of_type_seq(const CoordsXYZ& trackPos, tra
TrackElement* map_get_track_element_at_of_type(const CoordsXYZD& location, track_type_t trackType) TrackElement* map_get_track_element_at_of_type(const CoordsXYZD& location, track_type_t trackType)
{ {
auto tileElement = map_get_first_element_at(location); auto tileElement = MapGetFirstElementAt(location);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -2096,7 +2096,7 @@ TrackElement* map_get_track_element_at_of_type(const CoordsXYZD& location, track
TrackElement* map_get_track_element_at_of_type_seq(const CoordsXYZD& location, track_type_t trackType, int32_t sequence) TrackElement* map_get_track_element_at_of_type_seq(const CoordsXYZD& location, track_type_t trackType, int32_t sequence)
{ {
auto tileElement = map_get_first_element_at(location); auto tileElement = MapGetFirstElementAt(location);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -2127,7 +2127,7 @@ TrackElement* map_get_track_element_at_of_type_seq(const CoordsXYZD& location, t
*/ */
TileElement* map_get_track_element_at_of_type_from_ride(const CoordsXYZ& trackPos, track_type_t trackType, RideId rideIndex) TileElement* map_get_track_element_at_of_type_from_ride(const CoordsXYZ& trackPos, track_type_t trackType, RideId rideIndex)
{ {
TileElement* tileElement = map_get_first_element_at(trackPos); TileElement* tileElement = MapGetFirstElementAt(trackPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
auto trackTilePos = TileCoordsXYZ{ trackPos }; auto trackTilePos = TileCoordsXYZ{ trackPos };
@ -2156,7 +2156,7 @@ TileElement* map_get_track_element_at_of_type_from_ride(const CoordsXYZ& trackPo
*/ */
TileElement* map_get_track_element_at_from_ride(const CoordsXYZ& trackPos, RideId rideIndex) TileElement* map_get_track_element_at_from_ride(const CoordsXYZ& trackPos, RideId rideIndex)
{ {
TileElement* tileElement = map_get_first_element_at(trackPos); TileElement* tileElement = MapGetFirstElementAt(trackPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
auto trackTilePos = TileCoordsXYZ{ trackPos }; auto trackTilePos = TileCoordsXYZ{ trackPos };
@ -2184,7 +2184,7 @@ TileElement* map_get_track_element_at_from_ride(const CoordsXYZ& trackPos, RideI
*/ */
TileElement* map_get_track_element_at_with_direction_from_ride(const CoordsXYZD& trackPos, RideId rideIndex) TileElement* map_get_track_element_at_with_direction_from_ride(const CoordsXYZD& trackPos, RideId rideIndex)
{ {
TileElement* tileElement = map_get_first_element_at(trackPos); TileElement* tileElement = MapGetFirstElementAt(trackPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
auto trackTilePos = TileCoordsXYZ{ trackPos }; auto trackTilePos = TileCoordsXYZ{ trackPos };
@ -2207,7 +2207,7 @@ TileElement* map_get_track_element_at_with_direction_from_ride(const CoordsXYZD&
WallElement* map_get_wall_element_at(const CoordsXYRangedZ& coords) WallElement* map_get_wall_element_at(const CoordsXYRangedZ& coords)
{ {
auto tileElement = map_get_first_element_at(coords); auto tileElement = MapGetFirstElementAt(coords);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
@ -2227,7 +2227,7 @@ WallElement* map_get_wall_element_at(const CoordsXYRangedZ& coords)
WallElement* map_get_wall_element_at(const CoordsXYZD& wallCoords) WallElement* map_get_wall_element_at(const CoordsXYZD& wallCoords)
{ {
auto tileWallCoords = TileCoordsXYZ(wallCoords); auto tileWallCoords = TileCoordsXYZ(wallCoords);
TileElement* tileElement = map_get_first_element_at(wallCoords); TileElement* tileElement = MapGetFirstElementAt(wallCoords);
if (tileElement == nullptr) if (tileElement == nullptr)
return nullptr; return nullptr;
do do
@ -2246,7 +2246,7 @@ WallElement* map_get_wall_element_at(const CoordsXYZD& wallCoords)
uint16_t check_max_allowable_land_rights_for_tile(const CoordsXYZ& tileMapPos) uint16_t check_max_allowable_land_rights_for_tile(const CoordsXYZ& tileMapPos)
{ {
TileElement* tileElement = map_get_first_element_at(tileMapPos); TileElement* tileElement = MapGetFirstElementAt(tileMapPos);
uint16_t destOwnership = OWNERSHIP_OWNED; uint16_t destOwnership = OWNERSHIP_OWNED;
// Sometimes done deliberately. // Sometimes done deliberately.
@ -2285,7 +2285,7 @@ void FixLandOwnershipTilesWithOwnership(std::initializer_list<TileCoordsXY> tile
{ {
for (const TileCoordsXY* tile = tiles.begin(); tile != tiles.end(); ++tile) for (const TileCoordsXY* tile = tiles.begin(); tile != tiles.end(); ++tile)
{ {
auto surfaceElement = map_get_surface_element_at(tile->ToCoordsXY()); auto surfaceElement = MapGetSurfaceElementAt(tile->ToCoordsXY());
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
if (doNotDowngrade && surfaceElement->GetOwnership() == OWNERSHIP_OWNED) if (doNotDowngrade && surfaceElement->GetOwnership() == OWNERSHIP_OWNED)

View File

@ -157,18 +157,18 @@ void StashMap();
void UnstashMap(); void UnstashMap();
std::vector<TileElement> GetReorganisedTileElementsWithoutGhosts(); std::vector<TileElement> GetReorganisedTileElementsWithoutGhosts();
void map_init(const TileCoordsXY& size); void MapInit(const TileCoordsXY& size);
void map_count_remaining_land_rights(); void MapCountRemainingLandRights();
void map_strip_ghost_flag_from_elements(); void MapStripGhostFlagFromElements();
TileElement* map_get_first_element_at(const CoordsXY& tilePos); TileElement* MapGetFirstElementAt(const CoordsXY& tilePos);
TileElement* map_get_first_element_at(const TileCoordsXY& tilePos); TileElement* MapGetFirstElementAt(const TileCoordsXY& tilePos);
TileElement* map_get_nth_element_at(const CoordsXY& coords, int32_t n); TileElement* MapGetNthElementAt(const CoordsXY& coords, int32_t n);
TileElement* MapGetFirstTileElementWithBaseHeightBetween(const TileCoordsXYRangedZ& loc, TileElementType type); TileElement* MapGetFirstTileElementWithBaseHeightBetween(const TileCoordsXYRangedZ& loc, TileElementType type);
void map_set_tile_element(const TileCoordsXY& tilePos, TileElement* elements); void MapSetTileElement(const TileCoordsXY& tilePos, TileElement* elements);
int32_t map_height_from_slope(const CoordsXY& coords, int32_t slopeDirection, bool isSloped); int32_t MapHeightFromSlope(const CoordsXY& coords, int32_t slopeDirection, bool isSloped);
BannerElement* map_get_banner_element_at(const CoordsXYZ& bannerPos, uint8_t direction); BannerElement* MapGetBannerElementAt(const CoordsXYZ& bannerPos, uint8_t direction);
SurfaceElement* map_get_surface_element_at(const CoordsXY& coords); SurfaceElement* MapGetSurfaceElementAt(const CoordsXY& coords);
PathElement* map_get_path_element_at(const TileCoordsXYZ& loc); 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 CoordsXYZD& wallCoords);
WallElement* map_get_wall_element_at(const CoordsXYRangedZ& coords); WallElement* map_get_wall_element_at(const CoordsXYRangedZ& coords);
@ -234,9 +234,9 @@ void map_extend_boundary_surface_x();
void map_extend_boundary_surface_y(); void map_extend_boundary_surface_y();
bool map_large_scenery_sign_set_colour(const CoordsXYZD& signPos, int32_t sequence, uint8_t mainColour, uint8_t textColour); bool map_large_scenery_sign_set_colour(const CoordsXYZD& signPos, int32_t sequence, uint8_t mainColour, uint8_t textColour);
void wall_remove_at(const CoordsXYRangedZ& wallPos); void WallRemoveAt(const CoordsXYRangedZ& wallPos);
void wall_remove_at_z(const CoordsXYZ& wallPos); void WallRemoveAtZ(const CoordsXYZ& wallPos);
void wall_remove_intersecting_walls(const CoordsXYRangedZ& wallPos, Direction direction); void WallRemoveIntersectingWalls(const CoordsXYRangedZ& wallPos, Direction direction);
void map_invalidate_tile(const CoordsXYRangedZ& tilePos); void map_invalidate_tile(const CoordsXYRangedZ& tilePos);
void map_invalidate_tile_zoom1(const CoordsXYRangedZ& tilePos); void map_invalidate_tile_zoom1(const CoordsXYRangedZ& tilePos);

View File

@ -94,7 +94,7 @@ void MapAnimationInvalidateAll()
static bool MapAnimationInvalidateRideEntrance(const CoordsXYZ& loc) static bool MapAnimationInvalidateRideEntrance(const CoordsXYZ& loc)
{ {
TileCoordsXYZ tileLoc{ loc }; TileCoordsXYZ tileLoc{ loc };
auto tileElement = map_get_first_element_at(loc); auto tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -131,7 +131,7 @@ static bool MapAnimationInvalidateQueueBanner(const CoordsXYZ& loc)
TileCoordsXYZ tileLoc{ loc }; TileCoordsXYZ tileLoc{ loc };
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -164,7 +164,7 @@ static bool MapAnimationInvalidateSmallScenery(const CoordsXYZ& loc)
{ {
TileCoordsXYZ tileLoc{ loc }; TileCoordsXYZ tileLoc{ loc };
auto tileElement = map_get_first_element_at(loc); auto tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -229,7 +229,7 @@ static bool MapAnimationInvalidateParkEntrance(const CoordsXYZ& loc)
TileCoordsXYZ tileLoc{ loc }; TileCoordsXYZ tileLoc{ loc };
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -259,7 +259,7 @@ static bool MapAnimationInvalidateTrackWaterfall(const CoordsXYZ& loc)
TileCoordsXYZ tileLoc{ loc }; TileCoordsXYZ tileLoc{ loc };
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -288,7 +288,7 @@ static bool MapAnimationInvalidateTrackRapids(const CoordsXYZ& loc)
TileCoordsXYZ tileLoc{ loc }; TileCoordsXYZ tileLoc{ loc };
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -317,7 +317,7 @@ static bool MapAnimationInvalidateTrackOnRidePhoto(const CoordsXYZ& loc)
TileCoordsXYZ tileLoc{ loc }; TileCoordsXYZ tileLoc{ loc };
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -356,7 +356,7 @@ static bool MapAnimationInvalidateTrackWhirlpool(const CoordsXYZ& loc)
TileCoordsXYZ tileLoc{ loc }; TileCoordsXYZ tileLoc{ loc };
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -385,7 +385,7 @@ static bool MapAnimationInvalidateTrackSpinningTunnel(const CoordsXYZ& loc)
TileCoordsXYZ tileLoc{ loc }; TileCoordsXYZ tileLoc{ loc };
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -423,7 +423,7 @@ static bool MapAnimationInvalidateBanner(const CoordsXYZ& loc)
TileCoordsXYZ tileLoc{ loc }; TileCoordsXYZ tileLoc{ loc };
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -449,7 +449,7 @@ static bool MapAnimationInvalidateLargeScenery(const CoordsXYZ& loc)
TileElement* tileElement; TileElement* tileElement;
bool wasInvalidated = false; bool wasInvalidated = false;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do
@ -483,7 +483,7 @@ static bool MapAnimationInvalidateWallDoor(const CoordsXYZ& loc)
return false; return false;
bool removeAnimation = true; bool removeAnimation = true;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return removeAnimation; return removeAnimation;
do do
@ -544,7 +544,7 @@ static bool MapAnimationInvalidateWall(const CoordsXYZ& loc)
TileElement* tileElement; TileElement* tileElement;
bool wasInvalidated = false; bool wasInvalidated = false;
tileElement = map_get_first_element_at(loc); tileElement = MapGetFirstElementAt(loc);
if (tileElement == nullptr) if (tileElement == nullptr)
return true; return true;
do do

View File

@ -120,12 +120,12 @@ void MapGenGenerateBlank(mapgen_settings* settings)
int32_t x, y; int32_t x, y;
map_clear_all_elements(); map_clear_all_elements();
map_init(settings->mapSize); MapInit(settings->mapSize);
for (y = 1; y < settings->mapSize.y - 1; y++) for (y = 1; y < settings->mapSize.y - 1; y++)
{ {
for (x = 1; x < settings->mapSize.x - 1; x++) for (x = 1; x < settings->mapSize.x - 1; x++)
{ {
auto surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
surfaceElement->SetSurfaceStyle(settings->floor); surfaceElement->SetSurfaceStyle(settings->floor);
@ -184,12 +184,12 @@ void MapGenGenerate(mapgen_settings* settings)
map_clear_all_elements(); map_clear_all_elements();
// Initialise the base map // Initialise the base map
map_init(mapSize); MapInit(mapSize);
for (auto y = 1; y < mapSize.y - 1; y++) for (auto y = 1; y < mapSize.y - 1; y++)
{ {
for (auto x = 1; x < mapSize.x - 1; x++) for (auto x = 1; x < mapSize.x - 1; x++)
{ {
auto surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (surfaceElement != nullptr) if (surfaceElement != nullptr)
{ {
surfaceElement->SetSurfaceStyle(floorTextureId); surfaceElement->SetSurfaceStyle(floorTextureId);
@ -239,7 +239,7 @@ void MapGenGenerate(mapgen_settings* settings)
{ {
for (auto x = 1; x < mapSize.x - 1; x++) for (auto x = 1; x < mapSize.x - 1; x++)
{ {
auto surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (surfaceElement != nullptr && surfaceElement->base_height < waterLevel + 6) if (surfaceElement != nullptr && surfaceElement->base_height < waterLevel + 6)
surfaceElement->SetSurfaceStyle(beachTextureId); surfaceElement->SetSurfaceStyle(beachTextureId);
@ -253,7 +253,7 @@ void MapGenGenerate(mapgen_settings* settings)
static void MapGenPlaceTree(ObjectEntryIndex type, const CoordsXY& loc) static void MapGenPlaceTree(ObjectEntryIndex type, const CoordsXY& loc)
{ {
auto* sceneryEntry = get_small_scenery_entry(type); auto* sceneryEntry = GetSmallSceneryEntry(type);
if (sceneryEntry == nullptr) if (sceneryEntry == nullptr)
{ {
return; return;
@ -311,7 +311,7 @@ static void MapGenPlaceTrees()
for (int32_t i = 0; i < object_entry_group_counts[EnumValue(ObjectType::SmallScenery)]; i++) for (int32_t i = 0; i < object_entry_group_counts[EnumValue(ObjectType::SmallScenery)]; i++)
{ {
auto* sceneryEntry = get_small_scenery_entry(i); auto* sceneryEntry = GetSmallSceneryEntry(i);
auto entry = object_entry_get_object(ObjectType::SmallScenery, i); auto entry = object_entry_get_object(ObjectType::SmallScenery, i);
if (sceneryEntry == nullptr) if (sceneryEntry == nullptr)
@ -341,7 +341,7 @@ static void MapGenPlaceTrees()
pos.x = x * COORDS_XY_STEP; pos.x = x * COORDS_XY_STEP;
pos.y = y * COORDS_XY_STEP; pos.y = y * COORDS_XY_STEP;
auto* surfaceElement = map_get_surface_element_at(pos); auto* surfaceElement = MapGetSurfaceElementAt(pos);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;
@ -368,7 +368,7 @@ static void MapGenPlaceTrees()
neighbourPos.x = std::clamp(neighbourPos.x, COORDS_XY_STEP, COORDS_XY_STEP * (gMapSize.x - 1)); neighbourPos.x = std::clamp(neighbourPos.x, COORDS_XY_STEP, COORDS_XY_STEP * (gMapSize.x - 1));
neighbourPos.y = std::clamp(neighbourPos.y, COORDS_XY_STEP, COORDS_XY_STEP * (gMapSize.y - 1)); neighbourPos.y = std::clamp(neighbourPos.y, COORDS_XY_STEP, COORDS_XY_STEP * (gMapSize.y - 1));
const auto neighboutSurface = map_get_surface_element_at(neighbourPos); const auto neighboutSurface = MapGetSurfaceElementAt(neighbourPos);
if (neighboutSurface->GetWaterHeight() > 0) if (neighboutSurface->GetWaterHeight() > 0)
{ {
float distance = std::sqrt(offsetX * offsetX + offsetY * offsetY); float distance = std::sqrt(offsetX * offsetX + offsetY * offsetY);
@ -418,7 +418,7 @@ static void MapGenSetWaterLevel(int32_t waterLevel)
{ {
for (int32_t x = 1; x < gMapSize.x - 1; x++) for (int32_t x = 1; x < gMapSize.x - 1; x++)
{ {
auto surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (surfaceElement != nullptr && surfaceElement->base_height < waterLevel) if (surfaceElement != nullptr && surfaceElement->base_height < waterLevel)
surfaceElement->SetWaterHeight(waterLevel * COORDS_Z_STEP); surfaceElement->SetWaterHeight(waterLevel * COORDS_Z_STEP);
} }
@ -479,7 +479,7 @@ static void MapGenSetHeight(mapgen_settings* settings)
uint8_t baseHeight = (q00 + q01 + q10 + q11) / 4; uint8_t baseHeight = (q00 + q01 + q10 + q11) / 4;
auto surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;
surfaceElement->base_height = std::max(2, baseHeight * 2); surfaceElement->base_height = std::max(2, baseHeight * 2);
@ -802,7 +802,7 @@ void MapGenGenerateFromHeightmap(mapgen_settings* settings)
// Get technical map size, +2 for the black tiles around the map // Get technical map size, +2 for the black tiles around the map
auto maxWidth = static_cast<int32_t>(_heightMapData.width + 2); auto maxWidth = static_cast<int32_t>(_heightMapData.width + 2);
auto maxHeight = static_cast<int32_t>(_heightMapData.height + 2); auto maxHeight = static_cast<int32_t>(_heightMapData.height + 2);
map_init({ maxHeight, maxWidth }); MapInit({ maxHeight, maxWidth });
if (settings->smooth_height_map) if (settings->smooth_height_map)
{ {
@ -846,7 +846,7 @@ void MapGenGenerateFromHeightmap(mapgen_settings* settings)
{ {
// The x and y axis are flipped in the world, so this uses y for x and x for y. // The x and y axis are flipped in the world, so this uses y for x and x for y.
auto tileCoords = MapgenHeightmapCoordToTileCoordsXY(x, y); auto tileCoords = MapgenHeightmapCoordToTileCoordsXY(x, y);
auto* const surfaceElement = map_get_surface_element_at(tileCoords.ToCoordsXY()); auto* const surfaceElement = MapGetSurfaceElementAt(tileCoords.ToCoordsXY());
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;

View File

@ -16,7 +16,7 @@
static uint8_t GetBaseHeightOrZero(int32_t x, int32_t y) static uint8_t GetBaseHeightOrZero(int32_t x, int32_t y)
{ {
auto surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
return surfaceElement != nullptr ? surfaceElement->base_height : 0; return surfaceElement != nullptr ? surfaceElement->base_height : 0;
} }
@ -31,7 +31,7 @@ int32_t MapSmooth(int32_t l, int32_t t, int32_t r, int32_t b)
{ {
for (x = l; x < r; x++) for (x = l; x < r; x++)
{ {
auto surfaceElement = map_get_surface_element_at(TileCoordsXY{ x, y }.ToCoordsXY()); auto surfaceElement = MapGetSurfaceElementAt(TileCoordsXY{ x, y }.ToCoordsXY());
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
continue; continue;
surfaceElement->SetSlope(TILE_ELEMENT_SLOPE_FLAT); surfaceElement->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
@ -146,36 +146,36 @@ int32_t MapSmooth(int32_t l, int32_t t, int32_t r, int32_t b)
{ {
uint8_t slope = surfaceElement->GetSlope(); uint8_t slope = surfaceElement->GetSlope();
// Corners // Corners
auto surfaceElement2 = map_get_surface_element_at(TileCoordsXY{ x + 1, y + 1 }.ToCoordsXY()); auto surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x + 1, y + 1 }.ToCoordsXY());
if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height) if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height)
slope |= TILE_ELEMENT_SLOPE_N_CORNER_UP; slope |= TILE_ELEMENT_SLOPE_N_CORNER_UP;
surfaceElement2 = map_get_surface_element_at(TileCoordsXY{ x - 1, y + 1 }.ToCoordsXY()); surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x - 1, y + 1 }.ToCoordsXY());
if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height) if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height)
slope |= TILE_ELEMENT_SLOPE_W_CORNER_UP; slope |= TILE_ELEMENT_SLOPE_W_CORNER_UP;
surfaceElement2 = map_get_surface_element_at(TileCoordsXY{ x + 1, y - 1 }.ToCoordsXY()); surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x + 1, y - 1 }.ToCoordsXY());
if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height) if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height)
slope |= TILE_ELEMENT_SLOPE_E_CORNER_UP; slope |= TILE_ELEMENT_SLOPE_E_CORNER_UP;
surfaceElement2 = map_get_surface_element_at(TileCoordsXY{ x - 1, y - 1 }.ToCoordsXY()); surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x - 1, y - 1 }.ToCoordsXY());
if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height) if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height)
slope |= TILE_ELEMENT_SLOPE_S_CORNER_UP; slope |= TILE_ELEMENT_SLOPE_S_CORNER_UP;
// Sides // Sides
surfaceElement2 = map_get_surface_element_at(TileCoordsXY{ x + 1, y + 0 }.ToCoordsXY()); surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x + 1, y + 0 }.ToCoordsXY());
if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height) if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height)
slope |= TILE_ELEMENT_SLOPE_NE_SIDE_UP; slope |= TILE_ELEMENT_SLOPE_NE_SIDE_UP;
surfaceElement2 = map_get_surface_element_at(TileCoordsXY{ x - 1, y + 0 }.ToCoordsXY()); surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x - 1, y + 0 }.ToCoordsXY());
if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height) if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height)
slope |= TILE_ELEMENT_SLOPE_SW_SIDE_UP; slope |= TILE_ELEMENT_SLOPE_SW_SIDE_UP;
surfaceElement2 = map_get_surface_element_at(TileCoordsXY{ x + 0, y - 1 }.ToCoordsXY()); surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x + 0, y - 1 }.ToCoordsXY());
if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height) if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height)
slope |= TILE_ELEMENT_SLOPE_SE_SIDE_UP; slope |= TILE_ELEMENT_SLOPE_SE_SIDE_UP;
surfaceElement2 = map_get_surface_element_at(TileCoordsXY{ x + 0, y + 1 }.ToCoordsXY()); surfaceElement2 = MapGetSurfaceElementAt(TileCoordsXY{ x + 0, y + 1 }.ToCoordsXY());
if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height) if (surfaceElement2 != nullptr && surfaceElement2->base_height > surfaceElement->base_height)
slope |= TILE_ELEMENT_SLOPE_NW_SIDE_UP; slope |= TILE_ELEMENT_SLOPE_NW_SIDE_UP;
@ -200,7 +200,7 @@ int32_t MapSmooth(int32_t l, int32_t t, int32_t r, int32_t b)
*/ */
int32_t TileSmooth(const TileCoordsXY& tileCoords) int32_t TileSmooth(const TileCoordsXY& tileCoords)
{ {
auto* const surfaceElement = map_get_surface_element_at(tileCoords.ToCoordsXY()); auto* const surfaceElement = MapGetSurfaceElementAt(tileCoords.ToCoordsXY());
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
return 0; return 0;
@ -241,7 +241,7 @@ int32_t TileSmooth(const TileCoordsXY& tileCoords)
continue; continue;
// Get neighbour height. If the element is not valid (outside of map) assume the same height // Get neighbour height. If the element is not valid (outside of map) assume the same height
auto* neighbourSurfaceElement = map_get_surface_element_at( auto* neighbourSurfaceElement = MapGetSurfaceElementAt(
(tileCoords + TileCoordsXY{ x_offset, y_offset }).ToCoordsXY()); (tileCoords + TileCoordsXY{ x_offset, y_offset }).ToCoordsXY());
neighbourHeightOffset.baseheight[index] = neighbourSurfaceElement != nullptr ? neighbourSurfaceElement->base_height neighbourHeightOffset.baseheight[index] = neighbourSurfaceElement != nullptr ? neighbourSurfaceElement->base_height
: surfaceElement->base_height; : surfaceElement->base_height;

View File

@ -107,7 +107,7 @@ void ParkUpdateFences(const CoordsXY& coords)
if (map_is_edge(coords)) if (map_is_edge(coords))
return; return;
auto surfaceElement = map_get_surface_element_at(coords); auto surfaceElement = MapGetSurfaceElementAt(coords);
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
return; return;
@ -116,7 +116,7 @@ void ParkUpdateFences(const CoordsXY& coords)
{ {
bool fenceRequired = true; bool fenceRequired = true;
TileElement* tileElement = map_get_first_element_at(coords); TileElement* tileElement = MapGetFirstElementAt(coords);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
// If an entrance element do not place flags around surface // If an entrance element do not place flags around surface

View File

@ -124,7 +124,7 @@ void SceneryUpdateTile(const CoordsXY& sceneryPos)
{ {
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(sceneryPos); tileElement = MapGetFirstElementAt(sceneryPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do
@ -243,7 +243,7 @@ void SceneryRemoveGhostToolPlacement()
if (gSceneryGhostType & SCENERY_GHOST_FLAG_1) if (gSceneryGhostType & SCENERY_GHOST_FLAG_1)
{ {
gSceneryGhostType &= ~SCENERY_GHOST_FLAG_1; gSceneryGhostType &= ~SCENERY_GHOST_FLAG_1;
TileElement* tileElement = map_get_first_element_at(gSceneryGhostPosition); TileElement* tileElement = MapGetFirstElementAt(gSceneryGhostPosition);
do do
{ {
@ -399,7 +399,7 @@ static SceneryEntryBase* GetSceneryEntry(const ScenerySelection& item)
switch (item.SceneryType) switch (item.SceneryType)
{ {
case SCENERY_TYPE_SMALL: case SCENERY_TYPE_SMALL:
return get_small_scenery_entry(item.EntryIndex); return GetSmallSceneryEntry(item.EntryIndex);
case SCENERY_TYPE_PATH_ITEM: case SCENERY_TYPE_PATH_ITEM:
return GetFootpathItemEntry(item.EntryIndex); return GetFootpathItemEntry(item.EntryIndex);
case SCENERY_TYPE_WALL: case SCENERY_TYPE_WALL:

View File

@ -125,10 +125,10 @@ void SmallSceneryElement::SetNeedsSupports()
SmallSceneryEntry* SmallSceneryElement::GetEntry() const SmallSceneryEntry* SmallSceneryElement::GetEntry() const
{ {
return get_small_scenery_entry(entryIndex); return GetSmallSceneryEntry(entryIndex);
} }
SmallSceneryEntry* get_small_scenery_entry(ObjectEntryIndex entryIndex) SmallSceneryEntry* GetSmallSceneryEntry(ObjectEntryIndex entryIndex)
{ {
SmallSceneryEntry* result = nullptr; SmallSceneryEntry* result = nullptr;
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager(); auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();

View File

@ -55,4 +55,4 @@ enum
MAP_ELEM_SMALL_SCENERY_COLOUR_FLAG_NEEDS_SUPPORTS = (1 << 5), MAP_ELEM_SMALL_SCENERY_COLOUR_FLAG_NEEDS_SUPPORTS = (1 << 5),
}; };
SmallSceneryEntry* get_small_scenery_entry(ObjectEntryIndex entryIndex); SmallSceneryEntry* GetSmallSceneryEntry(ObjectEntryIndex entryIndex);

View File

@ -18,7 +18,7 @@
#include "Location.hpp" #include "Location.hpp"
#include "Scenery.h" #include "Scenery.h"
bool tile_element_is_underground(TileElement* tileElement) bool TileElementIsUnderground(TileElement* tileElement)
{ {
do do
{ {

View File

@ -708,4 +708,4 @@ enum
LANDSCAPE_DOOR_OPEN = 3, LANDSCAPE_DOOR_OPEN = 3,
}; };
bool tile_element_is_underground(TileElement* tileElement); bool TileElementIsUnderground(TileElement* tileElement);

View File

@ -111,7 +111,7 @@ namespace OpenRCT2
Iterator begin() noexcept Iterator begin() noexcept
{ {
T* element = reinterpret_cast<T*>(map_get_first_element_at(_loc)); T* element = reinterpret_cast<T*>(MapGetFirstElementAt(_loc));
if constexpr (!std::is_same_v<T, TileElement>) if constexpr (!std::is_same_v<T, TileElement>)
{ {

View File

@ -43,8 +43,8 @@ namespace OpenRCT2::TileInspector
{ {
static bool SwapTileElements(const CoordsXY& loc, int16_t first, int16_t second) static bool SwapTileElements(const CoordsXY& loc, int16_t first, int16_t second)
{ {
TileElement* const firstElement = map_get_nth_element_at(loc, first); TileElement* const firstElement = MapGetNthElementAt(loc, first);
TileElement* const secondElement = map_get_nth_element_at(loc, second); TileElement* const secondElement = MapGetNthElementAt(loc, second);
if (firstElement == nullptr) if (firstElement == nullptr)
{ {
@ -86,7 +86,7 @@ namespace OpenRCT2::TileInspector
return nullptr; return nullptr;
} }
static int32_t numLargeScenerySequences(const CoordsXY& loc, const LargeSceneryElement* const largeScenery) static int32_t NumLargeScenerySequences(const CoordsXY& loc, const LargeSceneryElement* const largeScenery)
{ {
const auto* const largeEntry = largeScenery->GetEntry(); const auto* const largeEntry = largeScenery->GetEntry();
const auto direction = largeScenery->GetDirection(); const auto direction = largeScenery->GetDirection();
@ -107,7 +107,7 @@ namespace OpenRCT2::TileInspector
const auto currentTile = firstTile + rotatedCurrentTile; const auto currentTile = firstTile + rotatedCurrentTile;
const TileElement* tileElement = map_get_first_element_at(currentTile); const TileElement* tileElement = MapGetFirstElementAt(currentTile);
if (tileElement != nullptr) if (tileElement != nullptr)
{ {
do do
@ -140,7 +140,7 @@ namespace OpenRCT2::TileInspector
*/ */
GameActions::Result RemoveElementAt(const CoordsXY& loc, int16_t elementIndex, bool isExecuting) GameActions::Result RemoveElementAt(const CoordsXY& loc, int16_t elementIndex, bool isExecuting)
{ {
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr) if (tileElement == nullptr)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -151,7 +151,7 @@ namespace OpenRCT2::TileInspector
if (largeScenery != nullptr) if (largeScenery != nullptr)
{ {
// Only delete the banner entry if there are no other parts of the large scenery to delete // Only delete the banner entry if there are no other parts of the large scenery to delete
if (numLargeScenerySequences(loc, largeScenery) == 1) if (NumLargeScenerySequences(loc, largeScenery) == 1)
{ {
tileElement->RemoveBannerEntry(); tileElement->RemoveBannerEntry();
} }
@ -213,7 +213,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result RotateElementAt(const CoordsXY& loc, int32_t elementIndex, bool isExecuting) GameActions::Result RotateElementAt(const CoordsXY& loc, int32_t elementIndex, bool isExecuting)
{ {
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr) if (tileElement == nullptr)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -298,7 +298,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result ToggleInvisibilityOfElementAt(const CoordsXY& loc, int32_t elementIndex, bool isExecuting) GameActions::Result ToggleInvisibilityOfElementAt(const CoordsXY& loc, int32_t elementIndex, bool isExecuting)
{ {
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr) if (tileElement == nullptr)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -367,7 +367,7 @@ namespace OpenRCT2::TileInspector
windowTileInspectorElementCount++; windowTileInspectorElementCount++;
// Select new element if there was none selected already // Select new element if there was none selected already
int16_t newIndex = static_cast<int16_t>((pastedElement - map_get_first_element_at(loc))); int16_t newIndex = static_cast<int16_t>((pastedElement - MapGetFirstElementAt(loc)));
if (windowTileInspectorSelectedIndex == -1) if (windowTileInspectorSelectedIndex == -1)
windowTileInspectorSelectedIndex = newIndex; windowTileInspectorSelectedIndex = newIndex;
else if (windowTileInspectorSelectedIndex >= newIndex) else if (windowTileInspectorSelectedIndex >= newIndex)
@ -384,7 +384,7 @@ namespace OpenRCT2::TileInspector
{ {
if (isExecuting) if (isExecuting)
{ {
const TileElement* const firstElement = map_get_first_element_at(loc); const TileElement* const firstElement = MapGetFirstElementAt(loc);
if (firstElement == nullptr) if (firstElement == nullptr)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -463,7 +463,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result AnyBaseHeightOffset(const CoordsXY& loc, int16_t elementIndex, int8_t heightOffset, bool isExecuting) GameActions::Result AnyBaseHeightOffset(const CoordsXY& loc, int16_t elementIndex, int8_t heightOffset, bool isExecuting)
{ {
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr) if (tileElement == nullptr)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -513,7 +513,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result SurfaceShowParkFences(const CoordsXY& loc, bool showFences, bool isExecuting) GameActions::Result SurfaceShowParkFences(const CoordsXY& loc, bool showFences, bool isExecuting)
{ {
auto* const surfaceelement = map_get_surface_element_at(loc); auto* const surfaceelement = MapGetSurfaceElementAt(loc);
// No surface element on tile // No surface element on tile
if (surfaceelement == nullptr) if (surfaceelement == nullptr)
@ -539,7 +539,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result SurfaceToggleCorner(const CoordsXY& loc, int32_t cornerIndex, bool isExecuting) GameActions::Result SurfaceToggleCorner(const CoordsXY& loc, int32_t cornerIndex, bool isExecuting)
{ {
auto* const surfaceElement = map_get_surface_element_at(loc); auto* const surfaceElement = MapGetSurfaceElementAt(loc);
// No surface element on tile // No surface element on tile
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
@ -592,7 +592,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result SurfaceToggleDiagonal(const CoordsXY& loc, bool isExecuting) GameActions::Result SurfaceToggleDiagonal(const CoordsXY& loc, bool isExecuting)
{ {
auto* const surfaceElement = map_get_surface_element_at(loc); auto* const surfaceElement = MapGetSurfaceElementAt(loc);
// No surface element on tile // No surface element on tile
if (surfaceElement == nullptr) if (surfaceElement == nullptr)
@ -616,7 +616,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result PathSetSloped(const CoordsXY& loc, int32_t elementIndex, bool sloped, bool isExecuting) GameActions::Result PathSetSloped(const CoordsXY& loc, int32_t elementIndex, bool sloped, bool isExecuting)
{ {
TileElement* const pathElement = map_get_nth_element_at(loc, elementIndex); TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex);
if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -637,7 +637,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result PathSetBroken(const CoordsXY& loc, int32_t elementIndex, bool broken, bool isExecuting) GameActions::Result PathSetBroken(const CoordsXY& loc, int32_t elementIndex, bool broken, bool isExecuting)
{ {
TileElement* const pathElement = map_get_nth_element_at(loc, elementIndex); TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex);
if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -658,7 +658,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result PathToggleEdge(const CoordsXY& loc, int32_t elementIndex, int32_t edgeIndex, bool isExecuting) GameActions::Result PathToggleEdge(const CoordsXY& loc, int32_t elementIndex, int32_t edgeIndex, bool isExecuting)
{ {
TileElement* const pathElement = map_get_nth_element_at(loc, elementIndex); TileElement* const pathElement = MapGetNthElementAt(loc, elementIndex);
if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path) if (pathElement == nullptr || pathElement->GetType() != TileElementType::Path)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -680,7 +680,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result EntranceMakeUsable(const CoordsXY& loc, int32_t elementIndex, bool isExecuting) GameActions::Result EntranceMakeUsable(const CoordsXY& loc, int32_t elementIndex, bool isExecuting)
{ {
TileElement* const entranceElement = map_get_nth_element_at(loc, elementIndex); TileElement* const entranceElement = MapGetNthElementAt(loc, elementIndex);
if (entranceElement == nullptr || entranceElement->GetType() != TileElementType::Entrance) if (entranceElement == nullptr || entranceElement->GetType() != TileElementType::Entrance)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -714,7 +714,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result WallSetSlope(const CoordsXY& loc, int32_t elementIndex, int32_t slopeValue, bool isExecuting) GameActions::Result WallSetSlope(const CoordsXY& loc, int32_t elementIndex, int32_t slopeValue, bool isExecuting)
{ {
TileElement* const wallElement = map_get_nth_element_at(loc, elementIndex); TileElement* const wallElement = MapGetNthElementAt(loc, elementIndex);
if (wallElement == nullptr || wallElement->GetType() != TileElementType::Wall) if (wallElement == nullptr || wallElement->GetType() != TileElementType::Wall)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -737,7 +737,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result WallAnimationFrameOffset( GameActions::Result WallAnimationFrameOffset(
const CoordsXY& loc, int16_t elementIndex, int8_t animationFrameOffset, bool isExecuting) const CoordsXY& loc, int16_t elementIndex, int8_t animationFrameOffset, bool isExecuting)
{ {
TileElement* const wallElement = map_get_nth_element_at(loc, elementIndex); TileElement* const wallElement = MapGetNthElementAt(loc, elementIndex);
if (wallElement == nullptr || wallElement->GetType() != TileElementType::Wall) if (wallElement == nullptr || wallElement->GetType() != TileElementType::Wall)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -764,7 +764,7 @@ namespace OpenRCT2::TileInspector
if (offset == 0) if (offset == 0)
return GameActions::Result(); return GameActions::Result();
TileElement* const trackElement = map_get_nth_element_at(loc, elementIndex); TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -810,7 +810,7 @@ namespace OpenRCT2::TileInspector
// track_remove returns here on failure, not sure when this would ever be hit. Only thing I can think of is // track_remove returns here on failure, not sure when this would ever be hit. Only thing I can think of is
// for when you decrease the map size. // for when you decrease the map size.
openrct2_assert(map_get_surface_element_at(elem) != nullptr, "No surface at %d,%d", elem.x >> 5, elem.y >> 5); openrct2_assert(MapGetSurfaceElementAt(elem) != nullptr, "No surface at %d,%d", elem.x >> 5, elem.y >> 5);
map_invalidate_tile_full(elem); map_invalidate_tile_full(elem);
@ -836,7 +836,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result TrackSetChain( GameActions::Result TrackSetChain(
const CoordsXY& loc, int32_t elementIndex, bool entireTrackBlock, bool setChain, bool isExecuting) const CoordsXY& loc, int32_t elementIndex, bool entireTrackBlock, bool setChain, bool isExecuting)
{ {
TileElement* const trackElement = map_get_nth_element_at(loc, elementIndex); TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -893,7 +893,7 @@ namespace OpenRCT2::TileInspector
// track_remove returns here on failure, not sure when this would ever be hit. Only thing I can think of is // track_remove returns here on failure, not sure when this would ever be hit. Only thing I can think of is
// for when you decrease the map size. // for when you decrease the map size.
openrct2_assert(map_get_surface_element_at(elem) != nullptr, "No surface at %d,%d", elem.x >> 5, elem.y >> 5); openrct2_assert(MapGetSurfaceElementAt(elem) != nullptr, "No surface at %d,%d", elem.x >> 5, elem.y >> 5);
map_invalidate_tile_full(elem); map_invalidate_tile_full(elem);
@ -917,7 +917,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result TrackSetBlockBrake(const CoordsXY& loc, int32_t elementIndex, bool blockBrake, bool isExecuting) GameActions::Result TrackSetBlockBrake(const CoordsXY& loc, int32_t elementIndex, bool blockBrake, bool isExecuting)
{ {
TileElement* const trackElement = map_get_nth_element_at(loc, elementIndex); TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -939,7 +939,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result TrackSetIndestructible( GameActions::Result TrackSetIndestructible(
const CoordsXY& loc, int32_t elementIndex, bool isIndestructible, bool isExecuting) const CoordsXY& loc, int32_t elementIndex, bool isIndestructible, bool isExecuting)
{ {
TileElement* const trackElement = map_get_nth_element_at(loc, elementIndex); TileElement* const trackElement = MapGetNthElementAt(loc, elementIndex);
if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track) if (trackElement == nullptr || trackElement->GetType() != TileElementType::Track)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -961,7 +961,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result ScenerySetQuarterLocation( GameActions::Result ScenerySetQuarterLocation(
const CoordsXY& loc, int32_t elementIndex, int32_t quarterIndex, bool isExecuting) const CoordsXY& loc, int32_t elementIndex, int32_t quarterIndex, bool isExecuting)
{ {
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr || tileElement->GetType() != TileElementType::SmallScenery) if (tileElement == nullptr || tileElement->GetType() != TileElementType::SmallScenery)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -987,7 +987,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result ScenerySetQuarterCollision( GameActions::Result ScenerySetQuarterCollision(
const CoordsXY& loc, int32_t elementIndex, int32_t quarterIndex, bool isExecuting) const CoordsXY& loc, int32_t elementIndex, int32_t quarterIndex, bool isExecuting)
{ {
TileElement* const tileElement = map_get_nth_element_at(loc, elementIndex); TileElement* const tileElement = MapGetNthElementAt(loc, elementIndex);
if (tileElement == nullptr || tileElement->GetType() != TileElementType::SmallScenery) if (tileElement == nullptr || tileElement->GetType() != TileElementType::SmallScenery)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);
@ -1010,7 +1010,7 @@ namespace OpenRCT2::TileInspector
GameActions::Result BannerToggleBlockingEdge(const CoordsXY& loc, int32_t elementIndex, int32_t edgeIndex, bool isExecuting) GameActions::Result BannerToggleBlockingEdge(const CoordsXY& loc, int32_t elementIndex, int32_t edgeIndex, bool isExecuting)
{ {
TileElement* const bannerElement = map_get_nth_element_at(loc, elementIndex); TileElement* const bannerElement = MapGetNthElementAt(loc, elementIndex);
if (bannerElement == nullptr || bannerElement->GetType() != TileElementType::Banner) if (bannerElement == nullptr || bannerElement->GetType() != TileElementType::Banner)
return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE); return GameActions::Result(GameActions::Status::Unknown, STR_NONE, STR_NONE);

View File

@ -32,7 +32,7 @@
* *
* rct2: 0x006E588E * rct2: 0x006E588E
*/ */
void wall_remove_at(const CoordsXYRangedZ& wallPos) void WallRemoveAt(const CoordsXYRangedZ& wallPos)
{ {
for (auto wallElement = map_get_wall_element_at(wallPos); wallElement != nullptr; for (auto wallElement = map_get_wall_element_at(wallPos); wallElement != nullptr;
wallElement = map_get_wall_element_at(wallPos)) wallElement = map_get_wall_element_at(wallPos))
@ -47,20 +47,20 @@ void wall_remove_at(const CoordsXYRangedZ& wallPos)
* *
* rct2: 0x006E57E6 * rct2: 0x006E57E6
*/ */
void wall_remove_at_z(const CoordsXYZ& wallPos) void WallRemoveAtZ(const CoordsXYZ& wallPos)
{ {
wall_remove_at({ wallPos, wallPos.z, wallPos.z + 48 }); WallRemoveAt({ wallPos, wallPos.z, wallPos.z + 48 });
} }
/** /**
* *
* rct2: 0x006E5935 * rct2: 0x006E5935
*/ */
void wall_remove_intersecting_walls(const CoordsXYRangedZ& wallPos, Direction direction) void WallRemoveIntersectingWalls(const CoordsXYRangedZ& wallPos, Direction direction)
{ {
TileElement* tileElement; TileElement* tileElement;
tileElement = map_get_first_element_at(wallPos); tileElement = MapGetFirstElementAt(wallPos);
if (tileElement == nullptr) if (tileElement == nullptr)
return; return;
do do

View File

@ -137,7 +137,7 @@ protected:
static ::testing::AssertionResult AssertIsStartPosition(const char*, const TileCoordsXYZ& location) static ::testing::AssertionResult AssertIsStartPosition(const char*, const TileCoordsXYZ& location)
{ {
const uint32_t expectedSurfaceStyle = 11u; const uint32_t expectedSurfaceStyle = 11u;
const uint32_t style = map_get_surface_element_at(location.ToCoordsXYZ())->GetSurfaceStyle(); const uint32_t style = MapGetSurfaceElementAt(location.ToCoordsXYZ())->GetSurfaceStyle();
if (style != expectedSurfaceStyle) if (style != expectedSurfaceStyle)
return ::testing::AssertionFailure() return ::testing::AssertionFailure()
@ -152,7 +152,7 @@ protected:
{ {
const uint32_t forbiddenSurfaceStyle = 8u; const uint32_t forbiddenSurfaceStyle = 8u;
const uint32_t style = map_get_surface_element_at(location.ToCoordsXYZ())->GetSurfaceStyle(); const uint32_t style = MapGetSurfaceElementAt(location.ToCoordsXYZ())->GetSurfaceStyle();
if (style == forbiddenSurfaceStyle) if (style == forbiddenSurfaceStyle)
return ::testing::AssertionFailure() return ::testing::AssertionFailure()

View File

@ -61,7 +61,7 @@ template<typename T> std::vector<T*> BuildListManual(const CoordsXY& pos)
{ {
std::vector<TileElement*> res; std::vector<TileElement*> res;
TileElement* element = map_get_first_element_at(pos); TileElement* element = MapGetFirstElementAt(pos);
if (element == nullptr) if (element == nullptr)
return res; return res;