CELL record corrections

pull/16/head
scrawl 12 years ago
parent 6a2b87e14a
commit 6f1575d42a

@ -227,7 +227,10 @@ void loadCell(ESM::Cell &cell, ESM::ESMReader &esm, Arguments& info)
std::cout << " Refnum: " << ref.mRefnum << std::endl;
std::cout << " ID: '" << ref.mRefID << "'\n";
std::cout << " Owner: '" << ref.mOwner << "'\n";
std::cout << " Uses/health: " << ref.mCharge << " NAM9: " << ref.mNam9 << std::endl;
std::cout << " Enchantment charge: '" << ref.mEnchantmentCharge << "'\n";
std::cout << " Uses/health: '" << ref.mCharge << "'\n";
std::cout << " Gold value: '" << ref.mGoldValue << "'\n";
std::cout << " Blocked: '" << static_cast<int>(ref.mReferenceBlocked) << "'" << std::endl;
}
}

@ -89,7 +89,9 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();
return ref->mBase->mData.mValue;
int value = (ptr.getCellRef().mGoldValue == 1) ? ref->mBase->mData.mValue : ptr.getCellRef().mGoldValue;
return value;
}
void Miscellaneous::registerSelf()
@ -151,8 +153,10 @@ namespace MWClass
int count = ptr.getRefData().getCount();
bool isGold = (ref->mBase->mName == store.get<ESM::GameSetting>().find("sGold")->getString());
if (isGold && count == 1)
count = ref->mBase->mData.mValue;
if (isGold && ptr.getCellRef().mGoldValue != 1)
count = ptr.getCellRef().mGoldValue;
else if (isGold)
count *= ref->mBase->mData.mValue;
std::string countString;
if (!isGold)
@ -214,7 +218,8 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
newRef.getPtr().get<ESM::Miscellaneous>();
newPtr = MWWorld::Ptr(&cell.mMiscItems.insert(*ref), &cell);
newPtr.getRefData ().setCount(goldAmount);
newPtr.getRefData ().setCount(1);
newPtr.getCellRef().mGoldValue = goldAmount;
} else {
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
ptr.get<ESM::Miscellaneous>();

@ -124,7 +124,8 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr)
{
MWWorld::ManualRef ref(esmStore, "Gold_001");
int count = (ptr.getRefData().getCount() == 1) ? gold->mBase->mData.mValue : 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)
{

@ -69,10 +69,11 @@ namespace MWWorld
cellRef.mScale = 1;
cellRef.mFactIndex = 0;
cellRef.mCharge = -1;
cellRef.mNam9 = 0;
cellRef.mGoldValue = 1;
cellRef.mEnchantmentCharge = -1;
cellRef.mTeleport = false;
cellRef.mLockLevel = 0;
cellRef.mUnam = 0;
cellRef.mReferenceBlocked = 0;
}
const Ptr& getPtr() const

@ -43,11 +43,14 @@ void CellRef::save(ESMWriter &esm)
esm.writeHNT("INDX", mFactIndex);
}
if (mEnchantmentCharge != -1)
esm.writeHNT("XCHG", mEnchantmentCharge);
if (mCharge != -1)
esm.writeHNT("INTV", mCharge);
if (mNam9 != 0) {
esm.writeHNT("NAM9", mNam9);
if (mGoldValue != 1) {
esm.writeHNT("NAM9", mGoldValue);
}
if (mTeleport)
@ -62,8 +65,8 @@ void CellRef::save(ESMWriter &esm)
esm.writeHNOCString("KNAM", mKey);
esm.writeHNOCString("TNAM", mTrap);
if (mUnam != -1) {
esm.writeHNT("UNAM", mUnam);
if (mReferenceBlocked != -1) {
esm.writeHNT("UNAM", mReferenceBlocked);
}
if (mFltv != 0) {
esm.writeHNT("FLTV", mFltv);
@ -281,10 +284,15 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref)
ref.mFactIndex = -2;
esm.getHNOT(ref.mFactIndex, "INDX");
ref.mNam9 = 0;
ref.mGoldValue = 1;
ref.mCharge = -1;
ref.mEnchantmentCharge = -1;
esm.getHNOT(ref.mEnchantmentCharge, "XCHG");
esm.getHNOT(ref.mCharge, "INTV");
esm.getHNOT(ref.mNam9, "NAM9");
esm.getHNOT(ref.mGoldValue, "NAM9");
// Present for doors that teleport you to another cell.
if (esm.isNextSub("DODT"))
@ -302,9 +310,9 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref)
ref.mKey = esm.getHNOString("KNAM");
ref.mTrap = esm.getHNOString("TNAM");
ref.mUnam = -1;
ref.mReferenceBlocked = -1;
ref.mFltv = 0;
esm.getHNOT(ref.mUnam, "UNAM");
esm.getHNOT(ref.mReferenceBlocked, "UNAM");
esm.getHNOT(ref.mFltv, "FLTV");
esm.getHNOT(ref.mPos, "DATA", 24);

@ -56,7 +56,11 @@ public:
// For tools (lockpicks, probes, repair hammer) it is the remaining uses.
int mCharge;
int mNam9;
// Remaining enchantment charge
float mEnchantmentCharge;
// This is 5 for Gold_005 references, 100 for Gold_100 and so on.
int mGoldValue;
// For doors - true if this door teleports to somewhere else, false
// if it should open through animation.
@ -72,8 +76,10 @@ public:
int mLockLevel;
std::string mKey, mTrap; // Key and trap ID names, if any
// No idea - occurs ONCE in Morrowind.esm, for an activator
signed char mUnam;
// This corresponds to the "Reference Blocked" checkbox in the construction set,
// which prevents editing that reference.
// -1 is not blocked, otherwise it is blocked.
signed char mReferenceBlocked;
// Track deleted references. 0 - not deleted, 1 - deleted, but respawns, 2 - deleted and does not respawn.
int mDeleted;

Loading…
Cancel
Save