Fix Ptr updates in PositionCell

This was not the proper way to get the updated Ptr, it will only work for the player which isn't owned by any cell. For other objects, moving between cells makes the object owned by that cell and thus the getBase() pointer will change.
openmw-37
scrawl 9 years ago
parent 9e3eb8291f
commit 19cd987208

@ -312,8 +312,8 @@ namespace MWScript
}
if(store)
{
MWBase::Environment::get().getWorld()->moveObject(ptr,store,x,y,z);
ptr = MWWorld::Ptr(ptr.getBase(), store);
ptr = MWBase::Environment::get().getWorld()->moveObject(ptr,store,x,y,z);
dynamic_cast<MWScript::InterpreterContext&>(runtime.getContext()).updatePtr(ptr);
float ax = osg::RadiansToDegrees(ptr.getRefData().getPosition().rot[0]);
@ -363,8 +363,7 @@ namespace MWScript
if (ptr == MWMechanics::getPlayer())
{
MWWorld::CellStore* cell = MWBase::Environment::get().getWorld()->getExterior(cx,cy);
MWBase::Environment::get().getWorld()->moveObject(ptr,cell,x,y,z);
ptr = MWWorld::Ptr(ptr.getBase(), cell);
ptr = MWBase::Environment::get().getWorld()->moveObject(ptr,cell,x,y,z);
}
else
{

Loading…
Cancel
Save