Use IsGhost() to access ghost state

Added set and clear ghost to further prevent direct access to flags
This commit is contained in:
duncanspumpkin 2019-02-25 15:08:49 +00:00
parent f769779f0d
commit 737c308e4e
29 changed files with 61 additions and 45 deletions

View File

@ -2185,7 +2185,7 @@ static void window_tile_inspector_scrollpaint(rct_window* w, rct_drawpixelinfo*
const int32_t baseHeight = tileElement->base_height; const int32_t baseHeight = tileElement->base_height;
const int32_t clearanceHeight = tileElement->clearance_height; const int32_t clearanceHeight = tileElement->clearance_height;
const bool ghost = (tileElement->flags & TILE_ELEMENT_FLAG_GHOST) != 0; const bool ghost = (tileElement->IsGhost()) != 0;
const bool broken = (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN) != 0; const bool broken = (tileElement->flags & TILE_ELEMENT_FLAG_BROKEN) != 0;
const bool last = (tileElement->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0; const bool last = (tileElement->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;

View File

@ -237,7 +237,7 @@ public:
if (flags & GAME_COMMAND_FLAG_GHOST) if (flags & GAME_COMMAND_FLAG_GHOST)
{ {
tileElement->flags |= TILE_ELEMENT_FLAG_GHOST; tileElement->SetGhost();
} }
map_invalidate_tile_full(flooredX, flooredY); map_invalidate_tile_full(flooredX, flooredY);

View File

@ -170,7 +170,7 @@ public:
if (flags & GAME_COMMAND_FLAG_GHOST) if (flags & GAME_COMMAND_FLAG_GHOST)
{ {
newElement->flags |= TILE_ELEMENT_FLAG_GHOST; newElement->SetGhost();
} }
entranceElement->SetDirection(_direction); entranceElement->SetDirection(_direction);

View File

@ -616,7 +616,7 @@ public:
tileElement->AsTrack()->SetTrackType(_trackType); tileElement->AsTrack()->SetTrackType(_trackType);
if (GetFlags() & GAME_COMMAND_FLAG_GHOST) if (GetFlags() & GAME_COMMAND_FLAG_GHOST)
{ {
tileElement->flags |= TILE_ELEMENT_FLAG_GHOST; tileElement->SetGhost();
} }
switch (_trackType) switch (_trackType)

View File

@ -442,7 +442,7 @@ public:
invalidate_test_results(ride); invalidate_test_results(ride);
footpath_queue_chain_reset(); footpath_queue_chain_reset();
if (!gCheatsDisableClearanceChecks || !(tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) if (!gCheatsDisableClearanceChecks || !(tileElement->IsGhost()))
{ {
footpath_remove_edges_at(mapLoc.x, mapLoc.y, tileElement); footpath_remove_edges_at(mapLoc.x, mapLoc.y, tileElement);
} }

View File

@ -277,7 +277,7 @@ static void virtual_floor_get_tile_properties(
continue; continue;
} }
if (tileElement->flags & TILE_ELEMENT_FLAG_GHOST) if (tileElement->IsGhost())
{ {
*outLit = true; *outLit = true;
continue; continue;

View File

@ -60,7 +60,7 @@ void banner_paint(paint_session* session, uint8_t direction, int32_t height, con
uint32_t base_id = (direction << 1) + banner_scenery->image; uint32_t base_id = (direction << 1) + banner_scenery->image;
uint32_t image_id = base_id; uint32_t image_id = base_id;
if (tile_element->flags & TILE_ELEMENT_FLAG_GHOST) // if being placed if (tile_element->IsGhost()) // if being placed
{ {
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
image_id |= CONSTRUCTION_MARKER; image_id |= CONSTRUCTION_MARKER;
@ -81,7 +81,7 @@ void banner_paint(paint_session* session, uint8_t direction, int32_t height, con
direction = direction_reverse(direction); direction = direction_reverse(direction);
direction--; direction--;
// If text not showing / ghost // If text not showing / ghost
if (direction >= 2 || (tile_element->flags & TILE_ELEMENT_FLAG_GHOST)) if (direction >= 2 || (tile_element->IsGhost()))
return; return;
uint16_t scrollingMode = banner_scenery->banner.scrolling_mode; uint16_t scrollingMode = banner_scenery->banner.scrolling_mode;

View File

@ -91,7 +91,7 @@ static void ride_entrance_exit_paint(paint_session* session, uint8_t direction,
session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_RIDE;
_unk9E32BC = 0; _unk9E32BC = 0;
if (tile_element->flags & TILE_ELEMENT_FLAG_GHOST) if (tile_element->IsGhost())
{ {
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
image_id = CONSTRUCTION_MARKER; image_id = CONSTRUCTION_MARKER;
@ -157,7 +157,7 @@ static void ride_entrance_exit_paint(paint_session* session, uint8_t direction,
paint_util_push_tunnel_left(session, height, TUNNEL_6); paint_util_push_tunnel_left(session, height, TUNNEL_6);
} }
if (!is_exit && !(tile_element->flags & TILE_ELEMENT_FLAG_GHOST) && tile_element->AsEntrance()->GetRideIndex() != 0xFF if (!is_exit && !(tile_element->IsGhost()) && tile_element->AsEntrance()->GetRideIndex() != 0xFF
&& stationObj->ScrollingMode != 0xFF) && stationObj->ScrollingMode != 0xFF)
{ {
set_format_arg(0, uint32_t, 0); set_format_arg(0, uint32_t, 0);
@ -225,7 +225,7 @@ static void park_entrance_paint(paint_session* session, uint8_t direction, int32
session->InteractionType = VIEWPORT_INTERACTION_ITEM_PARK; session->InteractionType = VIEWPORT_INTERACTION_ITEM_PARK;
_unk9E32BC = 0; _unk9E32BC = 0;
uint32_t image_id, ghost_id = 0; uint32_t image_id, ghost_id = 0;
if (tile_element->flags & TILE_ELEMENT_FLAG_GHOST) if (tile_element->IsGhost())
{ {
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
ghost_id = CONSTRUCTION_MARKER; ghost_id = CONSTRUCTION_MARKER;

View File

@ -248,7 +248,7 @@ void large_scenery_paint(paint_session* session, uint8_t direction, uint16_t hei
image_id |= dword_F4387C; image_id |= dword_F4387C;
} }
} }
if (tileElement->flags & TILE_ELEMENT_FLAG_GHOST) if (tileElement->IsGhost())
{ {
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
sequenceNum = CONSTRUCTION_MARKER; sequenceNum = CONSTRUCTION_MARKER;

View File

@ -829,7 +829,7 @@ void path_paint(paint_session* session, uint16_t height, const TileElement* tile
sceneryImageFlags = CONSTRUCTION_MARKER; sceneryImageFlags = CONSTRUCTION_MARKER;
} }
if (tile_element->flags & TILE_ELEMENT_FLAG_GHOST) if (tile_element->IsGhost())
{ {
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
imageFlags = CONSTRUCTION_MARKER; imageFlags = CONSTRUCTION_MARKER;

View File

@ -53,7 +53,7 @@ void scenery_paint(paint_session* session, uint8_t direction, int32_t height, co
baseImageid = SPRITE_ID_PALETTE_COLOUR_1(PALETTE_46); baseImageid = SPRITE_ID_PALETTE_COLOUR_1(PALETTE_46);
} }
} }
if (tileElement->flags & TILE_ELEMENT_FLAG_GHOST) if (tileElement->IsGhost())
{ {
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
baseImageid = CONSTRUCTION_MARKER; baseImageid = CONSTRUCTION_MARKER;

View File

@ -198,7 +198,7 @@ void fence_paint(paint_session* session, uint8_t direction, int32_t height, cons
} }
} }
if (tile_element->flags & TILE_ELEMENT_FLAG_GHOST) if (tile_element->IsGhost())
{ {
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;
dword_141F710 = CONSTRUCTION_MARKER; dword_141F710 = CONSTRUCTION_MARKER;

View File

@ -238,7 +238,7 @@ static uint8_t footpath_element_next_in_direction(TileCoordsXYZ loc, TileElement
nextTileElement = map_get_first_element_at(loc.x, loc.y); nextTileElement = map_get_first_element_at(loc.x, loc.y);
do do
{ {
if (nextTileElement->flags & TILE_ELEMENT_FLAG_GHOST) if (nextTileElement->IsGhost())
continue; continue;
if (nextTileElement->GetType() != TILE_ELEMENT_TYPE_PATH) if (nextTileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
continue; continue;
@ -292,7 +292,7 @@ static uint8_t footpath_element_dest_in_dir(
} }
do do
{ {
if (tileElement->flags & TILE_ELEMENT_FLAG_GHOST) if (tileElement->IsGhost())
continue; continue;
switch (tileElement->GetType()) switch (tileElement->GetType())
@ -643,7 +643,7 @@ static void peep_pathfind_heuristic_search(
/* Look for all map elements that the peep could walk onto while /* Look for all map elements that the peep could walk onto while
* navigating to the goal, including the goal tile. */ * navigating to the goal, including the goal tile. */
if (tileElement->flags & TILE_ELEMENT_FLAG_GHOST) if (tileElement->IsGhost())
continue; continue;
ride_id_t rideIndex = RIDE_ID_NULL; ride_id_t rideIndex = RIDE_ID_NULL;

View File

@ -3191,7 +3191,7 @@ void rct_peep::PerformNextAction(uint8_t& pathing_result, TileElement*& tile_res
continue; continue;
if (top_z < tileElement->base_height) if (top_z < tileElement->base_height)
continue; continue;
if (tileElement->flags & TILE_ELEMENT_FLAG_GHOST) if (tileElement->IsGhost())
continue; continue;
if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH) if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)

View File

@ -31,6 +31,11 @@ bool RCT12TileElementBase::IsLastForTile() const
return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0; return (this->flags & TILE_ELEMENT_FLAG_LAST_TILE) != 0;
} }
bool RCT12TileElementBase::IsGhost() const
{
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0;
}
uint8_t RCT12SurfaceElement::GetSlope() const uint8_t RCT12SurfaceElement::GetSlope() const
{ {
return (slope & TILE_ELEMENT_SURFACE_SLOPE_MASK); return (slope & TILE_ELEMENT_SURFACE_SLOPE_MASK);

View File

@ -6512,7 +6512,7 @@ bool ride_has_any_track_elements(const Ride* ride)
continue; continue;
if (it.element->AsTrack()->GetRideIndex() != ride->id) if (it.element->AsTrack()->GetRideIndex() != ride->id)
continue; continue;
if (it.element->flags & TILE_ELEMENT_FLAG_GHOST) if (it.element->IsGhost())
continue; continue;
return true; return true;
@ -6532,7 +6532,7 @@ void ride_all_has_any_track_elements(bool* rideIndexArray)
{ {
if (it.element->GetType() != TILE_ELEMENT_TYPE_TRACK) if (it.element->GetType() != TILE_ELEMENT_TYPE_TRACK)
continue; continue;
if (it.element->flags & TILE_ELEMENT_FLAG_GHOST) if (it.element->IsGhost())
continue; continue;
rideIndexArray[it.element->AsTrack()->GetRideIndex()] = true; rideIndexArray[it.element->AsTrack()->GetRideIndex()] = true;

View File

@ -1170,7 +1170,7 @@ static money32 track_remove(
invalidate_test_results(ride); invalidate_test_results(ride);
footpath_queue_chain_reset(); footpath_queue_chain_reset();
if (!gCheatsDisableClearanceChecks || !(tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) if (!gCheatsDisableClearanceChecks || !(tileElement->IsGhost()))
{ {
footpath_remove_edges_at(x, y, tileElement); footpath_remove_edges_at(x, y, tileElement);
} }

View File

@ -2129,7 +2129,7 @@ static money32 place_maze_design(uint8_t flags, Ride* ride, uint16_t mazeEntry,
tileElement->AsTrack()->SetMazeEntry(mazeEntry); tileElement->AsTrack()->SetMazeEntry(mazeEntry);
if (flags & GAME_COMMAND_FLAG_GHOST) if (flags & GAME_COMMAND_FLAG_GHOST)
{ {
tileElement->flags |= TILE_ELEMENT_FLAG_GHOST; tileElement->SetGhost();
} }
map_invalidate_element(fx, fy, tileElement); map_invalidate_element(fx, fy, tileElement);

View File

@ -2199,7 +2199,7 @@ void track_paint(paint_session* session, uint8_t direction, int32_t height, cons
session->TrackColours[SCHEME_MISC] = 0x21600000; session->TrackColours[SCHEME_MISC] = 0x21600000;
session->TrackColours[SCHEME_3] = 0x21600000; session->TrackColours[SCHEME_3] = 0x21600000;
} }
if (tileElement->flags & TILE_ELEMENT_FLAG_GHOST) if (tileElement->IsGhost())
{ {
uint32_t ghost_id = CONSTRUCTION_MARKER; uint32_t ghost_id = CONSTRUCTION_MARKER;
session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE; session->InteractionType = VIEWPORT_INTERACTION_ITEM_NONE;

View File

@ -695,7 +695,7 @@ void scenario_fix_ghosts(rct_s6_data* s6)
RCT12TileElement* originalElement = reinterpret_cast<RCT12TileElement*>(map_get_first_element_at(x, y)); RCT12TileElement* originalElement = reinterpret_cast<RCT12TileElement*>(map_get_first_element_at(x, y));
do do
{ {
if (originalElement->flags & TILE_ELEMENT_FLAG_GHOST) if (originalElement->IsGhost())
{ {
BannerIndex bannerIndex = tile_element_get_banner_index(reinterpret_cast<TileElement*>(originalElement)); BannerIndex bannerIndex = tile_element_get_banner_index(reinterpret_cast<TileElement*>(originalElement));
if (bannerIndex != BANNER_INDEX_NULL) if (bannerIndex != BANNER_INDEX_NULL)

View File

@ -254,7 +254,7 @@ static money32 BannerPlace(
newTileElement->AsBanner()->SetIndex(*bannerIndex); newTileElement->AsBanner()->SetIndex(*bannerIndex);
if (flags & GAME_COMMAND_FLAG_GHOST) if (flags & GAME_COMMAND_FLAG_GHOST)
{ {
newTileElement->flags |= TILE_ELEMENT_FLAG_GHOST; newTileElement->SetGhost();
} }
map_invalidate_tile_full(x, y); map_invalidate_tile_full(x, y);
map_animation_create(MAP_ANIMATION_TYPE_BANNER, x, y, newTileElement->base_height); map_animation_create(MAP_ANIMATION_TYPE_BANNER, x, y, newTileElement->base_height);

View File

@ -275,7 +275,7 @@ static money32 RideEntranceExitPlace(
if (flags & GAME_COMMAND_FLAG_GHOST) if (flags & GAME_COMMAND_FLAG_GHOST)
{ {
tileElement->flags |= TILE_ELEMENT_FLAG_GHOST; tileElement->SetGhost();
} }
if (isExit) if (isExit)
@ -370,7 +370,7 @@ static money32 RideEntranceExitRemove(int16_t x, int16_t y, ride_id_t rideIndex,
if (tileElement->AsEntrance()->GetStationIndex() != stationNum) if (tileElement->AsEntrance()->GetStationIndex() != stationNum)
continue; continue;
if (flags & GAME_COMMAND_FLAG_5 && !(tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) if (flags & GAME_COMMAND_FLAG_5 && !(tileElement->IsGhost()))
continue; continue;
if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE) if (tileElement->AsEntrance()->GetEntranceType() == ENTRANCE_TYPE_PARK_ENTRANCE)

View File

@ -291,7 +291,7 @@ static money32 footpath_element_insert(
tileElement->AsPath()->SetAdditionStatus(255); tileElement->AsPath()->SetAdditionStatus(255);
pathElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN; pathElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN;
if (flags & GAME_COMMAND_FLAG_GHOST) if (flags & GAME_COMMAND_FLAG_GHOST)
pathElement->flags |= TILE_ELEMENT_FLAG_GHOST; pathElement->SetGhost();
footpath_queue_chain_reset(); footpath_queue_chain_reset();
@ -686,7 +686,7 @@ static money32 footpath_place_from_track(
tileElement->AsPath()->SetCorners(0); tileElement->AsPath()->SetCorners(0);
pathElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN; pathElement->flags &= ~TILE_ELEMENT_FLAG_BROKEN;
if (flags & (1 << 6)) if (flags & (1 << 6))
pathElement->flags |= TILE_ELEMENT_FLAG_GHOST; pathElement->SetGhost();
map_invalidate_tile_full(x, y); map_invalidate_tile_full(x, y);
} }
@ -1061,7 +1061,7 @@ bool fence_in_the_way(int32_t x, int32_t y, int32_t z0, int32_t z1, int32_t dire
{ {
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL) if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
continue; continue;
if (tileElement->flags & TILE_ELEMENT_FLAG_GHOST) if (tileElement->IsGhost())
continue; continue;
if (z0 >= tileElement->clearance_height) if (z0 >= tileElement->clearance_height)
continue; continue;

View File

@ -283,7 +283,7 @@ TileElement* map_get_path_element_at(int32_t x, int32_t y, int32_t z)
// Find the path element at known z // Find the path element at known z
do do
{ {
if (tileElement->flags & TILE_ELEMENT_FLAG_GHOST) if (tileElement->IsGhost())
continue; continue;
if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH) if (tileElement->GetType() != TILE_ELEMENT_TYPE_PATH)
continue; continue;
@ -413,7 +413,7 @@ void map_strip_ghost_flag_from_elements()
{ {
for (auto& element : gTileElements) for (auto& element : gTileElements)
{ {
element.flags &= ~TILE_ELEMENT_FLAG_GHOST; element.ClearGhost();
} }
} }
@ -821,7 +821,7 @@ void game_command_set_large_scenery_colour(
return; return;
} }
if ((flags & GAME_COMMAND_FLAG_GHOST) && !(tile_element->flags & TILE_ELEMENT_FLAG_GHOST)) if ((flags & GAME_COMMAND_FLAG_GHOST) && !(tile_element->IsGhost()))
{ {
*ebx = 0; *ebx = 0;
return; return;
@ -2472,7 +2472,7 @@ void game_command_place_large_scenery(
if (flags & GAME_COMMAND_FLAG_GHOST) if (flags & GAME_COMMAND_FLAG_GHOST)
{ {
new_tile_element->flags |= TILE_ELEMENT_FLAG_GHOST; new_tile_element->SetGhost();
} }
if (tile_num == 0) if (tile_num == 0)
@ -2884,8 +2884,7 @@ bool map_can_construct_with_clear_at(
{ {
if (tileElement->GetType() != TILE_ELEMENT_TYPE_SURFACE) if (tileElement->GetType() != TILE_ELEMENT_TYPE_SURFACE)
{ {
if (zLow < tileElement->clearance_height && zHigh > tileElement->base_height if (zLow < tileElement->clearance_height && zHigh > tileElement->base_height && !(tileElement->IsGhost()))
&& !(tileElement->flags & TILE_ELEMENT_FLAG_GHOST))
{ {
if (tileElement->flags & (bl.GetBaseQuarterOccupied())) if (tileElement->flags & (bl.GetBaseQuarterOccupied()))
{ {
@ -3372,7 +3371,7 @@ EntranceElement* map_get_park_entrance_element_at(int32_t x, int32_t y, int32_t
if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE) if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)
continue; continue;
if ((ghost == false) && (tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) if ((ghost == false) && (tileElement->IsGhost()))
continue; continue;
return tileElement->AsEntrance(); return tileElement->AsEntrance();
@ -3397,7 +3396,7 @@ EntranceElement* map_get_ride_entrance_element_at(int32_t x, int32_t y, int32_t
if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE) if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_ENTRANCE)
continue; continue;
if ((ghost == false) && (tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) if ((ghost == false) && (tileElement->IsGhost()))
continue; continue;
return tileElement->AsEntrance(); return tileElement->AsEntrance();
@ -3422,7 +3421,7 @@ EntranceElement* map_get_ride_exit_element_at(int32_t x, int32_t y, int32_t z, b
if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_EXIT) if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_RIDE_EXIT)
continue; continue;
if ((ghost == false) && (tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) if ((ghost == false) && (tileElement->IsGhost()))
continue; continue;
return tileElement->AsEntrance(); return tileElement->AsEntrance();

View File

@ -183,7 +183,7 @@ void update_park_fences(const CoordsXY coords)
if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE) if (tileElement->AsEntrance()->GetEntranceType() != ENTRANCE_TYPE_PARK_ENTRANCE)
continue; continue;
if (!(tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) if (!(tileElement->IsGhost()))
{ {
fenceRequired = false; fenceRequired = false;
break; break;

View File

@ -49,7 +49,7 @@ static money32 SmallScenerySetColour(
return 0; return 0;
} }
if ((flags & GAME_COMMAND_FLAG_GHOST) && !(tileElement->flags & TILE_ELEMENT_FLAG_GHOST)) if ((flags & GAME_COMMAND_FLAG_GHOST) && !(tileElement->IsGhost()))
{ {
return 0; return 0;
} }
@ -317,7 +317,7 @@ static money32 SmallSceneryPlace(
if (flags & GAME_COMMAND_FLAG_GHOST) if (flags & GAME_COMMAND_FLAG_GHOST)
{ {
newElement->flags |= TILE_ELEMENT_FLAG_GHOST; newElement->SetGhost();
} }
map_invalidate_tile_full(x, y); map_invalidate_tile_full(x, y);

View File

@ -54,6 +54,16 @@ bool TileElementBase::IsGhost() const
return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0; return (this->flags & TILE_ELEMENT_FLAG_GHOST) != 0;
} }
void TileElementBase::SetGhost()
{
this->flags |= TILE_ELEMENT_FLAG_GHOST;
}
void TileElementBase::ClearGhost()
{
this->flags &= ~TILE_ELEMENT_FLAG_GHOST;
}
bool tile_element_is_underground(TileElement* tileElement) bool tile_element_is_underground(TileElement* tileElement)
{ {
do do

View File

@ -71,6 +71,8 @@ struct TileElementBase
uint8_t GetDirectionWithOffset(uint8_t offset) const; uint8_t GetDirectionWithOffset(uint8_t offset) const;
bool IsLastForTile() const; bool IsLastForTile() const;
bool IsGhost() const; bool IsGhost() const;
void SetGhost();
void ClearGhost();
void Remove(); void Remove();
}; };

View File

@ -538,7 +538,7 @@ static money32 WallPlace(
if (flags & GAME_COMMAND_FLAG_GHOST) if (flags & GAME_COMMAND_FLAG_GHOST)
{ {
tileElement->flags |= TILE_ELEMENT_FLAG_GHOST; tileElement->SetGhost();
} }
gSceneryTileElement = tileElement; gSceneryTileElement = tileElement;
@ -577,7 +577,7 @@ static money32 WallSetColour(
return 0; return 0;
} }
if ((flags & GAME_COMMAND_FLAG_GHOST) && !(wallElement->flags & TILE_ELEMENT_FLAG_GHOST)) if ((flags & GAME_COMMAND_FLAG_GHOST) && !(wallElement->IsGhost()))
{ {
return 0; return 0;
} }