Use CoordsXYZ on map_get_footpath_element_slope()

This commit is contained in:
Tulio Leao committed 2020-01-11 11:13:05 -03:00
1 parent 900a2fbd7b
commit 613dd41b53
2 files changed
+6 -6

No files matched your search

+5 -5
View File
@@ -95,7 +95,7 @@ public:
}
footpath_provisional_remove();
auto tileElement = map_get_footpath_element_slope((_loc.x / 32), (_loc.y / 32), _loc.z / 8, _slope);
auto tileElement = map_get_footpath_element_slope(_loc, _slope);
if (tileElement == nullptr)
{
return ElementInsertQuery(std::move(res));
@@ -141,7 +141,7 @@ public:
}
}
auto tileElement = map_get_footpath_element_slope((_loc.x / 32), (_loc.y / 32), _loc.z / 8, _slope);
auto tileElement = map_get_footpath_element_slope(_loc, _slope);
if (tileElement == nullptr)
{
return ElementInsertExecute(std::move(res));
@@ -432,17 +432,17 @@ private:
map_invalidate_tile_full(_loc);
}
PathElement* map_get_footpath_element_slope(int32_t x, int32_t y, int32_t z, int32_t slope) const
PathElement* map_get_footpath_element_slope(const CoordsXYZ& footpathPos, int32_t slope) const
{
TileElement* tileElement;
bool isSloped = slope & FOOTPATH_PROPERTIES_FLAG_IS_SLOPED;
tileElement = map_get_first_element_at(TileCoordsXY{ x, y }.ToCoordsXY());
tileElement = map_get_first_element_at(footpathPos);
do
{
if (tileElement == nullptr)
break;
if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH && tileElement->base_height == z
if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH && tileElement->GetBaseZ() == footpathPos.z
&& (tileElement->AsPath()->IsSloped() == isSloped)
&& (tileElement->AsPath()->GetSlopeDirection() == (slope & FOOTPATH_PROPERTIES_SLOPE_DIRECTION_MASK)))
{
+1 -1
View File
@@ -177,7 +177,7 @@ extern const LocationXY16 BenchUseOffsets[NumOrthogonalDirections * 2];
TileElement* map_get_footpath_element(CoordsXYZ coords);
struct PathElement;
PathElement* map_get_footpath_element_slope(int32_t x, int32_t y, int32_t z, int32_t slope);
PathElement* map_get_footpath_element_slope(const CoordsXYZ& footpathPos, int32_t slope);
void footpath_interrupt_peeps(const CoordsXYZ& footpathPos);
money32 footpath_remove(CoordsXYZ footpathLoc, int32_t flags);
money32 footpath_provisional_set(int32_t type, CoordsXYZ footpathLoc, int32_t slope);