forked from teamnwah/openmw-tes3coop
[Server] Don't crash server every time a player disconnects. Again.
This commit is contained in:
parent
13a47b400d
commit
ec4d016100
3 changed files with 6 additions and 7 deletions
|
@ -169,9 +169,8 @@ void CellController::removePlayer(Cell *cell, Player *player)
|
||||||
|
|
||||||
void CellController::deletePlayer(Player *player)
|
void CellController::deletePlayer(Player *player)
|
||||||
{
|
{
|
||||||
std::deque<Cell *> playerCells = player->getCells();
|
|
||||||
|
|
||||||
for_each(playerCells.begin(), playerCells.end(), [&player](Cell *cell) {
|
for_each(player->getCells()->begin(), player->getCells()->end(), [&player](Cell *cell) {
|
||||||
for (auto it = cell->begin(); it != cell->end(); ++it)
|
for (auto it = cell->begin(); it != cell->end(); ++it)
|
||||||
{
|
{
|
||||||
if (*it == player)
|
if (*it == player)
|
||||||
|
|
|
@ -138,16 +138,16 @@ std::chrono::steady_clock::time_point Player::getLastAttackerTime()
|
||||||
return lastAttackerTime;
|
return lastAttackerTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
CellController::TContainer Player::getCells()
|
CellController::TContainer *Player::getCells()
|
||||||
{
|
{
|
||||||
return cells;
|
return &cells;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::sendToLoaded(mwmp::PlayerPacket *myPacket)
|
void Player::sendToLoaded(mwmp::PlayerPacket *myPacket)
|
||||||
{
|
{
|
||||||
std::list <Player*> plList;
|
std::list <Player*> plList;
|
||||||
|
|
||||||
for (auto cell : getCells())
|
for (auto cell : *getCells())
|
||||||
for (auto pl : *cell)
|
for (auto pl : *cell)
|
||||||
plList.push_back(pl);
|
plList.push_back(pl);
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ void Player::forEachLoaded(std::function<void(Player *pl, Player *other)> func)
|
||||||
{
|
{
|
||||||
std::list <Player*> plList;
|
std::list <Player*> plList;
|
||||||
|
|
||||||
for (auto cell : getCells())
|
for (auto cell : *getCells())
|
||||||
for (auto pl : *cell)
|
for (auto pl : *cell)
|
||||||
plList.push_back(pl);
|
plList.push_back(pl);
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,7 @@ public:
|
||||||
|
|
||||||
virtual ~Player();
|
virtual ~Player();
|
||||||
|
|
||||||
CellController::TContainer getCells();
|
CellController::TContainer *getCells();
|
||||||
void sendToLoaded(mwmp::PlayerPacket *myPacket);
|
void sendToLoaded(mwmp::PlayerPacket *myPacket);
|
||||||
|
|
||||||
void forEachLoaded(std::function<void(Player *pl, Player *other)> func);
|
void forEachLoaded(std::function<void(Player *pl, Player *other)> func);
|
||||||
|
|
Loading…
Reference in a new issue