From 112b40910ba91d0707200a58fbb82bb231197f3e Mon Sep 17 00:00:00 2001 From: duncanspumpkin Date: Mon, 25 Feb 2019 20:44:12 +0000 Subject: [PATCH] Pass a bool to the set function. Make review changes --- src/openrct2/actions/MazeSetTrackAction.hpp | 2 +- .../actions/PlaceParkEntranceAction.hpp | 2 +- src/openrct2/actions/TrackPlaceAction.hpp | 2 +- .../paint/tile_element/Paint.Entrance.cpp | 4 ++-- src/openrct2/ride/TrackDesign.cpp | 2 +- src/openrct2/world/Banner.cpp | 2 +- src/openrct2/world/Entrance.cpp | 2 +- src/openrct2/world/Footpath.cpp | 4 ++-- src/openrct2/world/Map.cpp | 4 ++-- src/openrct2/world/SmallScenery.cpp | 2 +- src/openrct2/world/TileElement.cpp | 17 +++++++++-------- src/openrct2/world/TileElement.h | 3 +-- src/openrct2/world/Wall.cpp | 2 +- 13 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/openrct2/actions/MazeSetTrackAction.hpp b/src/openrct2/actions/MazeSetTrackAction.hpp index dce4ea755a..dbe205bd40 100644 --- a/src/openrct2/actions/MazeSetTrackAction.hpp +++ b/src/openrct2/actions/MazeSetTrackAction.hpp @@ -237,7 +237,7 @@ public: if (flags & GAME_COMMAND_FLAG_GHOST) { - tileElement->SetGhost(); + tileElement->SetGhost(true); } map_invalidate_tile_full(flooredX, flooredY); diff --git a/src/openrct2/actions/PlaceParkEntranceAction.hpp b/src/openrct2/actions/PlaceParkEntranceAction.hpp index d55e7f6317..c13df04efd 100644 --- a/src/openrct2/actions/PlaceParkEntranceAction.hpp +++ b/src/openrct2/actions/PlaceParkEntranceAction.hpp @@ -170,7 +170,7 @@ public: if (flags & GAME_COMMAND_FLAG_GHOST) { - newElement->SetGhost(); + newElement->SetGhost(true); } entranceElement->SetDirection(_direction); diff --git a/src/openrct2/actions/TrackPlaceAction.hpp b/src/openrct2/actions/TrackPlaceAction.hpp index bde1f13300..288744849f 100644 --- a/src/openrct2/actions/TrackPlaceAction.hpp +++ b/src/openrct2/actions/TrackPlaceAction.hpp @@ -616,7 +616,7 @@ public: tileElement->AsTrack()->SetTrackType(_trackType); if (GetFlags() & GAME_COMMAND_FLAG_GHOST) { - tileElement->SetGhost(); + tileElement->SetGhost(true); } switch (_trackType) diff --git a/src/openrct2/paint/tile_element/Paint.Entrance.cpp b/src/openrct2/paint/tile_element/Paint.Entrance.cpp index bad22f9525..4abac2a560 100644 --- a/src/openrct2/paint/tile_element/Paint.Entrance.cpp +++ b/src/openrct2/paint/tile_element/Paint.Entrance.cpp @@ -157,8 +157,8 @@ static void ride_entrance_exit_paint(paint_session* session, uint8_t direction, paint_util_push_tunnel_left(session, height, TUNNEL_6); } - if (!is_exit && !(tile_element->IsGhost()) && tile_element->AsEntrance()->GetRideIndex() != 0xFF - && stationObj->ScrollingMode != 0xFF) + if (!is_exit && !(tile_element->IsGhost()) && tile_element->AsEntrance()->GetRideIndex() != RIDE_ID_NULL + && stationObj->ScrollingMode != SCROLLING_MODE_NONE) { set_format_arg(0, uint32_t, 0); set_format_arg(4, uint32_t, 0); diff --git a/src/openrct2/ride/TrackDesign.cpp b/src/openrct2/ride/TrackDesign.cpp index f6b93419fd..b74b3459a3 100644 --- a/src/openrct2/ride/TrackDesign.cpp +++ b/src/openrct2/ride/TrackDesign.cpp @@ -2129,7 +2129,7 @@ static money32 place_maze_design(uint8_t flags, Ride* ride, uint16_t mazeEntry, tileElement->AsTrack()->SetMazeEntry(mazeEntry); if (flags & GAME_COMMAND_FLAG_GHOST) { - tileElement->SetGhost(); + tileElement->SetGhost(true); } map_invalidate_element(fx, fy, tileElement); diff --git a/src/openrct2/world/Banner.cpp b/src/openrct2/world/Banner.cpp index 501d28ee1b..e97d51b537 100644 --- a/src/openrct2/world/Banner.cpp +++ b/src/openrct2/world/Banner.cpp @@ -254,7 +254,7 @@ static money32 BannerPlace( newTileElement->AsBanner()->SetIndex(*bannerIndex); if (flags & GAME_COMMAND_FLAG_GHOST) { - newTileElement->SetGhost(); + newTileElement->SetGhost(true); } map_invalidate_tile_full(x, y); map_animation_create(MAP_ANIMATION_TYPE_BANNER, x, y, newTileElement->base_height); diff --git a/src/openrct2/world/Entrance.cpp b/src/openrct2/world/Entrance.cpp index bbee52f765..2f4beb23ce 100644 --- a/src/openrct2/world/Entrance.cpp +++ b/src/openrct2/world/Entrance.cpp @@ -275,7 +275,7 @@ static money32 RideEntranceExitPlace( if (flags & GAME_COMMAND_FLAG_GHOST) { - tileElement->SetGhost(); + tileElement->SetGhost(true); } if (isExit) diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index f35e0dfe0c..08ec1123e0 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -291,7 +291,7 @@ static money32 footpath_element_insert( tileElement->AsPath()->SetAdditionStatus(255); pathElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN; if (flags & GAME_COMMAND_FLAG_GHOST) - pathElement->SetGhost(); + pathElement->SetGhost(true); footpath_queue_chain_reset(); @@ -686,7 +686,7 @@ static money32 footpath_place_from_track( tileElement->AsPath()->SetCorners(0); pathElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN; if (flags & (1 << 6)) - pathElement->SetGhost(); + pathElement->SetGhost(true); map_invalidate_tile_full(x, y); } diff --git a/src/openrct2/world/Map.cpp b/src/openrct2/world/Map.cpp index f4945644fb..3f25d7bc4b 100644 --- a/src/openrct2/world/Map.cpp +++ b/src/openrct2/world/Map.cpp @@ -413,7 +413,7 @@ void map_strip_ghost_flag_from_elements() { for (auto& element : gTileElements) { - element.ClearGhost(); + element.SetGhost(false); } } @@ -2472,7 +2472,7 @@ void game_command_place_large_scenery( if (flags & GAME_COMMAND_FLAG_GHOST) { - new_tile_element->SetGhost(); + new_tile_element->SetGhost(true); } if (tile_num == 0) diff --git a/src/openrct2/world/SmallScenery.cpp b/src/openrct2/world/SmallScenery.cpp index e4dce67279..e8ecd11033 100644 --- a/src/openrct2/world/SmallScenery.cpp +++ b/src/openrct2/world/SmallScenery.cpp @@ -317,7 +317,7 @@ static money32 SmallSceneryPlace( if (flags & GAME_COMMAND_FLAG_GHOST) { - newElement->SetGhost(); + newElement->SetGhost(true); } map_invalidate_tile_full(x, y); diff --git a/src/openrct2/world/TileElement.cpp b/src/openrct2/world/TileElement.cpp index 51d724486c..c86a32c080 100644 --- a/src/openrct2/world/TileElement.cpp +++ b/src/openrct2/world/TileElement.cpp @@ -53,15 +53,16 @@ bool TileElementBase::IsGhost() const { return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0; } - -void TileElementBase::SetGhost() +void TileElementBase::SetGhost(bool isGhost) { - this->flags |= TILE_ELEMENT_FLAG_GHOST; -} - -void TileElementBase::ClearGhost() -{ - this->flags &= ~TILE_ELEMENT_FLAG_GHOST; + if (isGhost == true) + { + this->flags |= TILE_ELEMENT_FLAG_GHOST; + } + else + { + this->flags &= ~TILE_ELEMENT_FLAG_GHOST; + } } bool tile_element_is_underground(TileElement* tileElement) diff --git a/src/openrct2/world/TileElement.h b/src/openrct2/world/TileElement.h index 7fb8ff2081..a6758c9add 100644 --- a/src/openrct2/world/TileElement.h +++ b/src/openrct2/world/TileElement.h @@ -71,8 +71,7 @@ struct TileElementBase uint8_t GetDirectionWithOffset(uint8_t offset) const; bool IsLastForTile() const; bool IsGhost() const; - void SetGhost(); - void ClearGhost(); + void SetGhost(bool isGhost); void Remove(); }; diff --git a/src/openrct2/world/Wall.cpp b/src/openrct2/world/Wall.cpp index 4c0ac5b8d2..44606ae9ea 100644 --- a/src/openrct2/world/Wall.cpp +++ b/src/openrct2/world/Wall.cpp @@ -538,7 +538,7 @@ static money32 WallPlace( if (flags & GAME_COMMAND_FLAG_GHOST) { - tileElement->SetGhost(); + tileElement->SetGhost(true); } gSceneryTileElement = tileElement;