mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2025-12-23 15:52:55 +01:00
Create dedicated method for SetLastForTile()
This commit is contained in:
@@ -2454,7 +2454,7 @@ static void sub_6CBCE2(
|
|||||||
_tempTrackTileElement.SetDirection(trackDirection);
|
_tempTrackTileElement.SetDirection(trackDirection);
|
||||||
_tempTrackTileElement.AsTrack()->SetHasChain((edx & 0x10000) != 0);
|
_tempTrackTileElement.AsTrack()->SetHasChain((edx & 0x10000) != 0);
|
||||||
_tempTrackTileElement.flags = quarterTile.GetBaseQuarterOccupied();
|
_tempTrackTileElement.flags = quarterTile.GetBaseQuarterOccupied();
|
||||||
_tempTrackTileElement.SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
_tempTrackTileElement.SetLastForTile(true);
|
||||||
_tempTrackTileElement.base_height = baseZ;
|
_tempTrackTileElement.base_height = baseZ;
|
||||||
_tempTrackTileElement.clearance_height = clearanceZ;
|
_tempTrackTileElement.clearance_height = clearanceZ;
|
||||||
_tempTrackTileElement.AsTrack()->SetTrackType(trackType);
|
_tempTrackTileElement.AsTrack()->SetTrackType(trackType);
|
||||||
|
|||||||
@@ -2694,7 +2694,7 @@ private:
|
|||||||
for (int32_t y = 0; y < RCT1_MAX_MAP_SIZE; y++)
|
for (int32_t y = 0; y < RCT1_MAX_MAP_SIZE; y++)
|
||||||
{
|
{
|
||||||
nextFreeTileElement->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
|
nextFreeTileElement->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
|
||||||
nextFreeTileElement->SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
nextFreeTileElement->SetLastForTile(true);
|
||||||
nextFreeTileElement->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
nextFreeTileElement->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
||||||
nextFreeTileElement->AsSurface()->SetSurfaceStyle(TERRAIN_GRASS);
|
nextFreeTileElement->AsSurface()->SetSurfaceStyle(TERRAIN_GRASS);
|
||||||
nextFreeTileElement->AsSurface()->SetEdgeStyle(TERRAIN_EDGE_ROCK);
|
nextFreeTileElement->AsSurface()->SetEdgeStyle(TERRAIN_EDGE_ROCK);
|
||||||
@@ -2708,7 +2708,7 @@ private:
|
|||||||
for (int32_t y = 0; y < 128 * 256; y++)
|
for (int32_t y = 0; y < 128 * 256; y++)
|
||||||
{
|
{
|
||||||
nextFreeTileElement->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
|
nextFreeTileElement->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
|
||||||
nextFreeTileElement->SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
nextFreeTileElement->SetLastForTile(true);
|
||||||
nextFreeTileElement->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
nextFreeTileElement->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
||||||
nextFreeTileElement->AsSurface()->SetSurfaceStyle(TERRAIN_GRASS);
|
nextFreeTileElement->AsSurface()->SetSurfaceStyle(TERRAIN_GRASS);
|
||||||
nextFreeTileElement->AsSurface()->SetEdgeStyle(TERRAIN_EDGE_ROCK);
|
nextFreeTileElement->AsSurface()->SetEdgeStyle(TERRAIN_EDGE_ROCK);
|
||||||
|
|||||||
@@ -2411,7 +2411,7 @@ static void track_design_preview_clear_map()
|
|||||||
{
|
{
|
||||||
TileElement* tile_element = &gTileElements[i];
|
TileElement* tile_element = &gTileElements[i];
|
||||||
tile_element->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
|
tile_element->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
|
||||||
tile_element->SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
tile_element->SetLastForTile(true);
|
||||||
tile_element->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
tile_element->AsSurface()->SetSlope(TILE_ELEMENT_SLOPE_FLAT);
|
||||||
tile_element->AsSurface()->SetWaterHeight(0);
|
tile_element->AsSurface()->SetWaterHeight(0);
|
||||||
tile_element->AsSurface()->SetSurfaceStyle(TERRAIN_GRASS);
|
tile_element->AsSurface()->SetSurfaceStyle(TERRAIN_GRASS);
|
||||||
|
|||||||
@@ -310,7 +310,7 @@ void map_init(int32_t size)
|
|||||||
{
|
{
|
||||||
TileElement* tile_element = &gTileElements[i];
|
TileElement* tile_element = &gTileElements[i];
|
||||||
tile_element->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
|
tile_element->ClearAs(TILE_ELEMENT_TYPE_SURFACE);
|
||||||
tile_element->SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
tile_element->SetLastForTile(true);
|
||||||
tile_element->base_height = 14;
|
tile_element->base_height = 14;
|
||||||
tile_element->clearance_height = 14;
|
tile_element->clearance_height = 14;
|
||||||
tile_element->AsSurface()->SetWaterHeight(0);
|
tile_element->AsSurface()->SetWaterHeight(0);
|
||||||
@@ -957,7 +957,7 @@ void tile_element_remove(TileElement* tileElement)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Mark the latest element with the last element flag.
|
// Mark the latest element with the last element flag.
|
||||||
(tileElement - 1)->SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
(tileElement - 1)->SetLastForTile(true);
|
||||||
tileElement->base_height = 0xFF;
|
tileElement->base_height = 0xFF;
|
||||||
|
|
||||||
if ((tileElement + 1) == gNextFreeTileElement)
|
if ((tileElement + 1) == gNextFreeTileElement)
|
||||||
@@ -1181,8 +1181,7 @@ TileElement* tile_element_insert(const TileCoordsXYZ& loc, int32_t flags)
|
|||||||
if ((newTileElement - 1)->IsLastForTile())
|
if ((newTileElement - 1)->IsLastForTile())
|
||||||
{
|
{
|
||||||
// No more elements above the insert element
|
// No more elements above the insert element
|
||||||
(newTileElement - 1)->SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, false);
|
(newTileElement - 1)->SetLastForTile(false);
|
||||||
;
|
|
||||||
flags |= TILE_ELEMENT_FLAG_LAST_TILE;
|
flags |= TILE_ELEMENT_FLAG_LAST_TILE;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,14 @@ bool TileElementBase::IsLastForTile() const
|
|||||||
return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
|
return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TileElementBase::SetLastForTile(bool on)
|
||||||
|
{
|
||||||
|
if (on)
|
||||||
|
flags |= TILE_ELEMENT_FLAG_LAST_TILE;
|
||||||
|
else
|
||||||
|
flags &= ~TILE_ELEMENT_FLAG_LAST_TILE;
|
||||||
|
}
|
||||||
|
|
||||||
bool TileElementBase::IsGhost() const
|
bool TileElementBase::IsGhost() const
|
||||||
{
|
{
|
||||||
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0;
|
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0;
|
||||||
@@ -205,16 +213,3 @@ const QuarterTile QuarterTile::Rotate(uint8_t amount) const
|
|||||||
return QuarterTile{ 0 };
|
return QuarterTile{ 0 };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TileElementBase::HasFlag(uint8_t flag) const
|
|
||||||
{
|
|
||||||
return (flags & flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TileElementBase::SetFlag(uint8_t flag, bool on)
|
|
||||||
{
|
|
||||||
if (on)
|
|
||||||
flags |= flag;
|
|
||||||
else
|
|
||||||
flags &= ~flag;
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -71,12 +71,10 @@ struct TileElementBase
|
|||||||
void SetDirection(uint8_t direction);
|
void SetDirection(uint8_t direction);
|
||||||
uint8_t GetDirectionWithOffset(uint8_t offset) const;
|
uint8_t GetDirectionWithOffset(uint8_t offset) const;
|
||||||
bool IsLastForTile() const;
|
bool IsLastForTile() const;
|
||||||
|
void SetLastForTile(bool on);
|
||||||
bool IsGhost() const;
|
bool IsGhost() const;
|
||||||
void SetGhost(bool isGhost);
|
void SetGhost(bool isGhost);
|
||||||
void Remove();
|
void Remove();
|
||||||
|
|
||||||
bool HasFlag(uint8_t flag) const;
|
|
||||||
void SetFlag(uint8_t flag, bool on);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -65,8 +65,8 @@ static bool map_swap_elements_at(CoordsXY loc, int16_t first, int16_t second)
|
|||||||
// Swap the 'last map element for tile' flag if either one of them was last
|
// Swap the 'last map element for tile' flag if either one of them was last
|
||||||
if ((firstElement)->IsLastForTile() || (secondElement)->IsLastForTile())
|
if ((firstElement)->IsLastForTile() || (secondElement)->IsLastForTile())
|
||||||
{
|
{
|
||||||
firstElement->SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, !firstElement->IsLastForTile());
|
firstElement->SetLastForTile(!firstElement->IsLastForTile());
|
||||||
secondElement->SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, !secondElement->IsLastForTile());
|
secondElement->SetLastForTile(!secondElement->IsLastForTile());
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
@@ -324,7 +324,7 @@ GameActionResult::Ptr tile_inspector_paste_element_at(CoordsXY loc, TileElement
|
|||||||
|
|
||||||
bool lastForTile = pastedElement->IsLastForTile();
|
bool lastForTile = pastedElement->IsLastForTile();
|
||||||
*pastedElement = element;
|
*pastedElement = element;
|
||||||
pastedElement->SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, lastForTile);
|
pastedElement->SetLastForTile(lastForTile);
|
||||||
|
|
||||||
map_invalidate_tile_full(loc.x, loc.y);
|
map_invalidate_tile_full(loc.x, loc.y);
|
||||||
|
|
||||||
|
|||||||
@@ -155,24 +155,19 @@ rct_sprite* get_sprite(size_t sprite_idx)
|
|||||||
return &sprite_list[sprite_idx];
|
return &sprite_list[sprite_idx];
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TileElementBase::HasFlag(uint8_t flag) const
|
|
||||||
{
|
|
||||||
return (flags & flag);
|
|
||||||
}
|
|
||||||
|
|
||||||
void TileElementBase::SetFlag(uint8_t flag, bool on)
|
|
||||||
{
|
|
||||||
if (on)
|
|
||||||
flags |= flag;
|
|
||||||
else
|
|
||||||
flags &= ~flag;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool TileElementBase::IsLastForTile() const
|
bool TileElementBase::IsLastForTile() const
|
||||||
{
|
{
|
||||||
return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
|
return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TileElementBase::SetLastForTile(bool on)
|
||||||
|
{
|
||||||
|
if (on)
|
||||||
|
flags |= TILE_ELEMENT_FLAG_LAST_TILE;
|
||||||
|
else
|
||||||
|
flags &= ~TILE_ELEMENT_FLAG_LAST_TILE;
|
||||||
|
}
|
||||||
|
|
||||||
uint8_t TileElementBase::GetType() const
|
uint8_t TileElementBase::GetType() const
|
||||||
{
|
{
|
||||||
return this->type & TILE_ELEMENT_TYPE_MASK;
|
return this->type & TILE_ELEMENT_TYPE_MASK;
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ static uint8_t TestTrackElementPaintCalls(uint8_t rideType, uint8_t trackType, u
|
|||||||
|
|
||||||
TileElement tileElement = {};
|
TileElement tileElement = {};
|
||||||
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
||||||
tileElement.SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
tileElement.SetLastForTile(true);
|
||||||
tileElement.AsTrack()->SetTrackType(trackType);
|
tileElement.AsTrack()->SetTrackType(trackType);
|
||||||
tileElement.base_height = height / 16;
|
tileElement.base_height = height / 16;
|
||||||
g_currently_drawn_item = &tileElement;
|
g_currently_drawn_item = &tileElement;
|
||||||
@@ -425,7 +425,7 @@ static uint8_t TestTrackElementSegmentSupportHeight(
|
|||||||
|
|
||||||
TileElement tileElement = {};
|
TileElement tileElement = {};
|
||||||
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
||||||
tileElement.SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
tileElement.SetLastForTile(true);
|
||||||
tileElement.AsTrack()->SetTrackType(trackType);
|
tileElement.AsTrack()->SetTrackType(trackType);
|
||||||
tileElement.base_height = height / 16;
|
tileElement.base_height = height / 16;
|
||||||
g_currently_drawn_item = &tileElement;
|
g_currently_drawn_item = &tileElement;
|
||||||
@@ -512,7 +512,7 @@ static uint8_t TestTrackElementGeneralSupportHeight(
|
|||||||
|
|
||||||
TileElement tileElement = {};
|
TileElement tileElement = {};
|
||||||
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
||||||
tileElement.SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
tileElement.SetLastForTile(true);
|
||||||
tileElement.AsTrack()->SetTrackType(trackType);
|
tileElement.AsTrack()->SetTrackType(trackType);
|
||||||
tileElement.base_height = height / 16;
|
tileElement.base_height = height / 16;
|
||||||
g_currently_drawn_item = &tileElement;
|
g_currently_drawn_item = &tileElement;
|
||||||
@@ -613,7 +613,7 @@ static uint8_t TestTrackElementSideTunnels(uint8_t rideType, uint8_t trackType,
|
|||||||
|
|
||||||
TileElement tileElement = {};
|
TileElement tileElement = {};
|
||||||
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
||||||
tileElement.SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
tileElement.SetLastForTile(true);
|
||||||
tileElement.AsTrack()->SetTrackType(trackType);
|
tileElement.AsTrack()->SetTrackType(trackType);
|
||||||
tileElement.base_height = height / 16;
|
tileElement.base_height = height / 16;
|
||||||
g_currently_drawn_item = &tileElement;
|
g_currently_drawn_item = &tileElement;
|
||||||
@@ -741,7 +741,7 @@ static uint8_t TestTrackElementVerticalTunnels(uint8_t rideType, uint8_t trackTy
|
|||||||
|
|
||||||
TileElement tileElement = {};
|
TileElement tileElement = {};
|
||||||
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
||||||
tileElement.SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
tileElement.SetLastForTile(true);
|
||||||
tileElement.AsTrack()->SetTrackType(trackType);
|
tileElement.AsTrack()->SetTrackType(trackType);
|
||||||
tileElement.base_height = height / 16;
|
tileElement.base_height = height / 16;
|
||||||
g_currently_drawn_item = &tileElement;
|
g_currently_drawn_item = &tileElement;
|
||||||
|
|||||||
@@ -446,7 +446,7 @@ private:
|
|||||||
{
|
{
|
||||||
TileElement tileElement = {};
|
TileElement tileElement = {};
|
||||||
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
tileElement.SetType(TILE_ELEMENT_TYPE_TRACK);
|
||||||
tileElement.SetFlag(TILE_ELEMENT_FLAG_LAST_TILE, true);
|
tileElement.SetLastForTile(true);
|
||||||
tileElement.AsTrack()->SetTrackType(trackType);
|
tileElement.AsTrack()->SetTrackType(trackType);
|
||||||
tileElement.base_height = 3;
|
tileElement.base_height = 3;
|
||||||
if (_invertedTrack)
|
if (_invertedTrack)
|
||||||
|
|||||||
Reference in New Issue
Block a user