From cad3eb896873a8ca186809d70890248c39358b06 Mon Sep 17 00:00:00 2001 From: David Cernat Date: Tue, 2 May 2017 03:31:40 +0300 Subject: [PATCH] [Client] Iterate through CellStore's mergedRefs when initializing Actors --- apps/openmw/mwmp/Cell.cpp | 31 +++++++++++-------------------- 1 file changed, 11 insertions(+), 20 deletions(-) diff --git a/apps/openmw/mwmp/Cell.cpp b/apps/openmw/mwmp/Cell.cpp index 51f83389d..7f8c2025c 100644 --- a/apps/openmw/mwmp/Cell.cpp +++ b/apps/openmw/mwmp/Cell.cpp @@ -1,6 +1,8 @@ #include #include +#include "../mwworld/class.hpp" +#include "../mwworld/livecellref.hpp" #include "../mwworld/worldimp.hpp" #include "Cell.hpp" @@ -272,30 +274,19 @@ void Cell::initializeLocalActor(const MWWorld::Ptr& ptr) void Cell::initializeLocalActors() { - MWWorld::CellRefList *npcList = store->getNpcs(); + std::vector *mergedRefs = store->getMergedRefs(); - for (typename MWWorld::CellRefList::List::iterator listIter(npcList->mList.begin()); - listIter != npcList->mList.end(); ++listIter) + for (std::vector::iterator it = mergedRefs->begin(); it != mergedRefs->end(); ++it) { - MWWorld::Ptr ptr(&*listIter, store); - - // If this Ptr is lacking a unique index, ignore it - if (ptr.getCellRef().getRefNum().mIndex == 0 && ptr.getCellRef().getMpNum() == 0) continue; - - initializeLocalActor(ptr); - } - - MWWorld::CellRefList *creatureList = store->getCreatures(); - - for (typename MWWorld::CellRefList::List::iterator listIter(creatureList->mList.begin()); - listIter != creatureList->mList.end(); ++listIter) - { - MWWorld::Ptr ptr(&*listIter, store); + if ((*it)->mClass->isActor()) + { + MWWorld::Ptr ptr(*it, store); - // If this Ptr is lacking a unique index, ignore it - if (ptr.getCellRef().getRefNum().mIndex == 0 && ptr.getCellRef().getMpNum() == 0) continue; + // If this Ptr is lacking a unique index, ignore it + if (ptr.getCellRef().getRefNum().mIndex == 0 && ptr.getCellRef().getMpNum() == 0) continue; - initializeLocalActor(ptr); + initializeLocalActor(ptr); + } } }