mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-21 10:23:52 +00:00
[Client] Iterate through CellStore's mergedRefs when initializing Actors
This commit is contained in:
parent
ebf9df3fe2
commit
cad3eb8968
1 changed files with 11 additions and 20 deletions
|
@ -1,6 +1,8 @@
|
||||||
#include <components/esm/cellid.hpp>
|
#include <components/esm/cellid.hpp>
|
||||||
#include <components/openmw-mp/Log.hpp>
|
#include <components/openmw-mp/Log.hpp>
|
||||||
|
|
||||||
|
#include "../mwworld/class.hpp"
|
||||||
|
#include "../mwworld/livecellref.hpp"
|
||||||
#include "../mwworld/worldimp.hpp"
|
#include "../mwworld/worldimp.hpp"
|
||||||
|
|
||||||
#include "Cell.hpp"
|
#include "Cell.hpp"
|
||||||
|
@ -272,30 +274,19 @@ void Cell::initializeLocalActor(const MWWorld::Ptr& ptr)
|
||||||
|
|
||||||
void Cell::initializeLocalActors()
|
void Cell::initializeLocalActors()
|
||||||
{
|
{
|
||||||
MWWorld::CellRefList<ESM::NPC> *npcList = store->getNpcs();
|
std::vector<MWWorld::LiveCellRefBase*> *mergedRefs = store->getMergedRefs();
|
||||||
|
|
||||||
for (typename MWWorld::CellRefList<ESM::NPC>::List::iterator listIter(npcList->mList.begin());
|
for (std::vector<MWWorld::LiveCellRefBase*>::iterator it = mergedRefs->begin(); it != mergedRefs->end(); ++it)
|
||||||
listIter != npcList->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 this Ptr is lacking a unique index, ignore it
|
||||||
if (ptr.getCellRef().getRefNum().mIndex == 0 && ptr.getCellRef().getMpNum() == 0) continue;
|
if (ptr.getCellRef().getRefNum().mIndex == 0 && ptr.getCellRef().getMpNum() == 0) continue;
|
||||||
|
|
||||||
initializeLocalActor(ptr);
|
initializeLocalActor(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
MWWorld::CellRefList<ESM::Creature> *creatureList = store->getCreatures();
|
|
||||||
|
|
||||||
for (typename MWWorld::CellRefList<ESM::Creature>::List::iterator listIter(creatureList->mList.begin());
|
|
||||||
listIter != creatureList->mList.end(); ++listIter)
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue