mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-10 09:32:29 +01:00
Replace GetSurfaceStyleAtLocation with map_get_surface_element_at
There exists a helper function map_get_surface_element_at which already searches a tile's element list for the surface element, so we can just use that.
This commit is contained in:
@@ -122,7 +122,7 @@ protected:
|
||||
{
|
||||
const uint32_t forbiddenSurfaceStyle = 8u;
|
||||
|
||||
const uint32_t style = GetSurfaceStyleAtLocation(TileCoordsXY(location.x, location.y));
|
||||
const uint32_t style = map_get_surface_element_at(location.x, location.y)->AsSurface()->GetSurfaceStyle();
|
||||
|
||||
if (style == forbiddenSurfaceStyle)
|
||||
return ::testing::AssertionFailure()
|
||||
@@ -134,21 +134,9 @@ protected:
|
||||
|
||||
private:
|
||||
|
||||
static uint32_t GetSurfaceStyleAtLocation(const TileCoordsXY& location)
|
||||
{
|
||||
TileElement* element = map_get_first_element_at(location.x, location.y);
|
||||
|
||||
// Every tile *should* have a surface sprite, so we should be guaranteed to find
|
||||
// something before we go off the end of the data.
|
||||
while (element->GetType() != TILE_ELEMENT_TYPE_SURFACE)
|
||||
element++;
|
||||
|
||||
return element->AsSurface()->GetSurfaceStyle();
|
||||
}
|
||||
|
||||
static ::testing::AssertionResult AssertPositionIsSetUp(const char* positionKind, uint32_t expectedSurfaceStyle, const TileCoordsXYZ& location)
|
||||
{
|
||||
const uint32_t style = GetSurfaceStyleAtLocation(TileCoordsXY(location.x, location.y));
|
||||
const uint32_t style = map_get_surface_element_at(location.x, location.y)->AsSurface()->GetSurfaceStyle();
|
||||
|
||||
if (style != expectedSurfaceStyle)
|
||||
return ::testing::AssertionFailure()
|
||||
|
||||
Reference in New Issue
Block a user