Replace C-style functions for checking path addition ghost status

This commit is contained in:
Gymnasiast authored and Michael Steenbeek committed 2018-10-04 12:13:17 +02:00
1 parent e159ac65a6
commit ee05438953
9 files changed
+24 -25

No files matched your search

@@ -817,7 +817,7 @@ void path_paint(paint_session* session, uint16_t height, const rct_tile_element*
imageFlags = SPRITE_ID_PALETTE_COLOUR_1(PALETTE_46);
}
if (footpath_element_path_scenery_is_ghost(tile_element))
if (tile_element->AsPath()->AdditionIsGhost())
{
sceneryImageFlags = CONSTRUCTION_MARKER;
}
+7 -7
View File
@@ -641,7 +641,7 @@ void rct_peep::Tick128UpdateGuest(int32_t index)
// Check if the footpath has a queue line TV monitor on it
if (footpath_element_has_path_scenery(tileElement)
&& !footpath_element_path_scenery_is_ghost(tileElement))
&& !tileElement->AsPath()->AdditionIsGhost())
{
uint8_t pathSceneryIndex = footpath_element_get_path_scenery_index(tileElement);
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(pathSceneryIndex);
@@ -2726,7 +2726,7 @@ static uint8_t peep_assess_surroundings(int16_t centre_x, int16_t centre_y, int1
{
return PEEP_THOUGHT_TYPE_NONE;
}
if (footpath_element_path_scenery_is_ghost(tileElement))
if (tileElement->AsPath()->AdditionIsGhost())
break;
if (scenery->path_bit.flags
@@ -5320,7 +5320,7 @@ void rct_peep::UpdateWalking()
if (footpath_element_has_path_scenery(tileElement))
{
if (!footpath_element_path_scenery_is_ghost(tileElement))
if (!tileElement->AsPath()->AdditionIsGhost())
{
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
if (sceneryEntry == nullptr)
@@ -5772,7 +5772,7 @@ void rct_peep::UpdateUsingBin()
return;
}
if (footpath_element_path_scenery_is_ghost(tileElement))
if (tileElement->AsPath()->AdditionIsGhost())
{
StateReset();
return;
@@ -5930,7 +5930,7 @@ bool rct_peep::UpdateWalkingFindBench()
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
return false;
if (footpath_element_path_scenery_is_ghost(tileElement))
if (tileElement->AsPath()->AdditionIsGhost())
return false;
int32_t edges = (tileElement->properties.path.edges & 0xF) ^ 0xF;
@@ -6029,7 +6029,7 @@ bool rct_peep::UpdateWalkingFindBin()
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
return false;
if (footpath_element_path_scenery_is_ghost(tileElement))
if (tileElement->AsPath()->AdditionIsGhost())
return false;
int32_t edges = (tileElement->properties.path.edges & 0xF) ^ 0xF;
@@ -6126,7 +6126,7 @@ static void peep_update_walking_break_scenery(rct_peep* peep)
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
return;
if (footpath_element_path_scenery_is_ghost(tileElement))
if (tileElement->AsPath()->AdditionIsGhost())
return;
int32_t edges = tileElement->properties.path.edges & 0xF;
+2 -2
View File
@@ -1818,7 +1818,7 @@ void rct_peep::UpdateEmptyingBin()
rct_scenery_entry* scenery_entry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tile_element));
if (!(scenery_entry->path_bit.flags & PATH_BIT_FLAG_IS_BIN) || tile_element->flags & (1 << 5)
|| footpath_element_path_scenery_is_ghost(tile_element))
|| tile_element->AsPath()->AdditionIsGhost())
{
StateReset();
return;
@@ -2220,7 +2220,7 @@ static int32_t peep_update_patrolling_find_bin(rct_peep* peep)
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
return 0;
if (footpath_element_path_scenery_is_ghost(tileElement))
if (tileElement->AsPath()->AdditionIsGhost())
return 0;
uint8_t bin_positions = tileElement->properties.path.edges & 0xF;
+1 -1
View File
@@ -2511,7 +2511,7 @@ private:
tileElement->AsPath()->SetIsQueue(true);
}
footpath_scenery_set_is_ghost(tileElement, false);
tileElement->AsPath()->SetAdditionIsGhost(false);
// Additions
uint8_t additionType = footpath_element_get_path_scenery(tileElement);
+8 -10
View File
@@ -365,16 +365,16 @@ static money32 footpath_element_update(
// There is nothing yet - check if we should place a ghost
if (flags & GAME_COMMAND_FLAG_APPLY)
footpath_scenery_set_is_ghost(tileElement, true);
tileElement->AsPath()->SetAdditionIsGhost(true);
}
if (!(flags & GAME_COMMAND_FLAG_APPLY))
return gParkFlags & PARK_FLAGS_NO_MONEY ? 0 : gFootpathPrice;
if ((pathItemType != 0 && !(flags & GAME_COMMAND_FLAG_GHOST))
|| (pathItemType == 0 && footpath_element_path_scenery_is_ghost(tileElement)))
|| (pathItemType == 0 && tileElement->AsPath()->AdditionIsGhost()))
{
footpath_scenery_set_is_ghost(tileElement, false);
tileElement->AsPath()->SetAdditionIsGhost(false);
}
footpath_element_set_path_scenery(tileElement, pathItemType);
@@ -2025,18 +2025,16 @@ uint8_t footpath_element_get_path_scenery_index(const rct_tile_element* tileElem
return footpath_element_get_path_scenery(tileElement) - 1;
}
bool footpath_element_path_scenery_is_ghost(const rct_tile_element* tileElement)
bool PathElement::AdditionIsGhost() const
{
return (tileElement->properties.path.additions & FOOTPATH_ADDITION_FLAG_IS_GHOST) != 0;
return (additions & FOOTPATH_ADDITION_FLAG_IS_GHOST) != 0;
}
void footpath_scenery_set_is_ghost(rct_tile_element* tileElement, bool isGhost)
void PathElement::SetAdditionIsGhost(bool isGhost)
{
// Remove ghost flag
tileElement->properties.path.additions &= ~FOOTPATH_ADDITION_FLAG_IS_GHOST;
// Set flag if it should be a ghost
additions &= ~FOOTPATH_ADDITION_FLAG_IS_GHOST;
if (isGhost)
tileElement->properties.path.additions |= FOOTPATH_ADDITION_FLAG_IS_GHOST;
additions |= FOOTPATH_ADDITION_FLAG_IS_GHOST;
}
uint8_t footpath_element_get_type(const rct_tile_element* tileElement)
-2
View File
@@ -163,8 +163,6 @@ bool footpath_element_has_path_scenery(const rct_tile_element* tileElement);
uint8_t footpath_element_get_path_scenery(const rct_tile_element* tileElement);
void footpath_element_set_path_scenery(rct_tile_element* tileElement, uint8_t pathSceneryType);
uint8_t footpath_element_get_path_scenery_index(const rct_tile_element* tileElement);
bool footpath_element_path_scenery_is_ghost(const rct_tile_element* tileElement);
void footpath_scenery_set_is_ghost(rct_tile_element* tileElement, bool isGhost);
void footpath_remove_edges_at(int32_t x, int32_t y, rct_tile_element* tileElement);
int32_t entrance_get_directions(const rct_tile_element* tileElement);
+1 -1
View File
@@ -259,7 +259,7 @@ static bool is_jumping_fountain(int32_t type, int32_t x, int32_t y, int32_t z)
continue;
if (tileElement->base_height != z)
continue;
if (footpath_element_path_scenery_is_ghost(tileElement))
if (tileElement->AsPath()->AdditionIsGhost())
continue;
if (!footpath_element_has_path_scenery(tileElement))
continue;
+1 -1
View File
@@ -88,7 +88,7 @@ void scenery_update_tile(int32_t x, int32_t y)
}
else if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)
{
if (footpath_element_has_path_scenery(tileElement) && !footpath_element_path_scenery_is_ghost(tileElement))
if (footpath_element_has_path_scenery(tileElement) && !tileElement->AsPath()->AdditionIsGhost())
{
rct_scenery_entry* sceneryEntry = get_footpath_item_entry(footpath_element_get_path_scenery_index(tileElement));
if (sceneryEntry != nullptr)
+3
View File
@@ -207,6 +207,9 @@ public:
void SetIsQueue(bool isQueue);
bool HasQueueBanner() const;
bool AdditionIsGhost() const;
void SetAdditionIsGhost(bool isGhost);
uint8_t GetRCT1PathType() const;
};
assert_struct_size(PathElement, 8);