diff --git a/src/openrct2/peep/Guest.cpp b/src/openrct2/peep/Guest.cpp index 47a15eed7f..e226a3b9dd 100644 --- a/src/openrct2/peep/Guest.cpp +++ b/src/openrct2/peep/Guest.cpp @@ -5482,7 +5482,7 @@ void Guest::UpdateWalking() { sprite = get_sprite(sprite_id); - if (sprite->generic.linked_list_index != SPRITE_LIST_PEEP) + if (sprite->generic.sprite_identifier != SPRITE_IDENTIFIER_PEEP) continue; if (sprite->peep.state != PEEP_STATE_WATCHING) @@ -6068,7 +6068,7 @@ bool Guest::UpdateWalkingFindBench() { sprite = get_sprite(sprite_id); - if (sprite->generic.linked_list_index != SPRITE_LIST_PEEP) + if (sprite->generic.sprite_identifier != SPRITE_IDENTIFIER_PEEP) continue; if (sprite->peep.state != PEEP_STATE_SITTING) @@ -6262,7 +6262,7 @@ static void peep_update_walking_break_scenery(Peep* peep) { sprite = get_sprite(sprite_id); - if ((sprite->generic.linked_list_index != SPRITE_LIST_PEEP) || (sprite->peep.state != PEEP_STATE_SITTING) + if ((sprite->generic.sprite_identifier != SPRITE_IDENTIFIER_PEEP) || (sprite->peep.state != PEEP_STATE_SITTING) || (peep->z != sprite->peep.z)) { continue; diff --git a/src/openrct2/peep/Peep.cpp b/src/openrct2/peep/Peep.cpp index bfad1c60ff..8f1a328963 100644 --- a/src/openrct2/peep/Peep.cpp +++ b/src/openrct2/peep/Peep.cpp @@ -434,7 +434,7 @@ void peep_update_all() else { peep_128_tick_update(peep, i); - if (peep->linked_list_index == SPRITE_LIST_PEEP) + if (peep->sprite_identifier == SPRITE_IDENTIFIER_PEEP) { peep->Update(); } diff --git a/src/openrct2/peep/Staff.cpp b/src/openrct2/peep/Staff.cpp index 41cf7e25cf..aa2cf6a6f0 100644 --- a/src/openrct2/peep/Staff.cpp +++ b/src/openrct2/peep/Staff.cpp @@ -1813,7 +1813,7 @@ static int32_t peep_update_patrolling_find_sweeping(Peep* peep) { sprite = get_sprite(sprite_id); - if (sprite->generic.linked_list_index != SPRITE_LIST_LITTER) + if (sprite->generic.sprite_identifier != SPRITE_IDENTIFIER_LITTER) continue; uint16_t z_diff = abs(peep->z - sprite->litter.z); diff --git a/src/openrct2/ride/Ride.cpp b/src/openrct2/ride/Ride.cpp index a609465a10..227f8056f2 100644 --- a/src/openrct2/ride/Ride.cpp +++ b/src/openrct2/ride/Ride.cpp @@ -324,8 +324,6 @@ void ride_update_favourited_stat() FOR_ALL_GUESTS (spriteIndex, peep) { - if (peep->linked_list_index != SPRITE_LIST_PEEP) - return; if (peep->favourite_ride != RIDE_ID_NULL) { auto ride = get_ride(peep->favourite_ride); diff --git a/src/openrct2/world/Footpath.cpp b/src/openrct2/world/Footpath.cpp index b29edbb77b..2660622aca 100644 --- a/src/openrct2/world/Footpath.cpp +++ b/src/openrct2/world/Footpath.cpp @@ -395,7 +395,7 @@ void footpath_remove_litter(const CoordsXYZ& footpathPos) { Litter* sprite = &get_sprite(spriteIndex)->litter; uint16_t nextSpriteIndex = sprite->next_in_quadrant; - if (sprite->linked_list_index == SPRITE_LIST_LITTER) + if (sprite->sprite_identifier == SPRITE_IDENTIFIER_LITTER) { int32_t distanceZ = abs(sprite->z - footpathPos.z); if (distanceZ <= 32) @@ -417,10 +417,11 @@ void footpath_interrupt_peeps(const CoordsXYZ& footpathPos) uint16_t spriteIndex = sprite_get_first_in_quadrant(footpathPos.x, footpathPos.y); while (spriteIndex != SPRITE_INDEX_NULL) { - Peep* peep = &get_sprite(spriteIndex)->peep; - uint16_t nextSpriteIndex = peep->next_in_quadrant; - if (peep->linked_list_index == SPRITE_LIST_PEEP) + auto* entity = get_sprite(spriteIndex); + uint16_t nextSpriteIndex = entity->generic.next_in_quadrant; + if (entity->generic.sprite_identifier == SPRITE_IDENTIFIER_PEEP) { + Peep* peep = &entity->peep; if (peep->state == PEEP_STATE_SITTING || peep->state == PEEP_STATE_WATCHING) { if (peep->z == footpathPos.z) diff --git a/src/openrct2/world/MapAnimation.cpp b/src/openrct2/world/MapAnimation.cpp index 85770a88a6..e5d23fa794 100644 --- a/src/openrct2/world/MapAnimation.cpp +++ b/src/openrct2/world/MapAnimation.cpp @@ -202,7 +202,7 @@ static bool map_animation_invalidate_small_scenery(const CoordsXYZ& loc) for (; spriteIdx != SPRITE_INDEX_NULL; spriteIdx = sprite->generic.next_in_quadrant) { sprite = get_sprite(spriteIdx); - if (sprite->generic.linked_list_index != SPRITE_LIST_PEEP) + if (sprite->generic.sprite_identifier != SPRITE_IDENTIFIER_PEEP) continue; peep = &sprite->peep; diff --git a/src/openrct2/world/Sprite.cpp b/src/openrct2/world/Sprite.cpp index 3b7b2ba9f0..1a09148c20 100644 --- a/src/openrct2/world/Sprite.cpp +++ b/src/openrct2/world/Sprite.cpp @@ -163,7 +163,7 @@ void reset_sprite_list() spr->generic.sprite_identifier = SPRITE_IDENTIFIER_NULL; spr->generic.sprite_index = i; spr->generic.next = SPRITE_INDEX_NULL; - spr->generic.linked_list_index = 0; + spr->generic.linked_list_index = SPRITE_LIST_FREE; if (previous_spr != nullptr) { @@ -827,7 +827,7 @@ void litter_remove_at(int32_t x, int32_t y, int32_t z) { rct_sprite* sprite = get_sprite(spriteIndex); uint16_t nextSpriteIndex = sprite->generic.next_in_quadrant; - if (sprite->generic.linked_list_index == SPRITE_LIST_LITTER) + if (sprite->generic.sprite_identifier == SPRITE_IDENTIFIER_LITTER) { Litter* litter = &sprite->litter; @@ -884,11 +884,10 @@ uint16_t remove_floating_sprites() */ static bool sprite_should_tween(rct_sprite* sprite) { - switch (sprite->generic.linked_list_index) + switch (sprite->generic.sprite_identifier) { - case SPRITE_LIST_PEEP: - case SPRITE_LIST_TRAIN_HEAD: - case SPRITE_LIST_VEHICLE: + case SPRITE_IDENTIFIER_PEEP: + case SPRITE_IDENTIFIER_VEHICLE: return true; } return false;