PlaceAt count argument should spawn independent references (Fixes #2283)

openmw-35
scrawl 10 years ago
parent 7542fb5cd9
commit 7d76f1a113

@ -518,10 +518,8 @@ namespace MWScript
if (count<0)
throw std::runtime_error ("count must be non-negative");
// no-op
if (count == 0)
return;
for (int i=0; i<count; ++i)
{
ESM::Position ipos = actor.getRefData().getPosition();
Ogre::Vector3 pos(ipos.pos[0],ipos.pos[1],ipos.pos[2]);
Ogre::Quaternion rot(Ogre::Radian(-ipos.rot[2]), Ogre::Vector3::UNIT_Z);
@ -550,11 +548,12 @@ namespace MWScript
}
// create item
MWWorld::CellStore* store = actor.getCell();
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), itemID, count);
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), itemID, 1);
ref.getPtr().getCellRef().setPosition(ipos);
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),store,ipos);
}
}
};
template<class R>

Loading…
Cancel
Save