mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-04 13:42:55 +01:00
Port entrance path type lookup
This commit is contained in:
committed by
Gymnasiast
parent
3c93aca727
commit
995c6debf1
@@ -156,7 +156,7 @@ void setup_in_use_selection_flags()
|
||||
|
||||
Editor::SetSelectedObject(OBJECT_TYPE_PARK_ENTRANCE, 0, OBJECT_SELECTION_FLAG_SELECTED);
|
||||
|
||||
type = iter.element->properties.entrance.path_type;
|
||||
type = iter.element->AsEntrance()->GetPathType();
|
||||
assert(type < object_entry_group_counts[OBJECT_TYPE_PATHS]);
|
||||
Editor::SetSelectedObject(OBJECT_TYPE_PATHS, type, OBJECT_SELECTION_FLAG_SELECTED);
|
||||
break;
|
||||
|
||||
@@ -194,7 +194,7 @@ public:
|
||||
newElement->SetDirection(_direction);
|
||||
newElement->AsEntrance()->SetSequenceIndex(index);
|
||||
newElement->AsEntrance()->SetEntranceType(ENTRANCE_TYPE_PARK_ENTRANCE);
|
||||
newElement->properties.entrance.path_type = gFootpathSelectedId;
|
||||
newElement->AsEntrance()->SetPathType(gFootpathSelectedId);
|
||||
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST))
|
||||
{
|
||||
|
||||
@@ -237,7 +237,7 @@ static void park_entrance_paint(paint_session* session, uint8_t direction, int32
|
||||
// The left and right of the park entrance often have this set to 127.
|
||||
// So only attempt to get the footpath type if we're dealing with the middle bit of the entrance.
|
||||
if (part_index == 0)
|
||||
path_entry = get_footpath_entry(tile_element->properties.entrance.path_type);
|
||||
path_entry = get_footpath_entry(tile_element->AsEntrance()->GetPathType());
|
||||
|
||||
rct_entrance_type* entrance;
|
||||
uint8_t di = ((direction / 2 + part_index / 2) & 1) ? 0x1A : 0x20;
|
||||
|
||||
@@ -2538,13 +2538,13 @@ private:
|
||||
case TILE_ELEMENT_TYPE_ENTRANCE:
|
||||
if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE)
|
||||
{
|
||||
uint8_t pathType = tileElement->properties.entrance.path_type;
|
||||
uint8_t pathType = tileElement->AsEntrance()->GetPathType();
|
||||
if (pathType == 0)
|
||||
{
|
||||
pathType = RCT1_FOOTPATH_TYPE_TARMAC_GRAY;
|
||||
}
|
||||
uint8_t entryIndex = _pathTypeToEntryMap[pathType];
|
||||
tileElement->properties.entrance.path_type = entryIndex & 0x7F;
|
||||
tileElement->AsEntrance()->SetPathType(entryIndex & 0x7F);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -671,4 +671,14 @@ void EntranceElement::SetSequenceIndex(uint8_t newSequenceIndex)
|
||||
{
|
||||
index &= ~0xF;
|
||||
index |= (newSequenceIndex & 0xF);
|
||||
}
|
||||
|
||||
uint8_t EntranceElement::GetPathType() const
|
||||
{
|
||||
return pathType;
|
||||
}
|
||||
|
||||
void EntranceElement::SetPathType(uint8_t newPathType)
|
||||
{
|
||||
pathType = newPathType;
|
||||
}
|
||||
@@ -222,7 +222,7 @@ static money32 footpath_element_insert(
|
||||
{
|
||||
entrancePath = true;
|
||||
// Make the price the same as replacing a path
|
||||
if (entranceElement->properties.entrance.path_type == (type & 0xF))
|
||||
if (entranceElement->AsEntrance()->GetPathType() == (type & 0xF))
|
||||
entranceIsSamePath = true;
|
||||
else
|
||||
gFootpathPrice -= MONEY(6, 00);
|
||||
@@ -256,7 +256,7 @@ static money32 footpath_element_insert(
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST) && !entranceIsSamePath)
|
||||
{
|
||||
// Set the path type but make sure it's not a queue as that will not show up
|
||||
entranceElement->properties.entrance.path_type = type & 0x7F;
|
||||
entranceElement->AsEntrance()->SetPathType(type & 0x7F);
|
||||
map_invalidate_tile_full(x, y);
|
||||
}
|
||||
}
|
||||
@@ -593,7 +593,7 @@ static money32 footpath_place_from_track(
|
||||
{
|
||||
entrancePath = true;
|
||||
// Make the price the same as replacing a path
|
||||
if (entranceElement->properties.entrance.path_type == (type & 0xF))
|
||||
if (entranceElement->AsEntrance()->GetPathType() == (type & 0xF))
|
||||
entranceIsSamePath = true;
|
||||
else
|
||||
gFootpathPrice -= MONEY(6, 00);
|
||||
@@ -636,7 +636,7 @@ static money32 footpath_place_from_track(
|
||||
if (!(flags & GAME_COMMAND_FLAG_GHOST) && !entranceIsSamePath)
|
||||
{
|
||||
// Set the path type but make sure it's not a queue as that will not show up
|
||||
entranceElement->properties.entrance.path_type = type & 0x7F;
|
||||
entranceElement->AsEntrance()->SetPathType(type & 0x7F);
|
||||
map_invalidate_tile_full(x, y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,15 +28,6 @@ struct rct_tile_element_path_properties
|
||||
};
|
||||
assert_struct_size(rct_tile_element_path_properties, 4);
|
||||
|
||||
struct rct_tile_element_entrance_properties
|
||||
{
|
||||
uint8_t type; // 4
|
||||
uint8_t index; // 5
|
||||
uint8_t path_type; // 6
|
||||
uint8_t ride_index; // 7
|
||||
};
|
||||
assert_struct_size(rct_tile_element_entrance_properties, 4);
|
||||
|
||||
struct rct_tile_element_banner_properties
|
||||
{
|
||||
BannerIndex index; // 4
|
||||
@@ -49,7 +40,6 @@ assert_struct_size(rct_tile_element_banner_properties, 4);
|
||||
union rct_tile_element_properties
|
||||
{
|
||||
rct_tile_element_path_properties path;
|
||||
rct_tile_element_entrance_properties entrance;
|
||||
rct_tile_element_banner_properties banner;
|
||||
};
|
||||
assert_struct_size(rct_tile_element_properties, 4);
|
||||
@@ -392,6 +382,9 @@ public:
|
||||
|
||||
uint8_t GetSequenceIndex() const;
|
||||
void SetSequenceIndex(uint8_t newSequenceIndex);
|
||||
|
||||
uint8_t GetPathType() const;
|
||||
void SetPathType(uint8_t newPathType);
|
||||
};
|
||||
assert_struct_size(EntranceElement, 8);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user