mirror of
https://github.com/OpenRCT2/OpenRCT2
synced 2026-01-27 16:54:52 +01:00
Remove broken check_for_spatial_index_cycles
There were a number of issues with this function. It was calling index_is_in_list with invalid SPRITE_LISTs. The spatial index is no longer needed to be correct on save/load as it is rebuilt so that it is kept in order.
This commit is contained in:
@@ -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<SPRITE_LIST>(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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user