mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-15 19:13:07 +01:00
Refactor InitTileElement
Break loop when going to go outside of Tile
This commit is contained in:
@@ -93,19 +93,21 @@ private:
|
||||
void InitTileElement()
|
||||
{
|
||||
TileElement* tileElement = map_get_first_element_at(_banner->position.ToCoordsXY().ToTileCentre());
|
||||
if (tileElement == nullptr)
|
||||
if (tileElement != nullptr)
|
||||
{
|
||||
_tileElement = nullptr;
|
||||
return;
|
||||
while (1)
|
||||
{
|
||||
if ((tileElement->GetType() == TILE_ELEMENT_TYPE_BANNER) && (tileElement->AsBanner()->GetIndex() == number))
|
||||
{
|
||||
_tileElement = tileElement;
|
||||
return;
|
||||
}
|
||||
if (tileElement->IsLastForTile())
|
||||
break;
|
||||
tileElement++;
|
||||
}
|
||||
}
|
||||
|
||||
while (1)
|
||||
{
|
||||
if ((tileElement->GetType() == TILE_ELEMENT_TYPE_BANNER) && (tileElement->AsBanner()->GetIndex() == number))
|
||||
break;
|
||||
tileElement++;
|
||||
}
|
||||
_tileElement = tileElement;
|
||||
_tileElement = nullptr;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
Reference in New Issue
Block a user