mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 23:23:52 +00:00
[Server] Delete cells that become empty when a player disconnects
This commit is contained in:
parent
048ddf6a34
commit
deb10919ab
1 changed files with 3 additions and 17 deletions
|
@ -229,24 +229,10 @@ void CellController::deletePlayer(Player *player)
|
|||
LOG_APPEND(Log::LOG_INFO, "- Iterating through Cells from Player %s",
|
||||
player->npc.mName.c_str());
|
||||
|
||||
for_each(player->getCells()->begin(), player->getCells()->end(), [&player](Cell *cell)
|
||||
for (auto it = player->getCells()->begin(); player->getCells()->size() != 0; ++it)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "-- Found Cell %s",
|
||||
cell->getDescription().c_str());
|
||||
|
||||
for (auto it = cell->begin(); it != cell->end(); ++it)
|
||||
{
|
||||
if (*it == player)
|
||||
{
|
||||
LOG_APPEND(Log::LOG_INFO, "-- Deleting %s from Cell %s",
|
||||
player->npc.mName.c_str(),
|
||||
cell->getDescription().c_str());
|
||||
|
||||
cell->players.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
removePlayer(*it, player);
|
||||
}
|
||||
}
|
||||
|
||||
void CellController::update(Player *player)
|
||||
|
|
Loading…
Reference in a new issue