Addition to bb4bd999ba : adjust position for objects placed from inventory

actorid
scrawl 11 years ago
parent eb5e4ecec2
commit 876fb9a899

@ -1095,7 +1095,7 @@ namespace MWWorld
MWWorld::Ptr World::safePlaceObject(const MWWorld::Ptr& ptr,MWWorld::CellStore &Cell,ESM::Position pos) MWWorld::Ptr World::safePlaceObject(const MWWorld::Ptr& ptr,MWWorld::CellStore &Cell,ESM::Position pos)
{ {
return copyObjectToCell(ptr,Cell,pos); return copyObjectToCell(ptr,Cell,pos,false);
} }
void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const void World::indexToPosition (int cellX, int cellY, float &x, float &y, bool centre) const
@ -1516,7 +1516,7 @@ namespace MWWorld
// copy the object and set its count // copy the object and set its count
int origCount = object.getRefData().getCount(); int origCount = object.getRefData().getCount();
object.getRefData().setCount(amount); object.getRefData().setCount(amount);
Ptr dropped = copyObjectToCell(object, *cell, pos); Ptr dropped = copyObjectToCell(object, *cell, pos, true);
object.getRefData().setCount(origCount); object.getRefData().setCount(origCount);
// only the player place items in the world, so no need to check actor // only the player place items in the world, so no need to check actor
@ -1537,13 +1537,13 @@ namespace MWWorld
} }
Ptr World::copyObjectToCell(const Ptr &object, CellStore &cell, const ESM::Position &pos) Ptr World::copyObjectToCell(const Ptr &object, CellStore &cell, const ESM::Position &pos, bool adjustPos)
{ {
/// \todo add searching correct cell for position specified /// \todo add searching correct cell for position specified
MWWorld::Ptr dropped = MWWorld::Ptr dropped =
MWWorld::Class::get(object).copyToCell(object, cell, pos); MWWorld::Class::get(object).copyToCell(object, cell, pos);
if (object.getClass().isActor()) if (object.getClass().isActor() || adjustPos)
{ {
Ogre::Vector3 min, max; Ogre::Vector3 min, max;
if (mPhysics->getObjectAABB(object, min, max)) { if (mPhysics->getObjectAABB(object, min, max)) {

@ -114,8 +114,7 @@ namespace MWWorld
bool moveObjectImp (const Ptr& ptr, float x, float y, float z); bool moveObjectImp (const Ptr& ptr, float x, float y, float z);
///< @return true if the active cell (cell player is in) changed ///< @return true if the active cell (cell player is in) changed
Ptr copyObjectToCell(const Ptr &ptr, CellStore &cell, const ESM::Position &pos, bool adjustPos=true);
Ptr copyObjectToCell(const Ptr &ptr, CellStore &cell, const ESM::Position &pos);
void updateWindowManager (); void updateWindowManager ();
void performUpdateSceneQueries (); void performUpdateSceneQueries ();

Loading…
Cancel
Save