forked from mirror/openmw-tes3mp
[Server] Remove player from Cells when disconnected
This commit is contained in:
parent
f2ce46ffed
commit
67099e437a
3 changed files with 17 additions and 0 deletions
|
@ -140,6 +140,20 @@ void CellController::removePlayer(Cell *cell, Player *player)
|
|||
}
|
||||
}
|
||||
|
||||
void CellController::deletePlayer(Player *player)
|
||||
{
|
||||
for_each (cells.begin(), cells.end(), [&player](Cell *cell) {
|
||||
for (auto it = cell->begin(); it != cell->end(); ++it)
|
||||
{
|
||||
if (*it == player)
|
||||
{
|
||||
cell->players.erase(it);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
void CellController::update(Player *player)
|
||||
{
|
||||
for(auto cell : player->cellStateChanges.cellStates)
|
||||
|
|
|
@ -32,6 +32,7 @@ public:
|
|||
void removeCell(Cell *);
|
||||
|
||||
void removePlayer(Cell *cell, Player *player);
|
||||
void deletePlayer(Player *player);
|
||||
|
||||
Cell *getCellByXY(int x, int y);
|
||||
Cell *getCellByID(std::string cellid);
|
||||
|
|
|
@ -15,6 +15,8 @@ void Players::deletePlayer(RakNet::RakNetGUID guid)
|
|||
|
||||
if (players[guid] != 0)
|
||||
{
|
||||
CellController::get()->deletePlayer(players[guid]);
|
||||
|
||||
LOG_APPEND(Log::LOG_INFO, "- Emptying slot %i",
|
||||
players[guid]->getId());
|
||||
|
||||
|
|
Loading…
Reference in a new issue