forked from mirror/openmw-tes3mp
[Server] Add CellController:getCell() for getting Cell through ESM::Cell
This commit is contained in:
parent
ee1ba1728e
commit
eb0744aa77
2 changed files with 11 additions and 0 deletions
|
@ -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…
Reference in a new issue