Fix errors

This commit is contained in:
Gymnasiast 2020-03-04 22:28:06 +01:00
parent 3ed7694495
commit c9afcaa5b3
No known key found for this signature in database
GPG Key ID: DBFFF47AB2CA3EDD
8 changed files with 46 additions and 43 deletions

View File

@ -759,7 +759,7 @@ private:
{ {
dst->stations[i].Start = { src->station_starts[i].x, src->station_starts[i].y }; dst->stations[i].Start = { src->station_starts[i].x, src->station_starts[i].y };
} }
dst->stations[i].SetBaseZ(src->station_height[i] * 4); dst->stations[i].SetBaseZ(src->station_height[i] * RCT1_COORDS_Z_STEP);
dst->stations[i].Length = src->station_length[i]; dst->stations[i].Length = src->station_length[i];
dst->stations[i].Depart = src->station_light[i]; dst->stations[i].Depart = src->station_light[i];
@ -1994,8 +1994,8 @@ private:
dst->SetGhost(src->IsGhost()); dst->SetGhost(src->IsGhost());
dst->SetLastForTile(src->IsLastForTile()); dst->SetLastForTile(src->IsLastForTile());
dst->SetBaseZ(src->base_height * 4); dst->SetBaseZ(src->base_height * RCT1_COORDS_Z_STEP);
dst->SetClearanceZ(src->clearance_height * 4); dst->SetClearanceZ(src->clearance_height * RCT1_COORDS_Z_STEP);
switch (tileElementType) switch (tileElementType)
{ {

View File

@ -42,31 +42,31 @@ void RCT12TileElementBase::SetOccupiedQuadrants(uint8_t quadrants)
bool RCT12TileElementBase::IsLastForTile() const bool RCT12TileElementBase::IsLastForTile() const
{ {
return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0; return (this->flags & RCT12_TILE_ELEMENT_FLAG_LAST_TILE) != 0;
} }
bool RCT12TileElementBase::IsGhost() const bool RCT12TileElementBase::IsGhost() const
{ {
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0; return (this->flags & RCT12_TILE_ELEMENT_FLAG_GHOST) != 0;
} }
void RCT12TileElementBase::SetLastForTile(bool on) void RCT12TileElementBase::SetLastForTile(bool on)
{ {
if (on) if (on)
flags |= TILE_ELEMENT_FLAG_LAST_TILE; flags |= RCT12_TILE_ELEMENT_FLAG_LAST_TILE;
else else
flags &= ~TILE_ELEMENT_FLAG_LAST_TILE; flags &= ~RCT12_TILE_ELEMENT_FLAG_LAST_TILE;
} }
void RCT12TileElementBase::SetGhost(bool isGhost) void RCT12TileElementBase::SetGhost(bool isGhost)
{ {
if (isGhost) if (isGhost)
{ {
this->flags |= TILE_ELEMENT_FLAG_GHOST; this->flags |= RCT12_TILE_ELEMENT_FLAG_GHOST;
} }
else else
{ {
this->flags &= ~TILE_ELEMENT_FLAG_GHOST; this->flags &= ~RCT12_TILE_ELEMENT_FLAG_GHOST;
} }
} }
@ -745,18 +745,18 @@ void RCT12PathElement::SetAdditionIsGhost(bool isGhost)
bool RCT12PathElement::IsBroken() const bool RCT12PathElement::IsBroken() const
{ {
return (flags & RCT12_TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE) != 0; return (flags & RCT12_TILE_ELEMENT_FLAG_BROKEN) != 0;
} }
void RCT12PathElement::SetIsBroken(bool isBroken) void RCT12PathElement::SetIsBroken(bool isBroken)
{ {
if (isBroken) if (isBroken)
{ {
flags |= RCT12_TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE; flags |= RCT12_TILE_ELEMENT_FLAG_BROKEN;
} }
else else
{ {
flags &= ~RCT12_TILE_ELEMENT_FLAG_BLOCKED_BY_VEHICLE; flags &= ~RCT12_TILE_ELEMENT_FLAG_BROKEN;
} }
} }

View File

@ -1377,35 +1377,35 @@ void TrackElement::SetInverted(bool inverted)
bool TrackElement::BlockBrakeClosed() const bool TrackElement::BlockBrakeClosed() const
{ {
return (Flags2 & TRACK_ELEMENT_FLAG2_BLOCK_BRAKE_CLOSED) != 0; return (Flags2 & TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED) != 0;
} }
void TrackElement::SetBlockBrakeClosed(bool isClosed) void TrackElement::SetBlockBrakeClosed(bool isClosed)
{ {
if (isClosed) if (isClosed)
{ {
Flags2 |= TRACK_ELEMENT_FLAG2_BLOCK_BRAKE_CLOSED; Flags2 |= TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED;
} }
else else
{ {
Flags2 &= ~TRACK_ELEMENT_FLAG2_BLOCK_BRAKE_CLOSED; Flags2 &= ~TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED;
} }
} }
bool TrackElement::IsIndestructible() const bool TrackElement::IsIndestructible() const
{ {
return (Flags2 & TRACK_ELEMENT_FLAG2_INDESTRUCTIBLE_TRACK_PIECE) != 0; return (Flags2 & TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE) != 0;
} }
void TrackElement::SetIsIndestructible(bool isIndestructible) void TrackElement::SetIsIndestructible(bool isIndestructible)
{ {
if (isIndestructible) if (isIndestructible)
{ {
Flags2 |= TRACK_ELEMENT_FLAG2_INDESTRUCTIBLE_TRACK_PIECE; Flags2 |= TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE;
} }
else else
{ {
Flags2 &= ~TRACK_ELEMENT_FLAG2_INDESTRUCTIBLE_TRACK_PIECE; Flags2 &= ~TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE;
} }
} }

View File

@ -66,8 +66,8 @@ enum
TRACK_ELEMENT_FLAGS2_CABLE_LIFT = 1 << 2, TRACK_ELEMENT_FLAGS2_CABLE_LIFT = 1 << 2,
TRACK_ELEMENT_FLAGS2_HIGHLIGHT = 1 << 3, TRACK_ELEMENT_FLAGS2_HIGHLIGHT = 1 << 3,
TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT = 1 << 4, TRACK_ELEMENT_FLAGS2_HAS_GREEN_LIGHT = 1 << 4,
TRACK_ELEMENT_FLAG2_BLOCK_BRAKE_CLOSED = 1 << 5, TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED = 1 << 5,
TRACK_ELEMENT_FLAG2_INDESTRUCTIBLE_TRACK_PIECE = 1 << 6, TRACK_ELEMENT_FLAGS2_INDESTRUCTIBLE_TRACK_PIECE = 1 << 6,
}; };
enum enum

