diff --git a/src/openrct2/rct2/S6Exporter.cpp b/src/openrct2/rct2/S6Exporter.cpp index 9574f1c64e..7f842cbc12 100644 --- a/src/openrct2/rct2/S6Exporter.cpp +++ b/src/openrct2/rct2/S6Exporter.cpp @@ -151,10 +151,8 @@ void S6Exporter::Save(IStream* stream, bool isScenario) void S6Exporter::Export() { - int32_t spatial_cycle = check_for_spatial_index_cycles(false); int32_t regular_cycle = check_for_sprite_list_cycles(false); int32_t disjoint_sprites_count = fix_disjoint_sprites(); - openrct2_assert(spatial_cycle == -1, "Sprite cycle exists in spatial list %d", spatial_cycle); openrct2_assert(regular_cycle == -1, "Sprite cycle exists in regular list %d", regular_cycle); // This one is less harmful, no need to assert for it ~janisozaur if (disjoint_sprites_count > 0) diff --git a/src/openrct2/rct2/S6Importer.cpp b/src/openrct2/rct2/S6Importer.cpp index 633c6e6faf..603d6d9689 100644 --- a/src/openrct2/rct2/S6Importer.cpp +++ b/src/openrct2/rct2/S6Importer.cpp @@ -465,7 +465,6 @@ public: // We try to fix the cycles on import, hence the 'true' parameter check_for_sprite_list_cycles(true); - check_for_spatial_index_cycles(true); int32_t disjoint_sprites_count = fix_disjoint_sprites(); // This one is less harmful, no need to assert for it ~janisozaur if (disjoint_sprites_count > 0) diff --git a/src/openrct2/world/Sprite.cpp b/src/openrct2/world/Sprite.cpp index b6a8735a2a..f68a747de4 100644 --- a/src/openrct2/world/Sprite.cpp +++ b/src/openrct2/world/Sprite.cpp @@ -1153,36 +1153,3 @@ int32_t fix_disjoint_sprites() } return count; } - -int32_t check_for_spatial_index_cycles(bool fix) -{ - for (uint32_t i = 0; i < SPATIAL_INDEX_LOCATION_NULL; i++) - { - auto* cycle_start = find_sprite_quadrant_cycle(gSpriteSpatialIndex[i]); - if (cycle_start != nullptr) - { - if (fix) - { - // Store the leftover part of cycle to be fixed - uint16_t cycle_next = cycle_start->next_in_quadrant; - - // Break the cycle - cycle_start->next_in_quadrant = SPRITE_INDEX_NULL; - - // Now re-add remainder of the cycle back to list, safely. - // Add each sprite to the list until we encounter one that is already part of the list. - while (!index_is_in_list(cycle_next, static_cast(i))) - { - auto* spr = GetEntity(cycle_next); - - cycle_start->next_in_quadrant = cycle_next; - cycle_next = spr->next_in_quadrant; - spr->next_in_quadrant = SPRITE_INDEX_NULL; - cycle_start = spr; - } - } - return i; - } - } - return -1; -} diff --git a/src/openrct2/world/Sprite.h b/src/openrct2/world/Sprite.h index 043fc87964..8a05dd0a17 100644 --- a/src/openrct2/world/Sprite.h +++ b/src/openrct2/world/Sprite.h @@ -259,7 +259,6 @@ rct_sprite_checksum sprite_checksum(); void sprite_set_flashing(SpriteBase* sprite, bool flashing); bool sprite_get_flashing(SpriteBase* sprite); int32_t check_for_sprite_list_cycles(bool fix); -int32_t check_for_spatial_index_cycles(bool fix); int32_t fix_disjoint_sprites(); template class EntityIterator