From 18be1880f0716fda6185846f7b74f31a3234b38a Mon Sep 17 00:00:00 2001 From: David Cernat Date: Fri, 7 Apr 2017 10:16:23 +0300 Subject: [PATCH] [Client] Make it possible to get LocalActor from CellController --- apps/openmw/mwmp/Cell.cpp | 5 +++++ apps/openmw/mwmp/Cell.hpp | 2 ++ apps/openmw/mwmp/CellController.cpp | 9 +++++++++ apps/openmw/mwmp/CellController.hpp | 2 ++ 4 files changed, 18 insertions(+) diff --git a/apps/openmw/mwmp/Cell.cpp b/apps/openmw/mwmp/Cell.cpp index 3b4228581..6db8bb66b 100644 --- a/apps/openmw/mwmp/Cell.cpp +++ b/apps/openmw/mwmp/Cell.cpp @@ -147,6 +147,11 @@ void Cell::readCellFrame(WorldEvent& worldEvent) } } +LocalActor *Cell::getLocalActor(std::string actorIndex) +{ + return localActors.at(actorIndex); +} + MWWorld::CellStore *Cell::getCellStore() { return store; diff --git a/apps/openmw/mwmp/Cell.hpp b/apps/openmw/mwmp/Cell.hpp index c470df236..abbee6abf 100644 --- a/apps/openmw/mwmp/Cell.hpp +++ b/apps/openmw/mwmp/Cell.hpp @@ -20,6 +20,8 @@ namespace mwmp void uninitializeLocalActors(); void readCellFrame(mwmp::WorldEvent& worldEvent); + virtual LocalActor *getLocalActor(std::string actorIndex); + MWWorld::CellStore* getCellStore(); std::string getDescription(); diff --git a/apps/openmw/mwmp/CellController.cpp b/apps/openmw/mwmp/CellController.cpp index dcdf65d38..f0033bf7f 100644 --- a/apps/openmw/mwmp/CellController.cpp +++ b/apps/openmw/mwmp/CellController.cpp @@ -8,6 +8,7 @@ #include "CellController.hpp" #include "Main.hpp" +#include "LocalActor.hpp" #include "LocalPlayer.hpp" using namespace mwmp; @@ -99,6 +100,14 @@ bool CellController::hasLocalActorRecord(MWWorld::Ptr ptr) return (localActorsToCells.count(mapIndex) > 0); } +LocalActor *CellController::getLocalActor(MWWorld::Ptr ptr) +{ + std::string actorIndex = generateMapIndex(ptr); + std::string cellIndex = localActorsToCells.at(actorIndex); + + cellsActive.at(cellIndex)->getLocalActor(actorIndex); +} + std::string CellController::generateMapIndex(MWWorld::Ptr ptr) { std::string mapIndex = ""; diff --git a/apps/openmw/mwmp/CellController.hpp b/apps/openmw/mwmp/CellController.hpp index da6e5e4ff..adfc554b8 100644 --- a/apps/openmw/mwmp/CellController.hpp +++ b/apps/openmw/mwmp/CellController.hpp @@ -24,6 +24,8 @@ namespace mwmp void removeLocalActorRecord(std::string actorIndex); bool hasLocalActorRecord(MWWorld::Ptr ptr); + virtual LocalActor *getLocalActor(MWWorld::Ptr ptr); + std::string generateMapIndex(MWWorld::Ptr ptr); std::string generateMapIndex(mwmp::WorldObject object);