mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-10 19:10:25 +00:00
Move player corpses on instance shutdown
Moves corpses to graveyard when an expired instance shuts down. Zones without a graveyard move them to non-instance version instead. Fixes player corpses being left inside instances that expire before graveyards process or in instances without a graveyard
This commit is contained in:
@@ -5225,3 +5225,43 @@ void EntityList::GateAllClientsToSafeReturn()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int EntityList::MovePlayerCorpsesToGraveyard(bool force_move_from_instance)
|
||||
{
|
||||
if (!zone)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
int moved_count = 0;
|
||||
|
||||
for (auto it = corpse_list.begin(); it != corpse_list.end();)
|
||||
{
|
||||
bool moved = false;
|
||||
if (it->second && it->second->IsPlayerCorpse())
|
||||
{
|
||||
if (zone->HasGraveyard())
|
||||
{
|
||||
moved = it->second->MovePlayerCorpseToGraveyard();
|
||||
}
|
||||
else if (force_move_from_instance && zone->GetInstanceID() != 0)
|
||||
{
|
||||
moved = it->second->MovePlayerCorpseToNonInstance();
|
||||
}
|
||||
}
|
||||
|
||||
if (moved)
|
||||
{
|
||||
safe_delete(it->second);
|
||||
free_ids.push(it->first);
|
||||
it = corpse_list.erase(it);
|
||||
++moved_count;
|
||||
}
|
||||
else
|
||||
{
|
||||
++it;
|
||||
}
|
||||
}
|
||||
|
||||
return moved_count;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user