|
|
|
@ -687,15 +687,15 @@ namespace MWWorld
|
|
|
|
|
void World::moveObject(const Ptr &ptr, CellStore &newCell, float x, float y, float z)
|
|
|
|
|
{
|
|
|
|
|
ESM::Position &pos = ptr.getRefData().getPosition();
|
|
|
|
|
pos.pos[0] = x, pos.pos[1] = y, pos.pos[2] = z;
|
|
|
|
|
pos.pos[0] = x;
|
|
|
|
|
pos.pos[1] = y;
|
|
|
|
|
pos.pos[2] = z;
|
|
|
|
|
Ogre::Vector3 vec(x, y, z);
|
|
|
|
|
|
|
|
|
|
CellStore *currCell = ptr.getCell();
|
|
|
|
|
bool isPlayer = ptr == mPlayer->getPlayer();
|
|
|
|
|
bool haveToMove = mWorldScene->isCellActive(*currCell) || isPlayer;
|
|
|
|
|
|
|
|
|
|
removeContainerScripts(ptr);
|
|
|
|
|
|
|
|
|
|
if (*currCell != newCell)
|
|
|
|
|
{
|
|
|
|
|
if (isPlayer)
|
|
|
|
@ -707,7 +707,8 @@ namespace MWWorld
|
|
|
|
|
int cellY = newCell.mCell->getGridY();
|
|
|
|
|
mWorldScene->changeCell(cellX, cellY, pos, false);
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
if (!mWorldScene->isCellActive(*currCell))
|
|
|
|
|
copyObjectToCell(ptr, newCell, pos);
|
|
|
|
|
else if (!mWorldScene->isCellActive(newCell))
|
|
|
|
@ -715,6 +716,7 @@ namespace MWWorld
|
|
|
|
|
MWWorld::Class::get(ptr).copyToCell(ptr, newCell);
|
|
|
|
|
mWorldScene->removeObjectFromScene(ptr);
|
|
|
|
|
mLocalScripts.remove(ptr);
|
|
|
|
|
removeContainerScripts (ptr);
|
|
|
|
|
haveToMove = false;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
@ -722,27 +724,25 @@ namespace MWWorld
|
|
|
|
|
MWWorld::Ptr copy =
|
|
|
|
|
MWWorld::Class::get(ptr).copyToCell(ptr, newCell);
|
|
|
|
|
|
|
|
|
|
addContainerScripts(copy, &newCell);
|
|
|
|
|
|
|
|
|
|
mRendering->moveObjectToCell(copy, vec, currCell);
|
|
|
|
|
|
|
|
|
|
if (MWWorld::Class::get(ptr).isActor())
|
|
|
|
|
{
|
|
|
|
|
MWBase::MechanicsManager *mechMgr =
|
|
|
|
|
MWBase::Environment::get().getMechanicsManager();
|
|
|
|
|
|
|
|
|
|
mechMgr->removeActor(ptr);
|
|
|
|
|
mechMgr->addActor(copy);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
std::string script =
|
|
|
|
|
MWWorld::Class::get(ptr).getScript(ptr);
|
|
|
|
|
if (!script.empty())
|
|
|
|
|
{
|
|
|
|
|
mLocalScripts.remove(ptr);
|
|
|
|
|
removeContainerScripts (ptr);
|
|
|
|
|
mLocalScripts.add(script, copy);
|
|
|
|
|
addContainerScripts (copy, &newCell);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (MWWorld::Class::get(ptr).isActor())
|
|
|
|
|
{
|
|
|
|
|
MWBase::MechanicsManager *mechMgr =
|
|
|
|
|
MWBase::Environment::get().getMechanicsManager();
|
|
|
|
|
|
|
|
|
|
mechMgr->removeActor(ptr);
|
|
|
|
|
mechMgr->addActor(copy);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
ptr.getRefData().setCount(0);
|
|
|
|
|