From 14e1ff27cb5ba79bb91de50ff8eda70bf8eb8940 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Sun, 23 Apr 2017 16:53:24 +0300 Subject: [PATCH] [Client] Rename CellController's cellsActive to cellsInitialized for clarity --- apps/openmw/mwmp/Cell.cpp | 4 +- apps/openmw/mwmp/CellController.cpp | 60 ++++++++++++++-------------- apps/openmw/mwmp/CellController.hpp | 4 +- apps/openmw/mwmp/DedicatedPlayer.cpp | 2 +- 4 files changed, 35 insertions(+), 35 deletions(-) diff --git a/apps/openmw/mwmp/Cell.cpp b/apps/openmw/mwmp/Cell.cpp index a85ca2f27..29cf1f5ef 100644 --- a/apps/openmw/mwmp/Cell.cpp +++ b/apps/openmw/mwmp/Cell.cpp @@ -48,7 +48,7 @@ void Cell::updateLocal(bool forceUpdate) Main::get().getCellController()->removeLocalActorRecord(it->first); // If the cell this actor has moved to is active, initialize them in it - if (Main::get().getCellController()->isActiveCell(*newStore->getCell())) + if (Main::get().getCellController()->isInitializedCell(*newStore->getCell())) Main::get().getCellController()->getCell(*newStore->getCell())->initializeLocalActor(actor->getPtr()); localActors.erase(it++); @@ -221,7 +221,7 @@ void Cell::readCellChange(ActorList& actorList) Main::get().getCellController()->removeDedicatedActorRecord(mapIndex); // If the cell this actor has moved to is active, initialize them in it - if (Main::get().getCellController()->isActiveCell(actor->cell)) + if (Main::get().getCellController()->isInitializedCell(actor->cell)) Main::get().getCellController()->getCell(actor->cell)->initializeDedicatedActor(actor->getPtr()); dedicatedActors.erase(mapIndex); diff --git a/apps/openmw/mwmp/CellController.cpp b/apps/openmw/mwmp/CellController.cpp index 73e40baf2..2ff1fa8ac 100644 --- a/apps/openmw/mwmp/CellController.cpp +++ b/apps/openmw/mwmp/CellController.cpp @@ -14,7 +14,7 @@ #include "LocalPlayer.hpp" using namespace mwmp; -std::map CellController::cellsActive; +std::map CellController::cellsInitialized; std::map CellController::localActorsToCells; std::map CellController::dedicatedActorsToCells; @@ -30,7 +30,7 @@ mwmp::CellController::~CellController() void CellController::updateLocal(bool forceUpdate) { - for (std::map::iterator it = cellsActive.begin(); it != cellsActive.end();) + for (std::map::iterator it = cellsInitialized.begin(); it != cellsInitialized.end();) { mwmp::Cell *mpCell = it->second; @@ -38,7 +38,7 @@ void CellController::updateLocal(bool forceUpdate) { mpCell->uninitializeLocalActors(); mpCell->uninitializeDedicatedActors(); - cellsActive.erase(it++); + cellsInitialized.erase(it++); } else { @@ -51,7 +51,7 @@ void CellController::updateLocal(bool forceUpdate) void CellController::updateDedicated(float dt) { - for (std::map::iterator it = cellsActive.begin(); it != cellsActive.end(); ++it) + for (std::map::iterator it = cellsInitialized.begin(); it != cellsInitialized.end(); ++it) { it->second->updateDedicated(dt); } @@ -62,14 +62,14 @@ void CellController::initializeCell(const ESM::Cell& cell) std::string mapIndex = cell.getDescription(); // If this key doesn't exist, create it - if (cellsActive.count(mapIndex) == 0) + if (cellsInitialized.count(mapIndex) == 0) { MWWorld::CellStore *cellStore = getCellStore(cell); if (!cellStore) return; mwmp::Cell *mpCell = new mwmp::Cell(cellStore); - cellsActive[mapIndex] = mpCell; + cellsInitialized[mapIndex] = mpCell; LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "- Initialized mwmp::Cell %s", mpCell->getDescription().c_str()); } @@ -82,10 +82,10 @@ void CellController::initializeLocalActors(const ESM::Cell& cell) initializeCell(cell); // If this now exists, initialize local actors in it - if (cellsActive.count(mapIndex) > 0) + if (cellsInitialized.count(mapIndex) > 0) { - cellsActive[mapIndex]->uninitializeDedicatedActors(); - cellsActive[mapIndex]->initializeLocalActors(); + cellsInitialized[mapIndex]->uninitializeDedicatedActors(); + cellsInitialized[mapIndex]->initializeLocalActors(); } } @@ -96,9 +96,9 @@ void CellController::readPositions(ActorList& actorList) initializeCell(actorList.cell); // If this now exists, send it the data - if (cellsActive.count(mapIndex) > 0) + if (cellsInitialized.count(mapIndex) > 0) { - cellsActive[mapIndex]->readPositions(actorList); + cellsInitialized[mapIndex]->readPositions(actorList); } } @@ -109,9 +109,9 @@ void CellController::readAnimFlags(ActorList& actorList) initializeCell(actorList.cell); // If this now exists, send it the data - if (cellsActive.count(mapIndex) > 0) + if (cellsInitialized.count(mapIndex) > 0) { - cellsActive[mapIndex]->readAnimFlags(actorList); + cellsInitialized[mapIndex]->readAnimFlags(actorList); } } @@ -122,9 +122,9 @@ void CellController::readAnimPlay(ActorList& actorList) initializeCell(actorList.cell); // If this now exists, send it the data - if (cellsActive.count(mapIndex) > 0) + if (cellsInitialized.count(mapIndex) > 0) { - cellsActive[mapIndex]->readAnimPlay(actorList); + cellsInitialized[mapIndex]->readAnimPlay(actorList); } } @@ -135,9 +135,9 @@ void CellController::readStatsDynamic(ActorList& actorList) initializeCell(actorList.cell); // If this now exists, send it the data - if (cellsActive.count(mapIndex) > 0) + if (cellsInitialized.count(mapIndex) > 0) { - cellsActive[mapIndex]->readStatsDynamic(actorList); + cellsInitialized[mapIndex]->readStatsDynamic(actorList); } } @@ -148,9 +148,9 @@ void CellController::readSpeech(ActorList& actorList) initializeCell(actorList.cell); // If this now exists, send it the data - if (cellsActive.count(mapIndex) > 0) + if (cellsInitialized.count(mapIndex) > 0) { - cellsActive[mapIndex]->readSpeech(actorList); + cellsInitialized[mapIndex]->readSpeech(actorList); } } @@ -161,9 +161,9 @@ void CellController::readAttack(ActorList& actorList) initializeCell(actorList.cell); // If this now exists, send it the data - if (cellsActive.count(mapIndex) > 0) + if (cellsInitialized.count(mapIndex) > 0) { - cellsActive[mapIndex]->readAttack(actorList); + cellsInitialized[mapIndex]->readAttack(actorList); } } @@ -174,9 +174,9 @@ void CellController::readCellChange(ActorList& actorList) initializeCell(actorList.cell); // If this now exists, send it the data - if (cellsActive.count(mapIndex) > 0) + if (cellsInitialized.count(mapIndex) > 0) { - cellsActive[mapIndex]->readCellChange(actorList); + cellsInitialized[mapIndex]->readCellChange(actorList); } } @@ -211,7 +211,7 @@ LocalActor *CellController::getLocalActor(MWWorld::Ptr ptr) std::string actorIndex = generateMapIndex(ptr); std::string cellIndex = localActorsToCells.at(actorIndex); - return cellsActive.at(cellIndex)->getLocalActor(actorIndex); + return cellsInitialized.at(cellIndex)->getLocalActor(actorIndex); } LocalActor *CellController::getLocalActor(std::string refId, int refNumIndex, int mpNum) @@ -219,7 +219,7 @@ LocalActor *CellController::getLocalActor(std::string refId, int refNumIndex, in std::string actorIndex = generateMapIndex(refId, refNumIndex, mpNum); std::string cellIndex = localActorsToCells.at(actorIndex); - return cellsActive.at(cellIndex)->getLocalActor(actorIndex); + return cellsInitialized.at(cellIndex)->getLocalActor(actorIndex); } void CellController::setDedicatedActorRecord(std::string actorIndex, std::string cellIndex) @@ -253,7 +253,7 @@ DedicatedActor *CellController::getDedicatedActor(MWWorld::Ptr ptr) std::string actorIndex = generateMapIndex(ptr); std::string cellIndex = dedicatedActorsToCells.at(actorIndex); - return cellsActive.at(cellIndex)->getDedicatedActor(actorIndex); + return cellsInitialized.at(cellIndex)->getDedicatedActor(actorIndex); } DedicatedActor *CellController::getDedicatedActor(std::string refId, int refNumIndex, int mpNum) @@ -261,7 +261,7 @@ DedicatedActor *CellController::getDedicatedActor(std::string refId, int refNumI std::string actorIndex = generateMapIndex(refId, refNumIndex, mpNum); std::string cellIndex = dedicatedActorsToCells.at(actorIndex); - return cellsActive.at(cellIndex)->getDedicatedActor(actorIndex); + return cellsInitialized.at(cellIndex)->getDedicatedActor(actorIndex); } std::string CellController::generateMapIndex(std::string refId, int refNumIndex, int mpNum) @@ -284,14 +284,14 @@ std::string CellController::generateMapIndex(BaseActor baseActor) return generateMapIndex(baseActor.refId, baseActor.refNumIndex, baseActor.mpNum); } -bool CellController::isActiveCell(const ESM::Cell& cell) +bool CellController::isInitializedCell(const ESM::Cell& cell) { - return (cellsActive.count(cell.getDescription()) > 0); + return (cellsInitialized.count(cell.getDescription()) > 0); } Cell *CellController::getCell(const ESM::Cell& cell) { - return cellsActive.at(cell.getDescription()); + return cellsInitialized.at(cell.getDescription()); } MWWorld::CellStore *CellController::getCellStore(const ESM::Cell& cell) diff --git a/apps/openmw/mwmp/CellController.hpp b/apps/openmw/mwmp/CellController.hpp index 53f97cc5e..45f88f7ac 100644 --- a/apps/openmw/mwmp/CellController.hpp +++ b/apps/openmw/mwmp/CellController.hpp @@ -50,7 +50,7 @@ namespace mwmp std::string generateMapIndex(MWWorld::Ptr ptr); std::string generateMapIndex(mwmp::BaseActor baseActor); - bool isActiveCell(const ESM::Cell& cell); + bool isInitializedCell(const ESM::Cell& cell); virtual Cell *getCell(const ESM::Cell& cell); virtual MWWorld::CellStore *getCellStore(const ESM::Cell& cell); @@ -63,7 +63,7 @@ namespace mwmp int getCellSize() const; private: - static std::map cellsActive; + static std::map cellsInitialized; static std::map localActorsToCells; static std::map dedicatedActorsToCells; }; diff --git a/apps/openmw/mwmp/DedicatedPlayer.cpp b/apps/openmw/mwmp/DedicatedPlayer.cpp index e5d57dad2..a79c94041 100644 --- a/apps/openmw/mwmp/DedicatedPlayer.cpp +++ b/apps/openmw/mwmp/DedicatedPlayer.cpp @@ -377,7 +377,7 @@ void DedicatedPlayer::updateCell() // NPC data in that cell if (MWBase::Environment::get().getWorld()->isCellActive(cellStore)) { - if (Main::get().getCellController()->isActiveCell(cell)) + if (Main::get().getCellController()->isInitializedCell(cell)) Main::get().getCellController()->getCell(cell)->updateLocal(true); } }