mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-21 14:02:59 +01:00
Rearrange WallSceneryEntry to enforce types (#14808)
* Rearrange WallSceneryEntry to enforce types * Clang format Correct inverted nullptr check
This commit is contained in:
@@ -479,7 +479,6 @@ static bool map_animation_invalidate_wall_door(const CoordsXYZ& loc)
|
||||
{
|
||||
TileCoordsXYZ tileLoc{ loc };
|
||||
TileElement* tileElement;
|
||||
rct_scenery_entry* sceneryEntry;
|
||||
|
||||
if (gCurrentTicks & 1)
|
||||
return false;
|
||||
@@ -495,8 +494,8 @@ static bool map_animation_invalidate_wall_door(const CoordsXYZ& loc)
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
|
||||
sceneryEntry = tileElement->AsWall()->GetEntry();
|
||||
if (sceneryEntry == nullptr || !(sceneryEntry->wall.flags & WALL_SCENERY_IS_DOOR))
|
||||
auto* wallEntry = tileElement->AsWall()->GetEntry();
|
||||
if (wallEntry == nullptr || !(wallEntry->flags & WALL_SCENERY_IS_DOOR))
|
||||
continue;
|
||||
|
||||
if (game_is_paused())
|
||||
@@ -519,7 +518,7 @@ static bool map_animation_invalidate_wall_door(const CoordsXYZ& loc)
|
||||
if (currentFrame != 5)
|
||||
{
|
||||
currentFrame++;
|
||||
if (currentFrame == 13 && !(sceneryEntry->wall.flags & WALL_SCENERY_LONG_DOOR_ANIMATION))
|
||||
if (currentFrame == 13 && !(wallEntry->flags & WALL_SCENERY_LONG_DOOR_ANIMATION))
|
||||
currentFrame = 15;
|
||||
|
||||
invalidate = true;
|
||||
@@ -544,7 +543,6 @@ static bool map_animation_invalidate_wall(const CoordsXYZ& loc)
|
||||
{
|
||||
TileCoordsXYZ tileLoc{ loc };
|
||||
TileElement* tileElement;
|
||||
rct_scenery_entry* sceneryEntry;
|
||||
|
||||
bool wasInvalidated = false;
|
||||
tileElement = map_get_first_element_at(loc);
|
||||
@@ -557,11 +555,10 @@ static bool map_animation_invalidate_wall(const CoordsXYZ& loc)
|
||||
if (tileElement->GetType() != TILE_ELEMENT_TYPE_WALL)
|
||||
continue;
|
||||
|
||||
sceneryEntry = tileElement->AsWall()->GetEntry();
|
||||
auto* wallEntry = tileElement->AsWall()->GetEntry();
|
||||
|
||||
if (!sceneryEntry
|
||||
|| (!(sceneryEntry->wall.flags2 & WALL_SCENERY_2_ANIMATED)
|
||||
&& sceneryEntry->wall.scrolling_mode == SCROLLING_MODE_NONE))
|
||||
if (wallEntry == nullptr
|
||||
|| (!(wallEntry->flags2 & WALL_SCENERY_2_ANIMATED) && wallEntry->scrolling_mode == SCROLLING_MODE_NONE))
|
||||
continue;
|
||||
|
||||
map_invalidate_tile_zoom1({ loc, loc.z, loc.z + 16 });
|
||||
@@ -632,9 +629,9 @@ void AutoCreateMapAnimations()
|
||||
case TILE_ELEMENT_TYPE_WALL:
|
||||
{
|
||||
auto wallEl = el->AsWall();
|
||||
auto entry = wallEl->GetEntry();
|
||||
auto* entry = wallEl->GetEntry();
|
||||
if (entry != nullptr
|
||||
&& ((entry->wall.flags2 & WALL_SCENERY_2_ANIMATED) || entry->wall.scrolling_mode != SCROLLING_MODE_NONE))
|
||||
&& ((entry->flags2 & WALL_SCENERY_2_ANIMATED) || entry->scrolling_mode != SCROLLING_MODE_NONE))
|
||||
{
|
||||
map_animation_create(MAP_ANIMATION_TYPE_WALL, loc);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user