Use IsBroken

This commit is contained in:
duncanspumpkin 2019-02-26 09:29:25 +00:00
parent 7840f6a7f7
commit fae15fceca
7 changed files with 22 additions and 22 deletions

View File

@ -366,7 +366,7 @@ int32_t viewport_interaction_get_item_right(int32_t x, int32_t y, viewport_inter
case VIEWPORT_INTERACTION_ITEM_FOOTPATH_ITEM:
sceneryEntry = tileElement->AsPath()->GetAdditionEntry();
set_map_tooltip_format_arg(0, rct_string_id, STR_MAP_TOOLTIP_STRINGID_CLICK_TO_REMOVE);
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
{
set_map_tooltip_format_arg(2, rct_string_id, STR_BROKEN);
set_map_tooltip_format_arg(4, rct_string_id, sceneryEntry->name);

View File

@ -2186,7 +2186,7 @@ static void window_tile_inspector_scrollpaint(rct_window* w, rct_drawpixelinfo*
const int32_t baseHeight = tileElement->base_height;
const int32_t clearanceHeight = tileElement->clearance_height;
const bool ghost = tileElement->IsGhost();
const bool broken = (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN) != 0;
const bool broken = tileElement->AsPath() == nullptr ? false : tileElement->AsPath()->IsBroken();
const bool last = (tileElement->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
const rct_string_id stringFormat = (selectedRow || hoveredRow) ? STR_WHITE_STRING : STR_WINDOW_COLOUR_2_STRINGID;

View File

@ -102,7 +102,7 @@ static void path_bit_lights_paint(
{
imageId = pathBitEntry->image + 1;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
@ -113,7 +113,7 @@ static void path_bit_lights_paint(
{
imageId = pathBitEntry->image + 2;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
@ -125,7 +125,7 @@ static void path_bit_lights_paint(
{
imageId = pathBitEntry->image + 3;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
@ -137,7 +137,7 @@ static void path_bit_lights_paint(
{
imageId = pathBitEntry->image + 4;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
@ -155,7 +155,7 @@ static void path_bit_bins_paint(
height += 8;
uint32_t imageId;
bool binsAreVandalised = tileElement->flags & TILE_ELEMENT_FLAG_BROKEN;
bool binsAreVandalised = tileElement->AsPath()->IsBroken();
if (!(edges & EDGE_NE))
{
@ -256,7 +256,7 @@ static void path_bit_benches_paint(
{
imageId = pathBitEntry->image + 1;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
@ -267,7 +267,7 @@ static void path_bit_benches_paint(
{
imageId = pathBitEntry->image + 2;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
@ -279,7 +279,7 @@ static void path_bit_benches_paint(
{
imageId = pathBitEntry->image + 3;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
@ -291,7 +291,7 @@ static void path_bit_benches_paint(
{
imageId = pathBitEntry->image + 4;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
imageId += 4;
imageId |= pathBitImageFlags;
@ -704,7 +704,7 @@ static void sub_6A3F61(
return;
if ((session->ViewFlags & VIEWPORT_FLAG_HIGHLIGHT_PATH_ISSUES)
&& !(tile_element->flags & TILE_ELEMENT_FLAG_BROKEN)
&& !(tile_element->AsPath()->IsBroken())
&& !(sceneryEntry->path_bit.draw_type == PATH_BIT_DRAW_TYPE_BINS))
{
return;
@ -948,7 +948,7 @@ void path_paint(paint_session* session, uint16_t height, const TileElement* tile
#ifdef __ENABLE_LIGHTFX__
if (lightfx_is_available())
{
if (tile_element->AsPath()->HasAddition() && !(tile_element->flags & TILE_ELEMENT_FLAG_BROKEN))
if (tile_element->AsPath()->HasAddition() && !(tile_element->AsPath()->IsBroken()))
{
rct_scenery_entry* sceneryEntry = tile_element->AsPath()->GetAdditionEntry();
if (sceneryEntry != nullptr && sceneryEntry->path_bit.flags & PATH_BIT_FLAG_LAMP)

View File

@ -2728,7 +2728,7 @@ static PeepThoughtType peep_assess_surroundings(int16_t centre_x, int16_t centre
num_fountains++;
break;
}
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
{
num_rubbish++;
}
@ -5782,7 +5782,7 @@ void rct_peep::UpdateUsingBin()
return;
}
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
{
StateReset();
return;
@ -5945,7 +5945,7 @@ bool rct_peep::UpdateWalkingFindBench()
if (sceneryEntry == nullptr || !(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BENCH))
return false;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
return false;
if (tileElement->AsPath()->AdditionIsGhost())
@ -6044,7 +6044,7 @@ bool rct_peep::UpdateWalkingFindBin()
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN))
return false;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
return false;
if (tileElement->AsPath()->AdditionIsGhost())
@ -6141,7 +6141,7 @@ static void peep_update_walking_break_scenery(rct_peep* peep)
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_BREAKABLE))
return;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
return;
if (tileElement->AsPath()->AdditionIsGhost())

View File

@ -2874,7 +2874,7 @@ static void peep_interact_with_path(rct_peep* peep, int16_t x, int16_t y, TileEl
{
// 0x00F1AEE2
bool vandalism_present = false;
if (tile_element->AsPath()->HasAddition() && (tile_element->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tile_element->AsPath()->HasAddition() && (tile_element->AsPath()->IsBroken())
&& (tile_element->AsPath()->GetEdges()) != 0xF)
{
vandalism_present = true;

View File

@ -1729,7 +1729,7 @@ void rct_peep::UpdateEmptyingBin()
}
rct_scenery_entry* scenery_entry = tile_element->AsPath()->GetAdditionEntry();
if (!(scenery_entry->path_bit.flags & PATH_BIT_FLAG_IS_BIN) || tile_element->flags & TILE_ELEMENT_FLAG_BROKEN
if (!(scenery_entry->path_bit.flags & PATH_BIT_FLAG_IS_BIN) || tile_element->AsPath()->IsBroken()
|| tile_element->AsPath()->AdditionIsGhost())
{
StateReset();
@ -2130,7 +2130,7 @@ static int32_t peep_update_patrolling_find_bin(rct_peep* peep)
if (!(sceneryEntry->path_bit.flags & PATH_BIT_FLAG_IS_BIN))
return 0;
if (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN)
if (tileElement->AsPath()->IsBroken())
return 0;
if (tileElement->AsPath()->AdditionIsGhost())

View File

@ -325,7 +325,7 @@ static money32 footpath_element_update(
else if (pathItemType != 0)
{
if (!(flags & GAME_COMMAND_FLAG_GHOST) && tileElement->AsPath()->GetAddition() == pathItemType
&& !(tileElement->flags & TILE_ELEMENT_FLAG_BROKEN))
&& !(tileElement->AsPath()->IsBroken()))
{
if (flags & GAME_COMMAND_FLAG_4)
return MONEY32_UNDEFINED;