diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index d5d2ab6f8b..aa2801a4c9 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -2926,7 +2926,7 @@ static void peep_interact_with_path(rct_peep* peep, int16_t x, int16_t y, rct_ti // Peep is not queuing. peep->time_lost = 0; - uint8_t stationNum = (tile_element->properties.path.additions & 0x70) >> 4; + uint8_t stationNum = tile_element->AsPath()->GetStationIndex(); if ((tile_element->properties.path.type & (1 << 3)) // Queue has the ride sign on it && (tile_element->AsPath()->GetQueueBannerDirection() diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 33b07c5105..c5c4d4281b 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -479,7 +479,7 @@ private: case TILE_ELEMENT_TYPE_PATH: { uint8_t pathType = tileElement->AsPath()->GetRCT1PathType(); - uint8_t pathAdditionsType = tileElement->properties.path.additions & 0x0F; + uint8_t pathAdditionsType = tileElement->AsPath()->GetAddition(); AddEntryForPath(pathType); AddEntryForPathAddition(pathAdditionsType); diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 809e0b544a..3e6f6c5fa6 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -271,7 +271,7 @@ static money32 footpath_element_insert( tileElement->properties.path.type |= (slope & TILE_ELEMENT_SLOPE_W_CORNER_DN); if (type & FOOTPATH_ELEMENT_INSERT_QUEUE) tileElement->AsPath()->SetIsQueue(true); - tileElement->properties.path.additions = pathItemType; + tileElement->AsPath()->SetAddition(pathItemType); tileElement->properties.path.addition_status = 255; tileElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN; if (flags & GAME_COMMAND_FLAG_GHOST) @@ -650,7 +650,7 @@ static money32 footpath_place_from_track( tileElement->clearance_height = z + 4 + ((slope & TILE_ELEMENT_SLOPE_S_CORNER_UP) ? 2 : 0); tileElement->properties.path.type = (type << 4) | (slope & TILE_ELEMENT_SLOPE_W_CORNER_DN); tileElement->type |= type >> 7; - tileElement->properties.path.additions = 0; + tileElement->AsPath()->SetAddition(0); tileElement->properties.path.addition_status = 255; tileElement->properties.path.edges = edges & FOOTPATH_PROPERTIES_EDGES_EDGES_MASK; tileElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN; @@ -1672,8 +1672,7 @@ void footpath_chain_ride_queue( tileElement->properties.path.type &= ~FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER; tileElement->properties.path.edges |= (1 << (direction ^ 2)); tileElement->properties.path.ride_index = rideIndex; - tileElement->properties.path.additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK; - tileElement->properties.path.additions |= (entranceIndex << 4) & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK; + tileElement->AsPath()->SetStationIndex(entranceIndex); map_invalidate_element(x, y, tileElement); @@ -1991,6 +1990,17 @@ bool PathElement::HasQueueBanner() const return (entryIndex & FOOTPATH_PROPERTIES_FLAG_HAS_QUEUE_BANNER) != 0; } +uint8_t PathElement::GetStationIndex() const +{ + return (additions & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK) >> 4; +} + +void PathElement::SetStationIndex(uint8_t newStationIndex) +{ + additions &= ~FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK; + additions |= ((newStationIndex << 4) & FOOTPATH_PROPERTIES_ADDITIONS_STATION_INDEX_MASK); +} + bool PathElement::IsWide() const { return (type & FOOTPATH_ELEMENT_TYPE_FLAG_IS_WIDE) != 0; diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index df596fd230..8f1dc717ee 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -208,6 +208,9 @@ public: bool IsSloped() const; void SetSloped(bool isSloped); + uint8_t GetStationIndex() const; + void SetStationIndex(uint8_t newStationIndex); + bool IsWide() const; void SetWide(bool isWide);