From 15f91e7825c49014a99a6b904cc5cc32e241f8a2 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Mon, 10 Apr 2017 18:13:22 +0300 Subject: [PATCH] [Client] Add CellController methods for getting and checking Cells --- apps/openmw/mwmp/CellController.cpp | 14 ++++++++++++-- apps/openmw/mwmp/CellController.hpp | 6 +++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmp/CellController.cpp b/apps/openmw/mwmp/CellController.cpp index bfa8ee37b..43a16587a 100644 --- a/apps/openmw/mwmp/CellController.cpp +++ b/apps/openmw/mwmp/CellController.cpp @@ -170,9 +170,14 @@ std::string CellController::generateMapIndex(BaseActor baseActor) return mapIndex; } -int CellController::getCellSize() const +bool CellController::isActiveCell(const ESM::Cell& cell) { - return 8192; + return (cellsActive.count(cell.getDescription()) > 0); +} + +Cell *CellController::getCell(const ESM::Cell& cell) +{ + return cellsActive.at(cell.getDescription()); } MWWorld::CellStore *CellController::getCellStore(const ESM::Cell& cell) @@ -240,3 +245,8 @@ void CellController::closeContainer(const MWWorld::Ptr &container) Main::get().getLocalPlayer()->updateInventory(); } + +int CellController::getCellSize() const +{ + return 8192; +} diff --git a/apps/openmw/mwmp/CellController.hpp b/apps/openmw/mwmp/CellController.hpp index 86dde640d..f4ee32ece 100644 --- a/apps/openmw/mwmp/CellController.hpp +++ b/apps/openmw/mwmp/CellController.hpp @@ -36,12 +36,16 @@ namespace mwmp std::string generateMapIndex(MWWorld::Ptr ptr); std::string generateMapIndex(mwmp::BaseActor baseActor); - int getCellSize() const; + bool isActiveCell(const ESM::Cell& cell); + virtual Cell *getCell(const ESM::Cell& cell); + virtual MWWorld::CellStore *getCellStore(const ESM::Cell& cell); void openContainer(const MWWorld::Ptr& container, bool loot); void closeContainer(const MWWorld::Ptr& container); + int getCellSize() const; + private: static std::map cellsActive; static std::map localActorsToCells;