View File

@ -1563,7 +1563,7 @@ void PathElement::SetAdditionIsGhost(bool isGhost)
PathSurfaceIndex PathElement::GetSurfaceEntryIndex() const PathSurfaceIndex PathElement::GetSurfaceEntryIndex() const
{ {
return (SurfaceIndex & RCT12_FOOTPATH_PROPERTIES_TYPE_MASK) >> 4; return SurfaceIndex;
} }
PathRailingsIndex PathElement::GetRailingEntryIndex() const PathRailingsIndex PathElement::GetRailingEntryIndex() const

View File

@ -191,7 +191,10 @@ struct PathElement : TileElementBase
{ {
private: private:
PathSurfaceIndex SurfaceIndex; // 4 PathSurfaceIndex SurfaceIndex; // 4
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-private-field"
PathRailingsIndex RailingsIndex; // 6 PathRailingsIndex RailingsIndex; // 6
#pragma clang diagnostic pop
uint8_t Additions; // 7 (0 means no addition) uint8_t Additions; // 7 (0 means no addition)
uint8_t Edges; // 8 uint8_t Edges; // 8
uint8_t Flags2; // 9 uint8_t Flags2; // 9

View File

@ -157,15 +157,15 @@ rct_sprite* get_sprite(size_t sprite_idx)
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) void TileElementBase::SetLastForTile(bool on)
{ {
if (on) if (on)
flags |= TILE_ELEMENT_FLAG_LAST_TILE; Flags |= TILE_ELEMENT_FLAG_LAST_TILE;
else else
flags &= ~TILE_ELEMENT_FLAG_LAST_TILE; Flags &= ~TILE_ELEMENT_FLAG_LAST_TILE;
} }
uint8_t TileElementBase::GetType() const uint8_t TileElementBase::GetType() const
@ -175,12 +175,12 @@ uint8_t TileElementBase::GetType() const
bool TileElementBase::IsGhost() const bool TileElementBase::IsGhost() const
{ {
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0; return (this->Flags & TILE_ELEMENT_FLAG_GHOST) != 0;
} }
bool TrackElement::BlockBrakeClosed() const bool TrackElement::BlockBrakeClosed() const
{ {
return (flags & TILE_ELEMENT_FLAG_BLOCK_BRAKE_CLOSED) != 0; return (Flags2 & TRACK_ELEMENT_FLAGS2_BLOCK_BRAKE_CLOSED) != 0;
} }
TileElement* map_get_first_element_at(const CoordsXY& elementPos) TileElement* map_get_first_element_at(const CoordsXY& elementPos)
@ -439,7 +439,7 @@ bool TrackElement::IsHighlighted() const
uint8_t PathElement::GetEdges() const uint8_t PathElement::GetEdges() const
{ {
return edges & 0xF; return Edges & 0xF;
} }
StationObject* ride_get_station_object(const Ride* ride) StationObject* ride_get_station_object(const Ride* ride)
@ -455,13 +455,13 @@ bool Vehicle::IsGhost() const
uint8_t TileElementBase::GetOccupiedQuadrants() const uint8_t TileElementBase::GetOccupiedQuadrants() const
{ {
return flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK; return Flags & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
} }
void TileElementBase::SetOccupiedQuadrants(uint8_t quadrants) void TileElementBase::SetOccupiedQuadrants(uint8_t quadrants)
{ {
flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK; Flags &= ~TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK;
flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK); Flags |= (quadrants & TILE_ELEMENT_OCCUPIED_QUADRANTS_MASK);
} }
int32_t TileElementBase::GetBaseZ() const int32_t TileElementBase::GetBaseZ() const