mirror of
https://github.com/OpenMW/openmw.git
synced 2025-01-16 15:29:55 +00:00
Do not redundantly take and set count in moveToCell(). moveToCell() should always be moving the full stack.
This commit is contained in:
parent
8867e76fd7
commit
1162323e96
5 changed files with 9 additions and 11 deletions
|
@ -219,7 +219,6 @@ namespace MWClass
|
|||
newPtr = createGold(cell, getValue(ptr) * ptr.getRefData().getCount());
|
||||
newPtr.getRefData() = ptr.getRefData();
|
||||
newPtr.getCellRef().setRefNum(ptr.getCellRef().getRefNum());
|
||||
newPtr.getCellRef().setGoldValue(ptr.getCellRef().getGoldValue());
|
||||
newPtr.getRefData().setCount(1);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -391,12 +391,11 @@ namespace MWWorld
|
|||
return newPtr;
|
||||
}
|
||||
|
||||
Ptr Class::moveToCell(const Ptr& ptr, CellStore& cell, const ESM::Position& pos, int count) const
|
||||
Ptr Class::moveToCell(const Ptr& ptr, CellStore& cell, const ESM::Position& pos) const
|
||||
{
|
||||
Ptr newPtr = moveToCell(ptr, cell);
|
||||
newPtr.getRefData().setPosition(pos);
|
||||
newPtr.getCellRef().setPosition(pos);
|
||||
newPtr.getRefData().setCount(count);
|
||||
return newPtr;
|
||||
}
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ namespace MWWorld
|
|||
// The original is expected to be removed after calling this function,
|
||||
// but this function itself doesn't remove the original.
|
||||
virtual Ptr moveToCell(const Ptr& ptr, CellStore& cell) const;
|
||||
Ptr moveToCell(const Ptr& ptr, CellStore& cell, const ESM::Position& pos, int count) const;
|
||||
Ptr moveToCell(const Ptr& ptr, CellStore& cell, const ESM::Position& pos) const;
|
||||
|
||||
Ptr copyToCell(const ConstPtr& ptr, CellStore& cell, const ESM::Position& pos, int count) const;
|
||||
|
||||
|
|
|
@ -2024,8 +2024,8 @@ namespace MWWorld
|
|||
pos.rot[1] = 0;
|
||||
|
||||
// copy the object and set its count
|
||||
Ptr dropped = copy ? copyObjectToCell(object, cell, pos, amount, true)
|
||||
: moveObjectToCell(object, cell, pos, amount, true);
|
||||
Ptr dropped
|
||||
= copy ? copyObjectToCell(object, cell, pos, amount, true) : moveObjectToCell(object, cell, pos, true);
|
||||
|
||||
// only the player place items in the world, so no need to check actor
|
||||
PCDropped(dropped);
|
||||
|
@ -2070,7 +2070,7 @@ namespace MWWorld
|
|||
return dropped;
|
||||
}
|
||||
|
||||
Ptr World::moveObjectToCell(const Ptr& object, CellStore* cell, ESM::Position pos, int count, bool adjustPos)
|
||||
Ptr World::moveObjectToCell(const Ptr& object, CellStore* cell, ESM::Position pos, bool adjustPos)
|
||||
{
|
||||
if (!cell)
|
||||
throw std::runtime_error("moveObjectToCell(): cannot move object to null cell");
|
||||
|
@ -2081,7 +2081,7 @@ namespace MWWorld
|
|||
cell = &mWorldModel.getExterior(index);
|
||||
}
|
||||
|
||||
MWWorld::Ptr dropped = object.getClass().moveToCell(object, *cell, pos, count);
|
||||
MWWorld::Ptr dropped = object.getClass().moveToCell(object, *cell, pos);
|
||||
|
||||
initObjectInCell(dropped, *cell, adjustPos);
|
||||
|
||||
|
@ -2146,8 +2146,8 @@ namespace MWWorld
|
|||
pos.pos[2] = result.mHitPointWorld.z();
|
||||
|
||||
// copy the object and set its count
|
||||
Ptr dropped = copy ? copyObjectToCell(object, cell, pos, amount, true)
|
||||
: moveObjectToCell(object, cell, pos, amount, true);
|
||||
Ptr dropped
|
||||
= copy ? copyObjectToCell(object, cell, pos, amount, true) : moveObjectToCell(object, cell, pos, true);
|
||||
|
||||
if (actor == mPlayer->getPlayer()) // Only call if dropped by player
|
||||
PCDropped(dropped);
|
||||
|
|
|
@ -144,7 +144,7 @@ namespace MWWorld
|
|||
void updateWeather(float duration, bool paused = false);
|
||||
|
||||
void initObjectInCell(const Ptr& ptr, CellStore& cell, bool adjustPos);
|
||||
Ptr moveObjectToCell(const Ptr& ptr, CellStore* cell, ESM::Position pos, int count, bool adjustPos);
|
||||
Ptr moveObjectToCell(const Ptr& ptr, CellStore* cell, ESM::Position pos, bool adjustPos);
|
||||
Ptr copyObjectToCell(const ConstPtr& ptr, CellStore* cell, ESM::Position pos, int count, bool adjustPos);
|
||||
|
||||
void updateSoundListener();
|
||||
|
|
Loading…
Reference in a new issue