[Server] Add CellController:getCell() for getting Cell through ESM::Cell

pull/158/head
David Cernat 8 years ago
parent ee1ba1728e
commit eb0744aa77

@ -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) {

@ -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;

Loading…
Cancel
Save