forked from teamnwah/openmw-tes3coop
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)
|
if (count<0)
|
||||||
throw std::runtime_error ("count must be non-negative");
|
throw std::runtime_error ("count must be non-negative");
|
||||||
|
|
||||||
// no-op
|
for (int i=0; i<count; ++i)
|
||||||
if (count == 0)
|
{
|
||||||
return;
|
|
||||||
|
|
||||||
ESM::Position ipos = actor.getRefData().getPosition();
|
ESM::Position ipos = actor.getRefData().getPosition();
|
||||||
Ogre::Vector3 pos(ipos.pos[0],ipos.pos[1],ipos.pos[2]);
|
Ogre::Vector3 pos(ipos.pos[0],ipos.pos[1],ipos.pos[2]);
|
||||||
Ogre::Quaternion rot(Ogre::Radian(-ipos.rot[2]), Ogre::Vector3::UNIT_Z);
|
Ogre::Quaternion rot(Ogre::Radian(-ipos.rot[2]), Ogre::Vector3::UNIT_Z);
|
||||||
|
@ -550,11 +548,12 @@ namespace MWScript
|
||||||
}
|
}
|
||||||
// create item
|
// create item
|
||||||
MWWorld::CellStore* store = actor.getCell();
|
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);
|
ref.getPtr().getCellRef().setPosition(ipos);
|
||||||
|
|
||||||
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),store,ipos);
|
MWBase::Environment::get().getWorld()->safePlaceObject(ref.getPtr(),store,ipos);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
template<class R>
|
template<class R>
|
||||||
|
|
Loading…
Reference in a new issue