Gold condition now always checks RefID instead of the name. This is necessary because in the french MW version, the sGold GMST is different from the name of the gold references.

actorid
scrawl 12 years ago
parent a359ba6a2f
commit 0079f62180

@ -158,7 +158,12 @@ namespace MWClass
int count = ptr.getRefData().getCount();
bool isGold = (ref->mBase->mName == store.get<ESM::GameSetting>().find("sGold")->getString());
bool isGold = Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_001")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_005")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_010")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_025")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_100");
if (isGold && ptr.getCellRef().mGoldValue != 1)
count = ptr.getCellRef().mGoldValue;
else if (isGold)

@ -111,34 +111,28 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr)
// gold needs special handling: when it is inserted into a container, the base object automatically becomes Gold_001
// this ensures that gold piles of different sizes stack with each other (also, several scripts rely on Gold_001 for detecting player gold)
if (MWWorld::Class::get(ptr).getName(ptr) == esmStore.get<ESM::GameSetting>().find("sGold")->getString())
if (Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_001")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_005")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_010")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_025")
|| Misc::StringUtils::ciEqual(ptr.getCellRef().mRefID, "gold_100"))
{
MWWorld::LiveCellRef<ESM::Miscellaneous> *gold =
ptr.get<ESM::Miscellaneous>();
if (Misc::StringUtils::ciEqual(gold->mRef.mRefID, "gold_001")
|| Misc::StringUtils::ciEqual(gold->mRef.mRefID, "gold_005")
|| Misc::StringUtils::ciEqual(gold->mRef.mRefID, "gold_010")
|| Misc::StringUtils::ciEqual(gold->mRef.mRefID, "gold_025")
|| Misc::StringUtils::ciEqual(gold->mRef.mRefID, "gold_100"))
{
MWWorld::ManualRef ref(esmStore, "Gold_001");
MWWorld::ManualRef ref(esmStore, "Gold_001");
int count = MWWorld::Class::get(ptr).getValue(ptr) * ptr.getRefData().getCount();
int count = MWWorld::Class::get(ptr).getValue(ptr) * ptr.getRefData().getCount();
ref.getPtr().getRefData().setCount(count);
for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
ref.getPtr().getRefData().setCount(count);
for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
{
if (Misc::StringUtils::ciEqual((*iter).get<ESM::Miscellaneous>()->mRef.mRefID, "gold_001"))
{
if (Misc::StringUtils::ciEqual((*iter).get<ESM::Miscellaneous>()->mRef.mRefID, "gold_001"))
{
(*iter).getRefData().setCount( (*iter).getRefData().getCount() + count);
flagAsModified();
return iter;
}
(*iter).getRefData().setCount( (*iter).getRefData().getCount() + count);
flagAsModified();
return iter;
}
return addImpl(ref.getPtr());
}
return addImpl(ref.getPtr());
}
// determine whether to stack or not

Loading…
Cancel
Save