Add temporary variable to clear up shifting.

Fix clang format.
Simplify compare
This commit is contained in:
duncanspumpkin 2019-12-19 18:58:33 +00:00
parent ee206546bf
commit 86cc7e9734
1 changed files with 28 additions and 15 deletions

View File

@ -37,7 +37,7 @@ static bool DoesAnimationExist(int32_t type, const CoordsXYZ& location)
{
for (const auto& a : _mapAnimations)
{
if (a.type == type && a.location.x == location.x && a.location.y == location.y && a.location.z == location.z)
if (a.type == type && a.location == location)
{
// Animation already exists
return true;
@ -89,7 +89,8 @@ void map_animation_invalidate_all()
*/
static bool map_animation_invalidate_ride_entrance(CoordsXYZ loc)
{
auto tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
TileCoordsXY tileLoc{ loc };
auto tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -123,9 +124,10 @@ static bool map_animation_invalidate_ride_entrance(CoordsXYZ loc)
*/
static bool map_animation_invalidate_queue_banner(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -156,12 +158,13 @@ static bool map_animation_invalidate_queue_banner(CoordsXYZ loc)
*/
static bool map_animation_invalidate_small_scenery(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
rct_scenery_entry* sceneryEntry;
rct_sprite* sprite;
Peep* peep;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -232,9 +235,10 @@ static bool map_animation_invalidate_small_scenery(CoordsXYZ loc)
*/
static bool map_animation_invalidate_park_entrance(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -261,9 +265,10 @@ static bool map_animation_invalidate_park_entrance(CoordsXYZ loc)
*/
static bool map_animation_invalidate_track_waterfall(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -289,9 +294,10 @@ static bool map_animation_invalidate_track_waterfall(CoordsXYZ loc)
*/
static bool map_animation_invalidate_track_rapids(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -317,9 +323,10 @@ static bool map_animation_invalidate_track_rapids(CoordsXYZ loc)
*/
static bool map_animation_invalidate_track_onridephoto(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -357,9 +364,10 @@ static bool map_animation_invalidate_track_onridephoto(CoordsXYZ loc)
*/
static bool map_animation_invalidate_track_whirlpool(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -385,9 +393,10 @@ static bool map_animation_invalidate_track_whirlpool(CoordsXYZ loc)
*/
static bool map_animation_invalidate_track_spinningtunnel(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -422,9 +431,10 @@ static bool map_animation_invalidate_remove([[maybe_unused]] CoordsXYZ loc)
*/
static bool map_animation_invalidate_banner(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -446,11 +456,12 @@ static bool map_animation_invalidate_banner(CoordsXYZ loc)
*/
static bool map_animation_invalidate_large_scenery(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
rct_scenery_entry* sceneryEntry;
bool wasInvalidated = false;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -477,6 +488,7 @@ static bool map_animation_invalidate_large_scenery(CoordsXYZ loc)
*/
static bool map_animation_invalidate_wall_door(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
rct_scenery_entry* sceneryEntry;
@ -484,7 +496,7 @@ static bool map_animation_invalidate_wall_door(CoordsXYZ loc)
return false;
bool removeAnimation = true;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return removeAnimation;
do
@ -541,11 +553,12 @@ static bool map_animation_invalidate_wall_door(CoordsXYZ loc)
*/
static bool map_animation_invalidate_wall(CoordsXYZ loc)
{
TileCoordsXY tileLoc{ loc };
TileElement* tileElement;
rct_scenery_entry* sceneryEntry;
bool wasInvalidated = false;
tileElement = map_get_first_element_at(loc.x >> 5, loc.y >> 5);
tileElement = map_get_first_element_at(tileLoc.x, tileLoc.y);
if (tileElement == nullptr)
return true;
do
@ -621,7 +634,7 @@ void AutoCreateMapAnimations()
while (tile_element_iterator_next(&it))
{
auto el = it.element;
auto loc = CoordsXYZ{ it.x * 32, it.y * 32, el->base_height * 8};
auto loc = CoordsXYZ{ it.x * 32, it.y * 32, el->base_height * 8 };
switch (el->GetType())
{
case TILE_ELEMENT_TYPE_BANNER: