diff --git a/apps/openmw-mp/Cell.cpp b/apps/openmw-mp/Cell.cpp index ed5df72be..39efaf199 100644 --- a/apps/openmw-mp/Cell.cpp +++ b/apps/openmw-mp/Cell.cpp @@ -169,9 +169,8 @@ void CellController::removePlayer(Cell *cell, Player *player) void CellController::deletePlayer(Player *player) { - std::deque 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) { if (*it == player) diff --git a/apps/openmw-mp/Player.cpp b/apps/openmw-mp/Player.cpp index 6f9b5ee3e..6096d50c0 100644 --- a/apps/openmw-mp/Player.cpp +++ b/apps/openmw-mp/Player.cpp @@ -138,16 +138,16 @@ std::chrono::steady_clock::time_point Player::getLastAttackerTime() return lastAttackerTime; } -CellController::TContainer Player::getCells() +CellController::TContainer *Player::getCells() { - return cells; + return &cells; } void Player::sendToLoaded(mwmp::PlayerPacket *myPacket) { std::list plList; - for (auto cell : getCells()) + for (auto cell : *getCells()) for (auto pl : *cell) plList.push_back(pl); @@ -165,7 +165,7 @@ void Player::forEachLoaded(std::function func) { std::list plList; - for (auto cell : getCells()) + for (auto cell : *getCells()) for (auto pl : *cell) plList.push_back(pl); diff --git a/apps/openmw-mp/Player.hpp b/apps/openmw-mp/Player.hpp index f9fdbb878..cf83b9688 100644 --- a/apps/openmw-mp/Player.hpp +++ b/apps/openmw-mp/Player.hpp @@ -70,7 +70,7 @@ public: virtual ~Player(); - CellController::TContainer getCells(); + CellController::TContainer *getCells(); void sendToLoaded(mwmp::PlayerPacket *myPacket); void forEachLoaded(std::function func);