From fae15fceca935f67c78e2edd9248ebd17637886b Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Tue, 26 Feb 2019 09:29:25 +0000 Subject: [PATCH] Use IsBroken --- .../interface/ViewportInteraction.cpp | 2 +- src/openrct2-ui/windows/TileInspector.cpp | 2 +- .../paint/tile_element/Paint.Path.cpp | 22 +++++++++---------- src/openrct2/peep/Guest.cpp | 10 ++++----- src/openrct2/peep/Peep.cpp | 2 +- src/openrct2/peep/Staff.cpp | 4 ++-- src/openrct2/world/Footpath.cpp | 2 +- 7 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/openrct2-ui/interface/ViewportInteraction.cpp b/src/openrct2-ui/interface/ViewportInteraction.cpp index 9dea995104..8a6550ccaf 100644 --- a/src/openrct2-ui/interface/ViewportInteraction.cpp +++ b/src/openrct2-ui/interface/ViewportInteraction.cpp @@ -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); diff --git a/src/openrct2-ui/windows/TileInspector.cpp b/src/openrct2-ui/windows/TileInspector.cpp index cbd1ef930c..678a3dbd7a 100644 --- a/src/openrct2-ui/windows/TileInspector.cpp +++ b/src/openrct2-ui/windows/TileInspector.cpp @@ -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; diff --git a/src/openrct2/paint/tile_element/Paint.Path.cpp b/src/openrct2/paint/tile_element/Paint.Path.cpp index c70c206843..1561b0824a 100644 --- a/src/openrct2/paint/tile_element/Paint.Path.cpp +++ b/src/openrct2/paint/tile_element/Paint.Path.cpp @@ -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) diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 68f2081e05..6179a93a7e 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -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()) diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index ecde010af8..72e386ac16 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -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; diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index c5f3570067..6333de776d 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -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()) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index 25801ef9bf..c948ecce16 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -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;