From bb9ea6ccd485c7ec57de4dd952eb310e659a2c4c Mon Sep 17 00:00:00 2001 From: David Cernat Date: Wed, 5 Apr 2017 06:22:01 +0300 Subject: [PATCH] [Client] Also include list of creatures in reply to ActorList --- apps/openmw/mwmp/WorldEvent.cpp | 23 +++++++++++++++++++---- apps/openmw/mwworld/cellstore.cpp | 6 ++++++ apps/openmw/mwworld/cellstore.hpp | 3 +++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/apps/openmw/mwmp/WorldEvent.cpp b/apps/openmw/mwmp/WorldEvent.cpp index 449db4c21..00eecf2ba 100644 --- a/apps/openmw/mwmp/WorldEvent.cpp +++ b/apps/openmw/mwmp/WorldEvent.cpp @@ -51,12 +51,27 @@ void WorldEvent::sendActors(MWWorld::CellStore* cellStore) for (typename MWWorld::CellRefList::List::iterator listIter(npcList->mList.begin()); listIter != npcList->mList.end(); ++listIter) { - MWWorld::Ptr npc(&*listIter, 0); + MWWorld::Ptr ptr(&*listIter, 0); mwmp::WorldObject worldObject; - worldObject.refId = npc.getCellRef().getRefId(); - worldObject.refNumIndex = npc.getCellRef().getRefNum().mIndex; - worldObject.mpNum = npc.getCellRef().getMpNum(); + worldObject.refId = ptr.getCellRef().getRefId(); + worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + worldObject.mpNum = ptr.getCellRef().getMpNum(); + + worldEvent->addObject(worldObject); + } + + MWWorld::CellRefList *creatureList = cellStore->getCreatures(); + + for (typename MWWorld::CellRefList::List::iterator listIter(creatureList->mList.begin()); + listIter != creatureList->mList.end(); ++listIter) + { + MWWorld::Ptr ptr(&*listIter, 0); + + mwmp::WorldObject worldObject; + worldObject.refId = ptr.getCellRef().getRefId(); + worldObject.refNumIndex = ptr.getCellRef().getRefNum().mIndex; + worldObject.mpNum = ptr.getCellRef().getMpNum(); worldEvent->addObject(worldObject); } diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 17023eb83..40fd98219 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -487,6 +487,12 @@ namespace MWWorld return &mNpcs; } + // Added by tes3mp and used to get all the creatures in the cell + CellRefList *CellStore::getCreatures() + { + return &mCreatures; + } + // Added by tes3mp and used to get all the containers in the cell CellRefList *CellStore::getContainers() { diff --git a/apps/openmw/mwworld/cellstore.hpp b/apps/openmw/mwworld/cellstore.hpp index 017467752..8d094b78f 100644 --- a/apps/openmw/mwworld/cellstore.hpp +++ b/apps/openmw/mwworld/cellstore.hpp @@ -240,6 +240,9 @@ namespace MWWorld CellRefList *getNpcs(); // Added by tes3mp and used to get all the NPCs in the cell + CellRefList *getCreatures(); + // Added by tes3mp and used to get all the creatures in the cell + CellRefList *getContainers(); // Added by tes3mp and used to get all the containers in the cell