diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index d61a935b82..e69d7296fd 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -686,7 +686,7 @@ void sub_68A15E(int32_t screenX, int32_t screenY, int16_t* x, int16_t* y, int32_ int16_t z = originalZ; if (interactionType != VIEWPORT_INTERACTION_ITEM_WATER) { - z = tile_element_height(map_pos.x, map_pos.y); + z = tile_element_height({ map_pos.x, map_pos.y }); } map_pos = viewport_coord_to_map_coord(start_vp_pos.x, start_vp_pos.y, z); map_pos.x = std::clamp(map_pos.x, my_x, my_x + 31); diff --git a/src/openrct2-ui/title/TitleSequencePlayer.cpp b/src/openrct2-ui/title/TitleSequencePlayer.cpp index cff6a9a05d..53c630f13b 100644 --- a/src/openrct2-ui/title/TitleSequencePlayer.cpp +++ b/src/openrct2-ui/title/TitleSequencePlayer.cpp @@ -524,7 +524,7 @@ private: rct_window* w = window_get_main(); if (w != nullptr) { - int32_t z = tile_element_height(x, y); + int32_t z = tile_element_height({ x, y }); // Prevent scroll adjustment due to window placement when in-game auto oldScreenFlags = gScreenFlags; diff --git a/src/openrct2-ui/windows/Map.cpp b/src/openrct2-ui/windows/Map.cpp index 8ee2b64ad3..9345421c77 100644 --- a/src/openrct2-ui/windows/Map.cpp +++ b/src/openrct2-ui/windows/Map.cpp @@ -566,7 +566,7 @@ static void window_map_scrollmousedown(rct_window* w, int32_t scrollIndex, int32 CoordsXY c = map_window_screen_to_map(x, y); int32_t mapX = std::clamp(c.x, 0, MAXIMUM_MAP_SIZE_TECHNICAL * 32 - 1); int32_t mapY = std::clamp(c.y, 0, MAXIMUM_MAP_SIZE_TECHNICAL * 32 - 1); - int32_t mapZ = tile_element_height(x, y); + int32_t mapZ = tile_element_height({ x, y }); rct_window* mainWindow = window_get_main(); if (mainWindow != nullptr) diff --git a/src/openrct2-ui/windows/Viewport.cpp b/src/openrct2-ui/windows/Viewport.cpp index f1dd252eb2..33a4af79dc 100644 --- a/src/openrct2-ui/windows/Viewport.cpp +++ b/src/openrct2-ui/windows/Viewport.cpp @@ -152,7 +152,7 @@ static void window_viewport_mouseup(rct_window* w, rct_widgetindex widgetIndex) get_map_coordinates_from_pos( w->x + (w->width / 2), w->y + (w->height / 2), VIEWPORT_INTERACTION_MASK_NONE, &x, &y, nullptr, nullptr, nullptr); - window_scroll_to_location(mainWindow, x, y, tile_element_height(x, y)); + window_scroll_to_location(mainWindow, x, y, tile_element_height({ x, y })); } break; } diff --git a/src/openrct2/actions/BannerSetStyleAction.hpp b/src/openrct2/actions/BannerSetStyleAction.hpp index 842ce95946..5159ead642 100644 --- a/src/openrct2/actions/BannerSetStyleAction.hpp +++ b/src/openrct2/actions/BannerSetStyleAction.hpp @@ -68,7 +68,7 @@ public: res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING; res->Position.x = banner->position.x * 32 + 16; res->Position.y = banner->position.y * 32 + 16; - res->Position.z = tile_element_height(banner->position.x, banner->position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); TileElement* tileElement = banner_get_tile_element(_bannerIndex); @@ -118,7 +118,7 @@ public: res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING; res->Position.x = banner->position.x * 32 + 16; res->Position.y = banner->position.y * 32 + 16; - res->Position.z = tile_element_height(banner->position.x, banner->position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); TileElement* tileElement = banner_get_tile_element(_bannerIndex); diff --git a/src/openrct2/actions/ClearAction.hpp b/src/openrct2/actions/ClearAction.hpp index c860751a05..419b784086 100644 --- a/src/openrct2/actions/ClearAction.hpp +++ b/src/openrct2/actions/ClearAction.hpp @@ -78,7 +78,7 @@ private: auto x = (_range.GetLeft() + _range.GetRight()) / 2 + 16; auto y = (_range.GetTop() + _range.GetBottom()) / 2 + 16; - auto z = tile_element_height(x, y); + auto z = tile_element_height({ x, y }); result->Position = CoordsXYZ(x, y, z); return result; diff --git a/src/openrct2/actions/LandBuyRightsAction.hpp b/src/openrct2/actions/LandBuyRightsAction.hpp index b2f3600c3c..f6d6e0f7db 100644 --- a/src/openrct2/actions/LandBuyRightsAction.hpp +++ b/src/openrct2/actions/LandBuyRightsAction.hpp @@ -93,7 +93,7 @@ private: CoordsXYZ centre{ (validRange.GetLeft() + validRange.GetRight()) / 2 + 16, (validRange.GetTop() + validRange.GetBottom()) / 2 + 16, 0 }; - centre.z = tile_element_height(centre.x, centre.y); + centre.z = tile_element_height({ centre.x, centre.y }); res->Position = centre; res->ExpenditureType = RCT_EXPENDITURE_TYPE_LAND_PURCHASE; diff --git a/src/openrct2/actions/LandLowerAction.hpp b/src/openrct2/actions/LandLowerAction.hpp index 7d1822696d..871a2c9c4b 100644 --- a/src/openrct2/actions/LandLowerAction.hpp +++ b/src/openrct2/actions/LandLowerAction.hpp @@ -83,12 +83,12 @@ private: MapRange validRange = MapRange{ aX, aY, bX, bY }; - res->Position = { _coords.x, _coords.y, tile_element_height(_coords.x, _coords.y) }; + res->Position = { _coords.x, _coords.y, tile_element_height(_coords) }; res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING; if (isExecuting) { - audio_play_sound_at_location(SoundId::PlaceItem, _coords.x, _coords.y, tile_element_height(_coords.x, _coords.y)); + audio_play_sound_at_location(SoundId::PlaceItem, _coords.x, _coords.y, tile_element_height(_coords)); } uint8_t maxHeight = map_get_highest_land_height( diff --git a/src/openrct2/actions/LandRaiseAction.hpp b/src/openrct2/actions/LandRaiseAction.hpp index d589f8d82f..19ff6031b2 100644 --- a/src/openrct2/actions/LandRaiseAction.hpp +++ b/src/openrct2/actions/LandRaiseAction.hpp @@ -84,12 +84,12 @@ private: MapRange validRange = MapRange{ aX, aY, bX, bY }; - res->Position = { _coords.x, _coords.y, tile_element_height(_coords.x, _coords.y) }; + res->Position = { _coords.x, _coords.y, tile_element_height(_coords) }; res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING; if (isExecuting) { - audio_play_sound_at_location(SoundId::PlaceItem, _coords.x, _coords.y, tile_element_height(_coords.x, _coords.y)); + audio_play_sound_at_location(SoundId::PlaceItem, _coords.x, _coords.y, tile_element_height(_coords)); } uint8_t minHeight = map_get_lowest_land_height( diff --git a/src/openrct2/actions/LandSetHeightAction.hpp b/src/openrct2/actions/LandSetHeightAction.hpp index 71ea2d8856..23cfd10774 100644 --- a/src/openrct2/actions/LandSetHeightAction.hpp +++ b/src/openrct2/actions/LandSetHeightAction.hpp @@ -144,7 +144,7 @@ public: GameActionResult::Ptr Execute() const override { money32 cost = MONEY(0, 0); - auto surfaceHeight = tile_element_height(_coords.x, _coords.y); + auto surfaceHeight = tile_element_height(_coords); footpath_remove_litter(_coords.x, _coords.y, surfaceHeight); if (!gCheatsDisableClearanceChecks) diff --git a/src/openrct2/actions/LandSetRightsAction.hpp b/src/openrct2/actions/LandSetRightsAction.hpp index 8d77a66a70..d2287ce409 100644 --- a/src/openrct2/actions/LandSetRightsAction.hpp +++ b/src/openrct2/actions/LandSetRightsAction.hpp @@ -97,7 +97,7 @@ private: CoordsXYZ centre{ (validRange.GetLeft() + validRange.GetRight()) / 2 + 16, (validRange.GetTop() + validRange.GetBottom()) / 2 + 16, 0 }; - centre.z = tile_element_height(centre.x, centre.y); + centre.z = tile_element_height({ centre.x, centre.y }); res->Position = centre; res->ExpenditureType = RCT_EXPENDITURE_TYPE_LAND_PURCHASE; diff --git a/src/openrct2/actions/LandSmoothAction.hpp b/src/openrct2/actions/LandSmoothAction.hpp index 1d4404f3d9..2d5449ece0 100644 --- a/src/openrct2/actions/LandSmoothAction.hpp +++ b/src/openrct2/actions/LandSmoothAction.hpp @@ -350,7 +350,7 @@ private: auto b = std::clamp(normRange.GetBottom(), 0, (MAXIMUM_MAP_SIZE_TECHNICAL - 1) * 32); auto validRange = MapRange{ l, t, r, b }; - int32_t centreZ = tile_element_height(_coords.x, _coords.y); + int32_t centreZ = tile_element_height(_coords); auto res = MakeResult(); res->ErrorTitle = _ErrorTitles[_isLowering ? 0 : 1]; diff --git a/src/openrct2/actions/LargeSceneryPlaceAction.hpp b/src/openrct2/actions/LargeSceneryPlaceAction.hpp index f89dcfdf26..dee96eefc6 100644 --- a/src/openrct2/actions/LargeSceneryPlaceAction.hpp +++ b/src/openrct2/actions/LargeSceneryPlaceAction.hpp @@ -89,7 +89,7 @@ public: auto res = std::make_unique(); res->ErrorTitle = STR_CANT_POSITION_THIS_HERE; res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING; - int16_t surfaceHeight = tile_element_height(_loc.x, _loc.y); + int16_t surfaceHeight = tile_element_height({ _loc.x, _loc.y }); res->Position.x = _loc.x + 16; res->Position.y = _loc.y + 16; res->Position.z = surfaceHeight; @@ -214,7 +214,7 @@ public: auto res = std::make_unique(); res->ErrorTitle = STR_CANT_POSITION_THIS_HERE; - int16_t surfaceHeight = tile_element_height(_loc.x, _loc.y); + int16_t surfaceHeight = tile_element_height({ _loc.x, _loc.y }); res->Position.x = _loc.x + 16; res->Position.y = _loc.y + 16; res->Position.z = surfaceHeight; diff --git a/src/openrct2/actions/LargeSceneryRemoveAction.hpp b/src/openrct2/actions/LargeSceneryRemoveAction.hpp index 0695e6882f..3c3afc4551 100644 --- a/src/openrct2/actions/LargeSceneryRemoveAction.hpp +++ b/src/openrct2/actions/LargeSceneryRemoveAction.hpp @@ -56,7 +56,7 @@ public: const uint32_t flags = GetFlags(); - int32_t z = tile_element_height(_loc.x, _loc.x); + int32_t z = tile_element_height({ _loc.x, _loc.x }); res->Position.x = _loc.x + 16; res->Position.y = _loc.y + 16; res->Position.z = z; @@ -126,7 +126,7 @@ public: const uint32_t flags = GetFlags(); - int32_t z = tile_element_height(_loc.x, _loc.y); + int32_t z = tile_element_height({ _loc.x, _loc.y }); res->Position.x = _loc.x + 16; res->Position.y = _loc.y + 16; res->Position.z = z; diff --git a/src/openrct2/actions/LargeScenerySetColourAction.hpp b/src/openrct2/actions/LargeScenerySetColourAction.hpp index 6fe1e58f2c..7d627b94a9 100644 --- a/src/openrct2/actions/LargeScenerySetColourAction.hpp +++ b/src/openrct2/actions/LargeScenerySetColourAction.hpp @@ -62,7 +62,7 @@ private: res->ExpenditureType = RCT_EXPENDITURE_TYPE_LANDSCAPING; res->Position.x = _loc.x + 16; res->Position.y = _loc.y + 16; - res->Position.z = tile_element_height(_loc.x, _loc.y); + res->Position.z = tile_element_height({ _loc.x, _loc.y }); res->ErrorTitle = STR_CANT_REPAINT_THIS; if (_loc.x < 0 || _loc.y < 0 || _loc.x > gMapSizeMaxXY || _loc.y > gMapSizeMaxXY) diff --git a/src/openrct2/actions/RideDemolishAction.hpp b/src/openrct2/actions/RideDemolishAction.hpp index 7375fbcf70..3919e7e793 100644 --- a/src/openrct2/actions/RideDemolishAction.hpp +++ b/src/openrct2/actions/RideDemolishAction.hpp @@ -238,7 +238,7 @@ private: { int32_t x = (ride->overall_view.x * 32) + 16; int32_t y = (ride->overall_view.y * 32) + 16; - int32_t z = tile_element_height(x, y); + int32_t z = tile_element_height({ x, y }); res->Position = { x, y, z }; } @@ -366,7 +366,7 @@ private: { int32_t x = (ride->overall_view.x * 32) + 16; int32_t y = (ride->overall_view.y * 32) + 16; - int32_t z = tile_element_height(x, y); + int32_t z = tile_element_height({ x, y }); res->Position = { x, y, z }; } diff --git a/src/openrct2/actions/RideEntranceExitPlaceAction.hpp b/src/openrct2/actions/RideEntranceExitPlaceAction.hpp index 4643840fb0..7e10e9502a 100644 --- a/src/openrct2/actions/RideEntranceExitPlaceAction.hpp +++ b/src/openrct2/actions/RideEntranceExitPlaceAction.hpp @@ -129,7 +129,7 @@ public: auto res = MakeResult(); res->Position.x = _loc.x + 16; res->Position.y = _loc.y + 16; - res->Position.z = tile_element_height(_loc.x, _loc.y); + res->Position.z = tile_element_height({ _loc.x, _loc.y }); res->ExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION; return res; } @@ -189,7 +189,7 @@ public: auto res = MakeResult(); res->Position.x = _loc.x + 16; res->Position.y = _loc.y + 16; - res->Position.z = tile_element_height(_loc.x, _loc.y); + res->Position.z = tile_element_height({ _loc.x, _loc.y }); res->ExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION; TileElement* tileElement = tile_element_insert(_loc.x / 32, _loc.y / 32, z / 8, 0b1111); @@ -272,7 +272,7 @@ public: auto res = MakeResult(); res->Position.x = loc.x + 16; res->Position.y = loc.y + 16; - res->Position.z = tile_element_height(loc.x, loc.y); + res->Position.z = tile_element_height({ loc.x, loc.y }); res->ExpenditureType = RCT_EXPENDITURE_TYPE_RIDE_CONSTRUCTION; return res; } diff --git a/src/openrct2/actions/RideEntranceExitRemoveAction.hpp b/src/openrct2/actions/RideEntranceExitRemoveAction.hpp index baee24f922..afb96657b0 100644 --- a/src/openrct2/actions/RideEntranceExitRemoveAction.hpp +++ b/src/openrct2/actions/RideEntranceExitRemoveAction.hpp @@ -168,7 +168,7 @@ public: auto res = MakeResult(); res->Position.x = _loc.x + 16; res->Position.y = _loc.y + 16; - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); footpath_queue_chain_reset(); maze_entrance_hedge_replacement(_loc.x, _loc.y, tileElement); diff --git a/src/openrct2/actions/RideSetAppearanceAction.hpp b/src/openrct2/actions/RideSetAppearanceAction.hpp index 4d5edadde8..dd61205250 100644 --- a/src/openrct2/actions/RideSetAppearanceAction.hpp +++ b/src/openrct2/actions/RideSetAppearanceAction.hpp @@ -163,7 +163,7 @@ public: { res->Position.x = ride->overall_view.x * 32 + 16; res->Position.y = ride->overall_view.y * 32 + 16; - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); } return res; diff --git a/src/openrct2/actions/RideSetName.hpp b/src/openrct2/actions/RideSetName.hpp index 2c423e8009..104568d25b 100644 --- a/src/openrct2/actions/RideSetName.hpp +++ b/src/openrct2/actions/RideSetName.hpp @@ -97,7 +97,7 @@ public: auto res = std::make_unique(); res->Position.x = ride->overall_view.x * 32 + 16; res->Position.y = ride->overall_view.y * 32 + 16; - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); return res; } diff --git a/src/openrct2/actions/RideSetPriceAction.hpp b/src/openrct2/actions/RideSetPriceAction.hpp index 0a239bbdfe..81438e5c47 100644 --- a/src/openrct2/actions/RideSetPriceAction.hpp +++ b/src/openrct2/actions/RideSetPriceAction.hpp @@ -97,7 +97,7 @@ public: { res->Position.x = ride->overall_view.x * 32 + 16; res->Position.y = ride->overall_view.y * 32 + 16; - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); } uint32_t shopItem; diff --git a/src/openrct2/actions/RideSetSetting.hpp b/src/openrct2/actions/RideSetSetting.hpp index bd514bbeb2..271f743470 100644 --- a/src/openrct2/actions/RideSetSetting.hpp +++ b/src/openrct2/actions/RideSetSetting.hpp @@ -246,7 +246,7 @@ public: { res->Position.x = ride->overall_view.x * 32 + 16; res->Position.y = ride->overall_view.y * 32 + 16; - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); } window_invalidate_by_number(WC_RIDE, _rideIndex); return res; diff --git a/src/openrct2/actions/RideSetStatus.hpp b/src/openrct2/actions/RideSetStatus.hpp index 5bd1487888..c67c354afd 100644 --- a/src/openrct2/actions/RideSetStatus.hpp +++ b/src/openrct2/actions/RideSetStatus.hpp @@ -124,7 +124,7 @@ public: { res->Position.x = ride->overall_view.x * 32 + 16; res->Position.y = ride->overall_view.y * 32 + 16; - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); } switch (_status) diff --git a/src/openrct2/actions/RideSetVehiclesAction.hpp b/src/openrct2/actions/RideSetVehiclesAction.hpp index f53f700a74..ec0d0e3de6 100644 --- a/src/openrct2/actions/RideSetVehiclesAction.hpp +++ b/src/openrct2/actions/RideSetVehiclesAction.hpp @@ -205,7 +205,7 @@ public: { res->Position.x = ride->overall_view.x * 32 + 16; res->Position.y = ride->overall_view.y * 32 + 16; - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); } auto intent = Intent(INTENT_ACTION_RIDE_PAINT_RESET_VEHICLE); diff --git a/src/openrct2/actions/SmallSceneryPlaceAction.hpp b/src/openrct2/actions/SmallSceneryPlaceAction.hpp index 1e1249b52a..6636d02e61 100644 --- a/src/openrct2/actions/SmallSceneryPlaceAction.hpp +++ b/src/openrct2/actions/SmallSceneryPlaceAction.hpp @@ -99,7 +99,7 @@ public: { supportsRequired = true; } - int32_t landHeight = tile_element_height(_loc.x, _loc.y); + int32_t landHeight = tile_element_height({ _loc.x, _loc.y }); int16_t waterHeight = tile_element_water_height(_loc.x, _loc.y); int32_t surfaceHeight = landHeight; @@ -159,7 +159,7 @@ public: x2 += ScenerySubTileOffsets[quadrant & 3].x - 1; y2 += ScenerySubTileOffsets[quadrant & 3].y - 1; } - landHeight = tile_element_height(x2, y2); + landHeight = tile_element_height({ x2, y2 }); waterHeight = tile_element_water_height(x2, y2); surfaceHeight = landHeight; @@ -302,7 +302,7 @@ public: { supportsRequired = true; } - int32_t landHeight = tile_element_height(_loc.x, _loc.y); + int32_t landHeight = tile_element_height({ _loc.x, _loc.y }); int16_t waterHeight = tile_element_water_height(_loc.x, _loc.y); int32_t surfaceHeight = landHeight; @@ -352,7 +352,7 @@ public: x2 += ScenerySubTileOffsets[quadrant & 3].x - 1; y2 += ScenerySubTileOffsets[quadrant & 3].y - 1; } - landHeight = tile_element_height(x2, y2); + landHeight = tile_element_height({ x2, y2 }); waterHeight = tile_element_water_height(x2, y2); surfaceHeight = landHeight; diff --git a/src/openrct2/actions/SmallSceneryRemoveAction.hpp b/src/openrct2/actions/SmallSceneryRemoveAction.hpp index 086ebbb0d9..9019208fc2 100644 --- a/src/openrct2/actions/SmallSceneryRemoveAction.hpp +++ b/src/openrct2/actions/SmallSceneryRemoveAction.hpp @@ -124,7 +124,7 @@ public: return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_INVALID_SELECTION_OF_OBJECTS); } - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); map_invalidate_tile_full(_loc.x, _loc.y); tile_element_remove(tileElement); diff --git a/src/openrct2/actions/SurfaceSetStyleAction.hpp b/src/openrct2/actions/SurfaceSetStyleAction.hpp index 4a19ab1120..4fa28bcc26 100644 --- a/src/openrct2/actions/SurfaceSetStyleAction.hpp +++ b/src/openrct2/actions/SurfaceSetStyleAction.hpp @@ -99,7 +99,7 @@ public: auto xMid = (validRange.GetLeft() + validRange.GetRight()) / 2 + 16; auto yMid = (validRange.GetTop() + validRange.GetBottom()) / 2 + 16; - auto heightMid = tile_element_height(xMid, yMid); + auto heightMid = tile_element_height({ xMid, yMid }); res->Position.x = xMid; res->Position.y = yMid; @@ -177,7 +177,7 @@ public: auto xMid = (validRange.GetLeft() + validRange.GetRight()) / 2 + 16; auto yMid = (validRange.GetTop() + validRange.GetBottom()) / 2 + 16; - auto heightMid = tile_element_height(xMid, yMid); + auto heightMid = tile_element_height({ xMid, yMid }); res->Position.x = xMid; res->Position.y = yMid; @@ -217,7 +217,7 @@ public: surfaceElement->SetSurfaceStyle(_surfaceStyle); map_invalidate_tile_full(x, y); - footpath_remove_litter(x, y, tile_element_height(x, y)); + footpath_remove_litter(x, y, tile_element_height({ x, y })); } } } diff --git a/src/openrct2/actions/TileModifyAction.hpp b/src/openrct2/actions/TileModifyAction.hpp index ef063b3856..b5308a916e 100644 --- a/src/openrct2/actions/TileModifyAction.hpp +++ b/src/openrct2/actions/TileModifyAction.hpp @@ -255,7 +255,7 @@ private: res->Position.x = _loc.x; res->Position.y = _loc.y; - res->Position.z = tile_element_height(_loc.x, _loc.y); + res->Position.z = tile_element_height({ _loc.x, _loc.y }); return res; } diff --git a/src/openrct2/actions/WallPlaceAction.hpp b/src/openrct2/actions/WallPlaceAction.hpp index b58206b557..e4bd667e80 100644 --- a/src/openrct2/actions/WallPlaceAction.hpp +++ b/src/openrct2/actions/WallPlaceAction.hpp @@ -109,7 +109,7 @@ public: if (_loc.z == 0) { - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); } if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !(GetFlags() & GAME_COMMAND_FLAG_PATH_SCENERY) @@ -309,7 +309,7 @@ public: if (res->Position.z == 0) { - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); } uint8_t edgeSlope = 0; diff --git a/src/openrct2/actions/WallRemoveAction.hpp b/src/openrct2/actions/WallRemoveAction.hpp index f25ace4b10..64dec348b9 100644 --- a/src/openrct2/actions/WallRemoveAction.hpp +++ b/src/openrct2/actions/WallRemoveAction.hpp @@ -85,7 +85,7 @@ public: res->Position.x = _loc.x + 16; res->Position.y = _loc.y + 16; - res->Position.z = tile_element_height(res->Position.x, res->Position.y); + res->Position.z = tile_element_height({ res->Position.x, res->Position.y }); tile_element_remove_banner_entry(wallElement); map_invalidate_tile_zoom1(_loc.x, _loc.y, wallElement->base_height * 8, (wallElement->base_height * 8) + 72); diff --git a/src/openrct2/actions/WaterLowerAction.hpp b/src/openrct2/actions/WaterLowerAction.hpp index beceafbe0f..f05d397f04 100644 --- a/src/openrct2/actions/WaterLowerAction.hpp +++ b/src/openrct2/actions/WaterLowerAction.hpp @@ -63,7 +63,7 @@ private: res->Position.x = ((validRange.GetLeft() + validRange.GetRight()) / 2) + 16; res->Position.y = ((validRange.GetTop() + validRange.GetBottom()) / 2) + 16; - int16_t z = tile_element_height(res->Position.x, res->Position.y); + int16_t z = tile_element_height({ res->Position.x, res->Position.y }); int16_t waterHeight = tile_element_water_height(res->Position.x, res->Position.y); if (waterHeight != 0) { diff --git a/src/openrct2/actions/WaterRaiseAction.hpp b/src/openrct2/actions/WaterRaiseAction.hpp index a66b3c496e..ec57c53410 100644 --- a/src/openrct2/actions/WaterRaiseAction.hpp +++ b/src/openrct2/actions/WaterRaiseAction.hpp @@ -64,7 +64,7 @@ private: res->Position.x = ((validRange.GetLeft() + validRange.GetRight()) / 2) + 16; res->Position.y = ((validRange.GetTop() + validRange.GetBottom()) / 2) + 16; - int32_t z = tile_element_height(res->Position.x, res->Position.y); + int32_t z = tile_element_height({ res->Position.x, res->Position.y }); int16_t waterHeight = tile_element_water_height(res->Position.x, res->Position.y); if (waterHeight != 0) { diff --git a/src/openrct2/actions/WaterSetHeightAction.hpp b/src/openrct2/actions/WaterSetHeightAction.hpp index 96dc311b21..f797fc02aa 100644 --- a/src/openrct2/actions/WaterSetHeightAction.hpp +++ b/src/openrct2/actions/WaterSetHeightAction.hpp @@ -113,7 +113,7 @@ public: res->Position.y = _coords.y + 16; res->Position.z = _height * 8; - int32_t surfaceHeight = tile_element_height(_coords.x, _coords.y); + int32_t surfaceHeight = tile_element_height(_coords); footpath_remove_litter(_coords.x, _coords.y, surfaceHeight); if (!gCheatsDisableClearanceChecks) wall_remove_at_z(_coords.x, _coords.y, surfaceHeight); diff --git a/src/openrct2/cmdline/BenchSpriteSort.cpp b/src/openrct2/cmdline/BenchSpriteSort.cpp index aa38244595..2341e72612 100644 --- a/src/openrct2/cmdline/BenchSpriteSort.cpp +++ b/src/openrct2/cmdline/BenchSpriteSort.cpp @@ -105,7 +105,7 @@ static std::vector extract_paint_session(const std::string parkFi int32_t customY = (gMapSize / 2) * 32 + 16; int32_t x = 0, y = 0; - int32_t z = tile_element_height(customX, customY); + int32_t z = tile_element_height({ customX, customY }); x = customY - customX; y = ((customX + customY) / 2) - z; diff --git a/src/openrct2/interface/InteractiveConsole.cpp b/src/openrct2/interface/InteractiveConsole.cpp index 89b93ec466..543eafd4f3 100644 --- a/src/openrct2/interface/InteractiveConsole.cpp +++ b/src/openrct2/interface/InteractiveConsole.cpp @@ -907,7 +907,7 @@ static int32_t cc_set(InteractiveConsole& console, const arguments_t& argv) { int32_t x = (int16_t)(int_val[0] * 32 + 16); int32_t y = (int16_t)(int_val[1] * 32 + 16); - int32_t z = tile_element_height(x, y); + int32_t z = tile_element_height({ x, y }); w->SetLocation(x, y, z); viewport_update_position(w); console.Execute("get location"); diff --git a/src/openrct2/interface/Screenshot.cpp b/src/openrct2/interface/Screenshot.cpp index de61de8153..b39212db3f 100644 --- a/src/openrct2/interface/Screenshot.cpp +++ b/src/openrct2/interface/Screenshot.cpp @@ -251,7 +251,7 @@ void screenshot_giant() int32_t centreX = (mapSize / 2) * 32 + 16; int32_t centreY = (mapSize / 2) * 32 + 16; - int32_t z = tile_element_height(centreX, centreY); + int32_t z = tile_element_height({ centreX, centreY }); CoordsXYZ centreCoords3d = { centreX, centreY, z }; CoordsXY centreCoords2d = translate_3d_to_2d_with_z(rotation, centreCoords3d); @@ -336,7 +336,7 @@ static void benchgfx_render_screenshots(const char* inputPath, std::unique_ptrviewport_target_sprite); - int32_t height = (tile_element_height(0xFFFF & sprite->generic.x, 0xFFFF & sprite->generic.y)) - 16; + int32_t height = (tile_element_height({ sprite->generic.x, sprite->generic.y })) - 16; int32_t underground = sprite->generic.z < height; viewport_set_underground_flag(underground, window, window->viewport); @@ -733,7 +733,7 @@ viewport_focus viewport_update_smart_guest_follow(rct_window* window, Peep* peep focus.type = VIEWPORT_FOCUS_TYPE_COORDINATE; focus.coordinate.x = x; focus.coordinate.y = y; - focus.coordinate.z = tile_element_height(x, y) + 32; + focus.coordinate.z = tile_element_height({ x, y }) + 32; focus.sprite.type |= VIEWPORT_FOCUS_TYPE_COORDINATE; } } @@ -1808,7 +1808,7 @@ void screen_get_map_xy(int32_t screenX, int32_t screenY, int16_t* x, int16_t* y, for (int32_t i = 0; i < 5; i++) { - int32_t z = tile_element_height(map_pos.x, map_pos.y); + int32_t z = tile_element_height({ map_pos.x, map_pos.y }); map_pos = viewport_coord_to_map_coord(start_vp_pos.x, start_vp_pos.y, z); map_pos.x = std::clamp(map_pos.x, my_x, my_x + 31); map_pos.y = std::clamp(map_pos.y, my_y, my_y + 31); diff --git a/src/openrct2/interface/Window.cpp b/src/openrct2/interface/Window.cpp index a82442c8e3..31fbb4f877 100644 --- a/src/openrct2/interface/Window.cpp +++ b/src/openrct2/interface/Window.cpp @@ -816,7 +816,7 @@ void window_scroll_to_location(rct_window* w, int32_t x, int32_t y, int32_t z) if (w->viewport) { - int16_t height = tile_element_height(x, y); + int16_t height = tile_element_height({ x, y }); if (z < height - 16) { if (!(w->viewport->flags & 1 << 0)) @@ -927,7 +927,7 @@ void window_rotate_camera(rct_window* w, int32_t direction) } else { - z = tile_element_height(x, y); + z = tile_element_height({ x, y }); } gCurrentRotation = (get_current_rotation() + direction) & 3; @@ -957,7 +957,7 @@ void window_viewport_get_map_coords_by_cursor( get_map_coordinates_from_pos(mouse_x, mouse_y, VIEWPORT_INTERACTION_MASK_NONE, map_x, map_y, nullptr, nullptr, nullptr); // Get viewport coordinates centring around the tile. - int32_t base_height = tile_element_height(*map_x, *map_y); + int32_t base_height = tile_element_height({ *map_x, *map_y }); int32_t dest_x, dest_y; centre_2d_coordinates(*map_x, *map_y, base_height, &dest_x, &dest_y, w->viewport); @@ -974,7 +974,7 @@ void window_viewport_centre_tile_around_cursor(rct_window* w, int16_t map_x, int { // Get viewport coordinates centring around the tile. int32_t dest_x, dest_y; - int32_t base_height = tile_element_height(map_x, map_y); + int32_t base_height = tile_element_height({ map_x, map_y }); centre_2d_coordinates(map_x, map_y, base_height, &dest_x, &dest_y, w->viewport); // Get mouse position to offset against. diff --git a/src/openrct2/management/NewsItem.cpp b/src/openrct2/management/NewsItem.cpp index 968ca64b98..c7d9a3361d 100644 --- a/src/openrct2/management/NewsItem.cpp +++ b/src/openrct2/management/NewsItem.cpp @@ -224,7 +224,7 @@ void news_item_get_subject_location(int32_t type, int32_t subject, int32_t* x, i } *x = ride->overall_view.x * 32 + 16; *y = ride->overall_view.y * 32 + 16; - *z = tile_element_height(*x, *y); + *z = tile_element_height({ *x, *y }); break; case NEWS_ITEM_PEEP_ON_RIDE: peep = GET_PEEP(subject); @@ -268,7 +268,7 @@ void news_item_get_subject_location(int32_t type, int32_t subject, int32_t* x, i case NEWS_ITEM_BLANK: *x = subject; *y = subject >> 16; - *z = tile_element_height(*x, *y); + *z = tile_element_height({ *x, *y }); break; default: *x = LOCATION_NULL; diff --git a/src/openrct2/paint/tile_element/Paint.Surface.cpp b/src/openrct2/paint/tile_element/Paint.Surface.cpp index 0cb7d0f70f..c7d2059f96 100644 --- a/src/openrct2/paint/tile_element/Paint.Surface.cpp +++ b/src/openrct2/paint/tile_element/Paint.Surface.cpp @@ -977,7 +977,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c const int16_t x = session->MapPosition.x; const int16_t y = session->MapPosition.y; - int32_t dx = tile_element_height(x + 16, y + 16); + int32_t dx = tile_element_height({ x + 16, y + 16 }); dx += 3; int32_t image_id = (SPR_HEIGHT_MARKER_BASE + dx / 16) | 0x20780000; @@ -1088,7 +1088,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c else if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_AVAILABLE) { const LocationXY16& pos = session->MapPosition; - const int32_t height2 = (tile_element_height(pos.x + 16, pos.y + 16)) + 3; + const int32_t height2 = (tile_element_height({ pos.x + 16, pos.y + 16 })) + 3; paint_struct* backup = session->LastRootPS; sub_98196C(session, SPR_LAND_OWNERSHIP_AVAILABLE, 16, 16, 1, 1, 0, height2); session->LastRootPS = backup; @@ -1105,7 +1105,7 @@ void surface_paint(paint_session* session, uint8_t direction, uint16_t height, c else if (tileElement->AsSurface()->GetOwnership() & OWNERSHIP_CONSTRUCTION_RIGHTS_AVAILABLE) { const LocationXY16& pos = session->MapPosition; - const int32_t height2 = tile_element_height(pos.x + 16, pos.y + 16); + const int32_t height2 = tile_element_height({ pos.x + 16, pos.y + 16 }); paint_struct* backup = session->LastRootPS; sub_98196C(session, SPR_LAND_CONSTRUCTION_RIGHTS_AVAILABLE, 16, 16, 1, 1, 0, height2 + 3); session->LastRootPS = backup; diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index dd6d30fc55..d3d3fd95e2 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -2941,7 +2941,7 @@ static bool peep_really_liked_ride(Peep* peep, Ride* ride) */ static PeepThoughtType peep_assess_surroundings(int16_t centre_x, int16_t centre_y, int16_t centre_z) { - if ((tile_element_height(centre_x, centre_y)) > centre_z) + if ((tile_element_height({ centre_x, centre_y })) > centre_z) return PEEP_THOUGHT_TYPE_NONE; uint16_t num_scenery = 0; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index a63996574d..6bf828738d 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -959,7 +959,7 @@ void Peep::UpdateFalling() return; } } - int32_t map_height = tile_element_height(0xFFFF & x, 0xFFFF & y); + int32_t map_height = tile_element_height({ x, y }); if (map_height < z || map_height - 4 > z) continue; saved_height = map_height; @@ -3159,8 +3159,7 @@ void Peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_result) if (type == PEEP_TYPE_STAFF || (GetNextIsSurface())) { - int16_t height = abs(tile_element_height(newLoc.x, newLoc.y) - z); - + int16_t height = abs(tile_element_height(newLoc) - z); if (height <= 3 || (type == PEEP_TYPE_STAFF && height <= 32)) { interaction_ride_index = 0xFF; @@ -3248,7 +3247,7 @@ int32_t Peep::GetZOnSlope(int32_t tile_x, int32_t tile_y) if (GetNextIsSurface()) { - return tile_element_height(tile_x, tile_y); + return tile_element_height({ tile_x, tile_y }); } int32_t height = next_z * 8; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index fb4f0757b0..745ca740f7 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -1181,7 +1181,7 @@ void Staff::UpdateMowing() { if (auto loc = UpdateAction()) { - int16_t checkZ = tile_element_height((*loc).x, (*loc).y); + int16_t checkZ = tile_element_height(*loc); MoveTo((*loc).x, (*loc).y, checkZ); Invalidate(); return; diff --git a/src/openrct2/ride/RideRatings.cpp b/src/openrct2/ride/RideRatings.cpp index 421c993fa0..ba63b4f8cf 100644 --- a/src/openrct2/ride/RideRatings.cpp +++ b/src/openrct2/ride/RideRatings.cpp @@ -1409,7 +1409,7 @@ static int32_t ride_ratings_get_scenery_score(Ride* ride) y = location.y; } - int32_t z = tile_element_height(x * 32, y * 32); + int32_t z = tile_element_height({ x * 32, y * 32 }); // Check if station is underground, returns a fixed mediocre score since you can't have scenery underground if (z > ride->stations[i].Height * 8) diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index 1c1a61d25d..4990c96d63 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -1233,7 +1233,7 @@ static int32_t track_design_place_maze(TrackDesign* td6, int16_t x, int16_t y, i gMapSelectionTiles.clear(); gMapSelectArrowPosition.x = x; gMapSelectArrowPosition.y = y; - gMapSelectArrowPosition.z = tile_element_height(x, y); + gMapSelectArrowPosition.z = tile_element_height({ x, y }); gMapSelectArrowDirection = _currentTrackPieceDirection; } @@ -1449,7 +1449,7 @@ static bool track_design_place_ride(TrackDesign* td6, int16_t x, int16_t y, int1 gMapSelectionTiles.clear(); gMapSelectArrowPosition.x = x; gMapSelectArrowPosition.y = y; - gMapSelectArrowPosition.z = tile_element_height(x, y); + gMapSelectArrowPosition.z = tile_element_height({ x, y }); gMapSelectArrowDirection = _currentTrackPieceDirection; } diff --git a/src/openrct2/ride/Vehicle.cpp b/src/openrct2/ride/Vehicle.cpp index 60498d850c..46215f8d54 100644 --- a/src/openrct2/ride/Vehicle.cpp +++ b/src/openrct2/ride/Vehicle.cpp @@ -5431,7 +5431,7 @@ static void vehicle_update_crash(rct_vehicle* vehicle) continue; } - int16_t z = tile_element_height(curVehicle->x, curVehicle->y); + int16_t z = tile_element_height({ curVehicle->x, curVehicle->y }); int16_t waterHeight = tile_element_water_height(curVehicle->x, curVehicle->y); int16_t zDiff; if (waterHeight != 0) diff --git a/src/openrct2/world/Duck.cpp b/src/openrct2/world/Duck.cpp index 7763a1b577..01753c9536 100644 --- a/src/openrct2/world/Duck.cpp +++ b/src/openrct2/world/Duck.cpp @@ -201,7 +201,7 @@ void rct_duck::UpdateSwim() else { Invalidate(); - int16_t landZ = tile_element_height(x, y); + int16_t landZ = tile_element_height({ x, y }); int16_t waterZ = tile_element_water_height(x, y); if (z < landZ || waterZ == 0) @@ -222,7 +222,7 @@ void rct_duck::UpdateSwim() int32_t direction = sprite_direction >> 3; int32_t newX = x + DuckMoveOffset[direction].x; int32_t newY = y + DuckMoveOffset[direction].y; - landZ = tile_element_height(newX, newY); + landZ = tile_element_height({ newX, newY }); waterZ = tile_element_water_height(newX, newY); if (z >= landZ && z == waterZ) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 98b8501988..47a25e2781 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -292,7 +292,7 @@ void footpath_get_coordinates_from_pos( { if (interactionType != VIEWPORT_INTERACTION_ITEM_FOOTPATH) { - z = tile_element_height(position.x, position.y); + z = tile_element_height({ position.x, position.y }); } position = viewport_coord_to_map_coord(start_vp_pos.x, start_vp_pos.y, z); position.x = std::clamp(position.x, minPosition.x, maxPosition.x); diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index 39c1153bb9..f07cb748f5 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -461,18 +461,14 @@ void map_update_tile_pointers() * dx: return remember to & with 0xFFFF if you don't want water affecting results * rct2: 0x00662783 */ -int16_t tile_element_height(int32_t x, int32_t y) +int16_t tile_element_height(const CoordsXY loc) { // Off the map - if ((unsigned)x >= 8192 || (unsigned)y >= 8192) + if ((unsigned)loc.x >= 8192 || (unsigned)loc.y >= 8192) return 16; - // Truncate subtile coordinates - int32_t x_tile = x & 0xFFFFFFE0; - int32_t y_tile = y & 0xFFFFFFE0; - // Get the surface element for the tile - auto surfaceElement = map_get_surface_element_at({ x_tile, y_tile }); + auto surfaceElement = map_get_surface_element_at(loc); if (surfaceElement == nullptr) { @@ -493,8 +489,8 @@ int16_t tile_element_height(int32_t x, int32_t y) uint8_t TILE_SIZE = 31; - xl = x & 0x1f; - yl = y & 0x1f; + xl = loc.x & 0x1f; + yl = loc.y & 0x1f; // Slope logic: // Each of the four bits in slope represents that corner being raised diff --git a/src/openrct2/world/Map.h b/src/openrct2/world/Map.h index ea3250b47d..d0014dda26 100644 --- a/src/openrct2/world/Map.h +++ b/src/openrct2/world/Map.h @@ -151,7 +151,7 @@ SmallSceneryElement* map_get_small_scenery_element_at(int32_t x, int32_t y, int3 EntranceElement* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost); EntranceElement* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t z, bool ghost); EntranceElement* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, bool ghost); -int16_t tile_element_height(int32_t x, int32_t y); +int16_t tile_element_height(const CoordsXY loc); int16_t tile_element_water_height(int32_t x, int32_t y); uint8_t map_get_highest_land_height(int32_t xMin, int32_t xMax, int32_t yMin, int32_t yMax); uint8_t map_get_lowest_land_height(int32_t xMin, int32_t xMax, int32_t yMin, int32_t yMax); diff --git a/src/openrct2/world/MapGen.cpp b/src/openrct2/world/MapGen.cpp index bc821b4110..6f9f1a84fd 100644 --- a/src/openrct2/world/MapGen.cpp +++ b/src/openrct2/world/MapGen.cpp @@ -236,7 +236,7 @@ static void mapgen_place_tree(int32_t type, int32_t x, int32_t y) return; } - surfaceZ = tile_element_height(x * 32 + 16, y * 32 + 16) / 8; + surfaceZ = tile_element_height({ x * 32 + 16, y * 32 + 16 }) / 8; tileElement = tile_element_insert(x, y, surfaceZ, (1 | 2 | 4 | 8)); assert(tileElement != nullptr); tileElement->clearance_height = surfaceZ + (sceneryEntry->small_scenery.height >> 3); diff --git a/src/openrct2/world/MoneyEffect.cpp b/src/openrct2/world/MoneyEffect.cpp index 28e43e4e9f..2e686a66ed 100644 --- a/src/openrct2/world/MoneyEffect.cpp +++ b/src/openrct2/world/MoneyEffect.cpp @@ -100,7 +100,7 @@ void rct_money_effect::Create(money32 value) if (mapPosition.x == LOCATION_NULL) return; - mapPosition.z = tile_element_height(mapPosition.x, mapPosition.y); + mapPosition.z = tile_element_height({ mapPosition.x, mapPosition.y }); } mapPosition.z += 10; CreateAt(-value, mapPosition.x, mapPosition.y, mapPosition.z, false); diff --git a/src/openrct2/world/Particle.cpp b/src/openrct2/world/Particle.cpp index d675ac9593..ae8145aa28 100644 --- a/src/openrct2/world/Particle.cpp +++ b/src/openrct2/world/Particle.cpp @@ -80,7 +80,7 @@ void crashed_vehicle_particle_update(rct_crashed_vehicle_particle* particle) particle->velocity_z = vz & 0xFFFF; // Check collision with land / water - int16_t landZ = tile_element_height(x, y); + int16_t landZ = tile_element_height({ x, y }); int16_t waterZ = tile_element_water_height(x, y); if (waterZ != 0 && particle->z >= waterZ && z <= waterZ)