1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-31 18:55:23 +01:00

Clean up many other coordinates

This commit is contained in:
Gymnasiast
2020-03-13 12:03:43 +01:00
parent 3412c47a9e
commit bdf681f440
32 changed files with 132 additions and 172 deletions

View File

@@ -143,8 +143,7 @@ public:
banner->text_colour = 2;
banner->type = _bannerType;
banner->colour = _primaryColour;
banner->position.x = _loc.x / 32;
banner->position.y = _loc.y / 32;
banner->position = TileCoordsXY(_loc);
newTileElement->SetType(TILE_ELEMENT_TYPE_BANNER);
BannerElement* bannerElement = newTileElement->AsBanner();
bannerElement->SetClearanceZ(_loc.z + PATH_CLEARANCE);

View File

@@ -76,12 +76,12 @@ public:
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_LAND_SLOPE_UNSUITABLE);
}
if (_loc.z / 8 < FootpathMinHeight)
if (_loc.z < FootpathMinHeight)
{
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_LOW);
}
if (_loc.z / 8 > FootpathMaxHeight)
if (_loc.z > FootpathMaxHeight)
{
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_BUILD_FOOTPATH_HERE, STR_TOO_HIGH);
}

View File

@@ -72,12 +72,12 @@ public:
return MakeResult(GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
if (_loc.z / 8 < FootpathMinHeight)
if (_loc.z < FootpathMinHeight)
{
return MakeResult(GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_LOW);
}
if (_loc.z / 8 > FootpathMaxHeight)
if (_loc.z > FootpathMaxHeight)
{
return MakeResult(GA_ERROR::DISALLOWED, STR_RIDE_CONSTRUCTION_CANT_CONSTRUCT_THIS_HERE, STR_TOO_HIGH);
}

View File

@@ -63,12 +63,12 @@ public:
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_POSITION_THIS_HERE, STR_LAND_NOT_OWNED_BY_PARK);
}
if (_loc.z / 8 < 2)
if (_loc.z < FootpathMinHeight)
{
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE, STR_TOO_LOW);
}
if (_loc.z / 8 > 248)
if (_loc.z > FootpathMaxHeight)
{
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_POSITION_THIS_HERE, STR_TOO_HIGH);
}

View File

@@ -57,12 +57,12 @@ public:
return MakeResult(GA_ERROR::DISALLOWED, STR_CANT_REMOVE_THIS, STR_LAND_NOT_OWNED_BY_PARK);
}
if (_loc.z / 8 < 2)
if (_loc.z < FootpathMinHeight)
{
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_TOO_LOW);
}
if (_loc.z / 8 > 248)
if (_loc.z > FootpathMaxHeight)
{
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_CANT_REMOVE_THIS, STR_TOO_HIGH);
}

View File

@@ -159,13 +159,13 @@ public:
curTile.x += _loc.x;
curTile.y += _loc.y;
int32_t zLow = (tile->z_offset + maxHeight) / 8;
int32_t zHigh = (tile->z_clearance / 8) + zLow;
int32_t zLow = tile->z_offset + maxHeight;
int32_t zHigh = tile->z_clearance + zLow;
QuarterTile quarterTile = QuarterTile{ static_cast<uint8_t>(tile->flags >> 12), 0 }.Rotate(_loc.direction);
if (!map_can_construct_with_clear_at(
{ curTile, zLow * COORDS_Z_STEP, zHigh * COORDS_Z_STEP }, &map_place_scenery_clear_func, quarterTile,
GetFlags(), &supportsCost, CREATE_CROSSING_MODE_NONE))
{ curTile, zLow, zHigh }, &map_place_scenery_clear_func, quarterTile, GetFlags(), &supportsCost,
CREATE_CROSSING_MODE_NONE))
{
return std::make_unique<LargeSceneryPlaceActionResult>(
GA_ERROR::NO_CLEARANCE, gGameCommandErrorText, gCommonFormatArgs);
@@ -193,7 +193,7 @@ public:
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::DISALLOWED, STR_OFF_EDGE_OF_MAP);
}
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !map_is_location_owned({ curTile, zLow * COORDS_Z_STEP })
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR) && !map_is_location_owned({ curTile, zLow })
&& !gCheatsSandboxMode)
{
return std::make_unique<LargeSceneryPlaceActionResult>(GA_ERROR::DISALLOWED, STR_LAND_NOT_OWNED_BY_PARK);
@@ -263,8 +263,7 @@ public:
banner->text_colour = 2;
banner->flags = BANNER_FLAG_IS_LARGE_SCENERY;
banner->type = 0;
banner->position.x = _loc.x / 32;
banner->position.y = _loc.y / 32;
banner->position = TileCoordsXY(_loc);
ride_id_t rideIndex = banner_get_closest_ride_index({ _loc, maxHeight });
if (rideIndex != RIDE_ID_NULL)

View File

@@ -300,16 +300,13 @@ private:
if (it.element->AsTrack()->GetRideIndex() != (ride_id_t)_rideIndex)
continue;
int32_t x = it.x * 32, y = it.y * 32;
int32_t z = it.element->GetBaseZ();
uint8_t rotation = it.element->GetDirection();
auto location = CoordsXYZD(
TileCoordsXY(it.x, it.y).ToCoordsXY(), it.element->GetBaseZ(), it.element->GetDirection());
auto type = it.element->AsTrack()->GetTrackType();
if (type != TRACK_ELEM_MAZE)
{
auto trackRemoveAction = TrackRemoveAction(
type, it.element->AsTrack()->GetSequenceIndex(), { x, y, z, rotation });
auto trackRemoveAction = TrackRemoveAction(type, it.element->AsTrack()->GetSequenceIndex(), location);
trackRemoveAction.SetFlags(GAME_COMMAND_FLAG_NO_SPEND);
auto removRes = GameActions::ExecuteNested(&trackRemoveAction);
@@ -337,7 +334,7 @@ private:
for (Direction dir : ALL_DIRECTIONS)
{
const CoordsXY& off = DirOffsets[dir];
money32 removePrice = MazeRemoveTrack(x + off.x, y + off.y, z, dir);
money32 removePrice = MazeRemoveTrack(location.x + off.x, location.y + off.y, location.z, dir);
if (removePrice != MONEY32_UNDEFINED)
refundPrice += removePrice;
else

View File

@@ -57,10 +57,6 @@ public:
return MakeResult(GA_ERROR::INVALID_PARAMETERS, STR_NONE);
}
auto banner = GetBanner(_bannerIndex);
CoordsXY coords{ banner->position.x * 32, banner->position.y * 32 };
if (_isLarge)
{
TileElement* tileElement = banner_get_tile_element(_bannerIndex);
@@ -93,7 +89,7 @@ public:
{
auto banner = GetBanner(_bannerIndex);
CoordsXY coords{ banner->position.x * 32, banner->position.y * 32 };
CoordsXY coords = banner->position.ToCoordsXY();
if (_isLarge)
{

View File

@@ -89,9 +89,9 @@ public:
gStaffModes[peep->staff_id] |= (1 << 1);
}
for (int32_t y = 0; y < 4 * 32; y += COORDS_XY_STEP)
for (int32_t y = 0; y < 4 * COORDS_XY_STEP; y += COORDS_XY_STEP)
{
for (int32_t x = 0; x < 4 * 32; x += COORDS_XY_STEP)
for (int32_t x = 0; x < 4 * COORDS_XY_STEP; x += COORDS_XY_STEP)
{
map_invalidate_tile_full({ (_loc.x & 0x1F80) + x, (_loc.y & 0x1F80) + y });
}