From 34e77c5dae3ce8b34d21dbf8f2c04c996a4ae10e Mon Sep 17 00:00:00 2001 From: David Cernat Date: Wed, 3 May 2017 04:47:04 +0300 Subject: [PATCH] [Client] Initialize Actors based on the guid of an ActorAuthority packet --- .../actor/ProcessorActorAuthority.hpp | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/apps/openmw/mwmp/processors/actor/ProcessorActorAuthority.hpp b/apps/openmw/mwmp/processors/actor/ProcessorActorAuthority.hpp index 18498ddcd..5c300f615 100644 --- a/apps/openmw/mwmp/processors/actor/ProcessorActorAuthority.hpp +++ b/apps/openmw/mwmp/processors/actor/ProcessorActorAuthority.hpp @@ -22,13 +22,30 @@ namespace mwmp virtual void Do(ActorPacket &packet, ActorList &actorList) { - LOG_MESSAGE_SIMPLE(Log::LOG_VERBOSE, "Received %s about %s", strPacketID.c_str(), actorList.cell.getDescription().c_str()); + LOG_MESSAGE_SIMPLE(Log::LOG_INFO, "Received %s about %s", strPacketID.c_str(), actorList.cell.getDescription().c_str()); // Never initialize LocalActors in a cell that is no longer loaded, if the server's packet arrived too late if (mwmp::Main::get().getCellController()->isActiveWorldCell(actorList.cell)) { - Main::get().getCellController()->initializeLocalActors(actorList.cell); - Main::get().getCellController()->getCell(actorList.cell)->updateLocal(true); + if (isLocal()) + { + LOG_APPEND(Log::LOG_INFO, "- The new authority is me"); + Main::get().getCellController()->initializeLocalActors(actorList.cell); + Main::get().getCellController()->getCell(actorList.cell)->updateLocal(true); + } + else + { + BasePlayer *player = PlayerList::getPlayer(guid); + + if (player != 0) + LOG_APPEND(Log::LOG_INFO, "- The new authority is %s", player->npc.mName.c_str()); + + Main::get().getCellController()->getCell(actorList.cell)->uninitializeLocalActors(); + } + } + else + { + LOG_APPEND(Log::LOG_INFO, "- Ignoring it because that cell isn't loaded"); } } };