mirror of
https://github.com/OpenMW/openmw.git
synced 2025-06-20 05:11:35 +00:00
PlaceAt count argument should spawn independent references (Fixes #2283)
This commit is contained in:
parent
7542fb5cd9
commit
7d76f1a113
1 changed files with 33 additions and 34 deletions
|
@ -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…
Reference in a new issue