1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-16 17:59:56 +00:00

Merge branch 'fix-7503' into 'master'

[#7503]: pass full count of coins to createGold() in moveToCell()

See merge request OpenMW/openmw!3279
This commit is contained in:
Petr Mikheev 2023-07-27 09:31:24 +00:00
commit bc1d412aaa
5 changed files with 10 additions and 12 deletions

View file

@ -216,10 +216,9 @@ namespace MWClass
MWWorld::Ptr newPtr; MWWorld::Ptr newPtr;
if (isGold(ptr)) if (isGold(ptr))
{ {
newPtr = createGold(cell, getValue(ptr)); newPtr = createGold(cell, getValue(ptr) * ptr.getRefData().getCount());
newPtr.getRefData() = ptr.getRefData(); newPtr.getRefData() = ptr.getRefData();
newPtr.getCellRef().setRefNum(ptr.getCellRef().getRefNum()); newPtr.getCellRef().setRefNum(ptr.getCellRef().getRefNum());
newPtr.getCellRef().setGoldValue(ptr.getCellRef().getGoldValue());
newPtr.getRefData().setCount(1); newPtr.getRefData().setCount(1);
} }
else else

View file

@ -391,12 +391,11 @@ namespace MWWorld
return newPtr; 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); Ptr newPtr = moveToCell(ptr, cell);
newPtr.getRefData().setPosition(pos); newPtr.getRefData().setPosition(pos);
newPtr.getCellRef().setPosition(pos); newPtr.getCellRef().setPosition(pos);
newPtr.getRefData().setCount(count);
return newPtr; return newPtr;
} }

View file

@ -317,7 +317,7 @@ namespace MWWorld
// The original is expected to be removed after calling this function, // The original is expected to be removed after calling this function,
// but this function itself doesn't remove the original. // but this function itself doesn't remove the original.
virtual Ptr moveToCell(const Ptr& ptr, CellStore& cell) const; 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; Ptr copyToCell(const ConstPtr& ptr, CellStore& cell, const ESM::Position& pos, int count) const;

View file

@ -2025,8 +2025,8 @@ namespace MWWorld
pos.rot[1] = 0; pos.rot[1] = 0;
// copy the object and set its count // copy the object and set its count
Ptr dropped = copy ? copyObjectToCell(object, cell, pos, amount, true) Ptr dropped
: moveObjectToCell(object, cell, pos, amount, true); = 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 // only the player place items in the world, so no need to check actor
PCDropped(dropped); PCDropped(dropped);
@ -2071,7 +2071,7 @@ namespace MWWorld
return dropped; 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) if (!cell)
throw std::runtime_error("moveObjectToCell(): cannot move object to null cell"); throw std::runtime_error("moveObjectToCell(): cannot move object to null cell");
@ -2082,7 +2082,7 @@ namespace MWWorld
cell = &mWorldModel.getExterior(index); 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); initObjectInCell(dropped, *cell, adjustPos);
@ -2147,8 +2147,8 @@ namespace MWWorld
pos.pos[2] = result.mHitPointWorld.z(); pos.pos[2] = result.mHitPointWorld.z();
// copy the object and set its count // copy the object and set its count
Ptr dropped = copy ? copyObjectToCell(object, cell, pos, amount, true) Ptr dropped
: moveObjectToCell(object, cell, pos, amount, true); = copy ? copyObjectToCell(object, cell, pos, amount, true) : moveObjectToCell(object, cell, pos, true);
if (actor == mPlayer->getPlayer()) // Only call if dropped by player if (actor == mPlayer->getPlayer()) // Only call if dropped by player
PCDropped(dropped); PCDropped(dropped);

View file

@ -144,7 +144,7 @@ namespace MWWorld
void updateWeather(float duration, bool paused = false); void updateWeather(float duration, bool paused = false);
void initObjectInCell(const Ptr& ptr, CellStore& cell, bool adjustPos); 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); Ptr copyObjectToCell(const ConstPtr& ptr, CellStore* cell, ESM::Position pos, int count, bool adjustPos);
void updateSoundListener(); void updateSoundListener();