diff --git a/apps/openmw/mwmechanics/actors.cpp b/apps/openmw/mwmechanics/actors.cpp index 53cb42347..cd3180570 100644 --- a/apps/openmw/mwmechanics/actors.cpp +++ b/apps/openmw/mwmechanics/actors.cpp @@ -11,9 +11,18 @@ #include +/* + Start of tes3mp addition + + Include additional headers for multiplayer purposes +*/ #include "../mwmp/Main.hpp" +#include "../mwmp/CellController.hpp" #include "../mwmp/DedicatedPlayer.hpp" #include "../mwmp/LocalPlayer.hpp" +/* + End of tes3mp addition +*/ #include "../mwworld/esmstore.hpp" #include "../mwworld/class.hpp" @@ -1139,14 +1148,17 @@ namespace MWMechanics return; // for now abort update of the old cell when cell changes by teleportation magic effect // a better solution might be to apply cell changes at the end of the frame } + /* Start of tes3mp change (major) Allow AI processing when LiveCellRefBase's isLocalActor set to true */ + bool isLocalActor = mwmp::Main::get().getCellController()->isLocalActor(actor); + //if (MWBase::Environment::get().getMechanicsManager()->isAIActive() && inProcessingRange) - if ((MWBase::Environment::get().getMechanicsManager()->isAIActive() || actor.getBase()->isLocalActor) + if ((MWBase::Environment::get().getMechanicsManager()->isAIActive() || isLocalActor) && inProcessingRange) /* End of tes3mp change (major) diff --git a/apps/openmw/mwmp/Cell.cpp b/apps/openmw/mwmp/Cell.cpp index 5df8d4153..47ef40d19 100644 --- a/apps/openmw/mwmp/Cell.cpp +++ b/apps/openmw/mwmp/Cell.cpp @@ -40,7 +40,8 @@ void Cell::updateLocal(bool forceUpdate) if (actor->getPtr().getCell() != store) { LOG_APPEND(Log::LOG_INFO, "- Removing LocalActor %s which is no longer in this cell", it->first.c_str()); - actor->getPtr().getBase()->isLocalActor = false; + + Main::get().getCellController()->removeLocalActorRecord(it->first); localActors.erase(it++); } else @@ -144,7 +145,6 @@ void Cell::initializeLocalActors() LocalActor *actor = new LocalActor(); actor->cell = esmCell; - ptr.getBase()->isLocalActor = true; actor->setPtr(ptr); std::string mapIndex = Main::get().getCellController()->generateMapIndex(ptr); @@ -189,7 +189,6 @@ void Cell::uninitializeLocalActors() for (std::map::iterator it = localActors.begin(); it != localActors.end(); ++it) { LocalActor *actor = it->second; - actor->getPtr().getBase()->isLocalActor = false; Main::get().getCellController()->removeLocalActorRecord(it->first); } diff --git a/apps/openmw/mwworld/livecellref.cpp b/apps/openmw/mwworld/livecellref.cpp index 48ec0ac91..b0c4f63f9 100644 --- a/apps/openmw/mwworld/livecellref.cpp +++ b/apps/openmw/mwworld/livecellref.cpp @@ -20,7 +20,6 @@ MWWorld::LiveCellRefBase::LiveCellRefBase(const std::string& type, const ESM::Ce Set default values for tes3mp-only booleans */ canChangeCell = true; - isLocalActor = false; /* End of tes3mp addition */ diff --git a/apps/openmw/mwworld/livecellref.hpp b/apps/openmw/mwworld/livecellref.hpp index a42baf732..493f2e4ca 100644 --- a/apps/openmw/mwworld/livecellref.hpp +++ b/apps/openmw/mwworld/livecellref.hpp @@ -38,17 +38,6 @@ namespace MWWorld End of tes3mp addition */ - /* - Start of tes3mp addition - - Useful boolean for quickly establishing which creatures and NPCs should be - processed locally by the player - */ - bool isLocalActor; - /* - End of tes3mp addition - */ - /** runtime-data */ RefData mData;