reverse squad iteration delete

develop
20k 2023-01-22 13:56:33 +00:00
parent 9054efd7c8
commit c7ca9d0d7b
1 changed files with 1 additions and 2 deletions

@ -1344,14 +1344,13 @@ static void delete_civzone_squad_links(df::building* bld)
//if this is null, something has gone just *terribly* wrong
if (squad)
{
for (int i=0; i < (int)squad->rooms.size(); i++)
for (int i=(int)squad->rooms.size() - 1; i >= 0; i--)
{
if (squad->rooms[i]->building_id == bld->id)
{
auto room = squad->rooms[i];
squad->rooms.erase(squad->rooms.begin() + i);
delete room;
i--;
}
}
}