Fix gold bugs (Fixes #1145, Fixes #1146)

actorid
scrawl 11 years ago
parent 305e78c981
commit 2b15b8b484

@ -155,11 +155,8 @@ namespace MWClass
int count = ptr.getRefData().getCount();
bool gold = isGold(ptr);
if (gold && ptr.getCellRef().mGoldValue != 1)
count = ptr.getCellRef().mGoldValue;
else if (gold)
count *= ref->mBase->mData.mValue;
if (gold)
count *= getValue(ptr);
std::string countString;
if (!gold)
@ -204,7 +201,7 @@ namespace MWClass
MWBase::Environment::get().getWorld()->getStore();
if (isGold(ptr)) {
int goldAmount = ptr.getRefData().getCount();
int goldAmount = getValue(ptr) * ptr.getRefData().getCount();
std::string base = "Gold_001";
if (goldAmount >= 100)
@ -223,6 +220,7 @@ namespace MWClass
newRef.getPtr().get<ESM::Miscellaneous>();
newPtr = MWWorld::Ptr(&cell.mMiscItems.insert(*ref), &cell);
newPtr.getCellRef().mGoldValue = goldAmount;
newPtr.getRefData().setCount(1);
} else {
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();

@ -192,13 +192,11 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr,
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_025")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_100"))
{
int realCount = ptr.getRefData().getCount();
if (ptr.getCellRef().mGoldValue > 1 && realCount == 1)
realCount = ptr.getCellRef().mGoldValue;
int realCount = count * ptr.getClass().getValue(ptr);
for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
{
if (Misc::StringUtils::ciEqual((*iter).get<ESM::Miscellaneous>()->mRef.mRefID, MWWorld::ContainerStore::sGoldId))
if (Misc::StringUtils::ciEqual((*iter).getCellRef().mRefID, MWWorld::ContainerStore::sGoldId))
{
iter->getRefData().setCount(iter->getRefData().getCount() + realCount);
flagAsModified();
@ -206,8 +204,8 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr,
}
}
MWWorld::ManualRef ref(esmStore, MWWorld::ContainerStore::sGoldId, count);
return addNewStack(ref.getPtr(), count);
MWWorld::ManualRef ref(esmStore, MWWorld::ContainerStore::sGoldId, realCount);
return addNewStack(ref.getPtr(), realCount);
}
// determine whether to stack or not

Loading…
Cancel
Save