diff --git a/apps/openmw-mp/Cell.cpp b/apps/openmw-mp/Cell.cpp index a0a2f8340..c907d90d2 100644 --- a/apps/openmw-mp/Cell.cpp +++ b/apps/openmw-mp/Cell.cpp @@ -71,6 +71,15 @@ CellController *CellController::get() return sThis; } +Cell *CellController::getCell(ESM::Cell *esmCell) +{ + if (esmCell->isExterior()) + return getCellByXY(esmCell->mData.mX, esmCell->mData.mY); + else + return getCellByName(esmCell->mName); +} + + Cell *CellController::getCellByXY(int x, int y) { auto it = find_if(cells.begin(), cells.end(), [x, y](const Cell *c) { diff --git a/apps/openmw-mp/Cell.hpp b/apps/openmw-mp/Cell.hpp index 175351016..162becebe 100644 --- a/apps/openmw-mp/Cell.hpp +++ b/apps/openmw-mp/Cell.hpp @@ -34,6 +34,7 @@ public: void removePlayer(Cell *cell, Player *player); void deletePlayer(Player *player); + Cell *getCell(ESM::Cell *esmCell); Cell *getCellByXY(int x, int y); Cell *getCellByName(std::string cellName); @@ -61,6 +62,7 @@ public: TPlayers getPlayers(); std::string getDescription() const; + private: TPlayers players; ESM::Cell cell;