mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-03-30 09:06:43 +00:00
CELL record corrections
This commit is contained in:
parent
6a2b87e14a
commit
6f1575d42a
6 changed files with 43 additions and 19 deletions
|
@ -227,7 +227,10 @@ void loadCell(ESM::Cell &cell, ESM::ESMReader &esm, Arguments& info)
|
||||||
std::cout << " Refnum: " << ref.mRefnum << std::endl;
|
std::cout << " Refnum: " << ref.mRefnum << std::endl;
|
||||||
std::cout << " ID: '" << ref.mRefID << "'\n";
|
std::cout << " ID: '" << ref.mRefID << "'\n";
|
||||||
std::cout << " Owner: '" << ref.mOwner << "'\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 =
|
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||||
ptr.get<ESM::Miscellaneous>();
|
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()
|
void Miscellaneous::registerSelf()
|
||||||
|
@ -151,8 +153,10 @@ namespace MWClass
|
||||||
int count = ptr.getRefData().getCount();
|
int count = ptr.getRefData().getCount();
|
||||||
|
|
||||||
bool isGold = (ref->mBase->mName == store.get<ESM::GameSetting>().find("sGold")->getString());
|
bool isGold = (ref->mBase->mName == store.get<ESM::GameSetting>().find("sGold")->getString());
|
||||||
if (isGold && count == 1)
|
if (isGold && ptr.getCellRef().mGoldValue != 1)
|
||||||
count = ref->mBase->mData.mValue;
|
count = ptr.getCellRef().mGoldValue;
|
||||||
|
else if (isGold)
|
||||||
|
count *= ref->mBase->mData.mValue;
|
||||||
|
|
||||||
std::string countString;
|
std::string countString;
|
||||||
if (!isGold)
|
if (!isGold)
|
||||||
|
@ -214,7 +218,8 @@ namespace MWClass
|
||||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||||
newRef.getPtr().get<ESM::Miscellaneous>();
|
newRef.getPtr().get<ESM::Miscellaneous>();
|
||||||
newPtr = MWWorld::Ptr(&cell.mMiscItems.insert(*ref), &cell);
|
newPtr = MWWorld::Ptr(&cell.mMiscItems.insert(*ref), &cell);
|
||||||
newPtr.getRefData ().setCount(goldAmount);
|
newPtr.getRefData ().setCount(1);
|
||||||
|
newPtr.getCellRef().mGoldValue = goldAmount;
|
||||||
} else {
|
} else {
|
||||||
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
MWWorld::LiveCellRef<ESM::Miscellaneous> *ref =
|
||||||
ptr.get<ESM::Miscellaneous>();
|
ptr.get<ESM::Miscellaneous>();
|
||||||
|
|
|
@ -124,7 +124,8 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::addImp (const Ptr& ptr)
|
||||||
{
|
{
|
||||||
MWWorld::ManualRef ref(esmStore, "Gold_001");
|
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);
|
ref.getPtr().getRefData().setCount(count);
|
||||||
for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
|
for (MWWorld::ContainerStoreIterator iter (begin(type)); iter!=end(); ++iter)
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,10 +69,11 @@ namespace MWWorld
|
||||||
cellRef.mScale = 1;
|
cellRef.mScale = 1;
|
||||||
cellRef.mFactIndex = 0;
|
cellRef.mFactIndex = 0;
|
||||||
cellRef.mCharge = -1;
|
cellRef.mCharge = -1;
|
||||||
cellRef.mNam9 = 0;
|
cellRef.mGoldValue = 1;
|
||||||
|
cellRef.mEnchantmentCharge = -1;
|
||||||
cellRef.mTeleport = false;
|
cellRef.mTeleport = false;
|
||||||
cellRef.mLockLevel = 0;
|
cellRef.mLockLevel = 0;
|
||||||
cellRef.mUnam = 0;
|
cellRef.mReferenceBlocked = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Ptr& getPtr() const
|
const Ptr& getPtr() const
|
||||||
|
|
|
@ -43,11 +43,14 @@ void CellRef::save(ESMWriter &esm)
|
||||||
esm.writeHNT("INDX", mFactIndex);
|
esm.writeHNT("INDX", mFactIndex);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (mEnchantmentCharge != -1)
|
||||||
|
esm.writeHNT("XCHG", mEnchantmentCharge);
|
||||||
|
|
||||||
if (mCharge != -1)
|
if (mCharge != -1)
|
||||||
esm.writeHNT("INTV", mCharge);
|
esm.writeHNT("INTV", mCharge);
|
||||||
|
|
||||||
if (mNam9 != 0) {
|
if (mGoldValue != 1) {
|
||||||
esm.writeHNT("NAM9", mNam9);
|
esm.writeHNT("NAM9", mGoldValue);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mTeleport)
|
if (mTeleport)
|
||||||
|
@ -62,8 +65,8 @@ void CellRef::save(ESMWriter &esm)
|
||||||
esm.writeHNOCString("KNAM", mKey);
|
esm.writeHNOCString("KNAM", mKey);
|
||||||
esm.writeHNOCString("TNAM", mTrap);
|
esm.writeHNOCString("TNAM", mTrap);
|
||||||
|
|
||||||
if (mUnam != -1) {
|
if (mReferenceBlocked != -1) {
|
||||||
esm.writeHNT("UNAM", mUnam);
|
esm.writeHNT("UNAM", mReferenceBlocked);
|
||||||
}
|
}
|
||||||
if (mFltv != 0) {
|
if (mFltv != 0) {
|
||||||
esm.writeHNT("FLTV", mFltv);
|
esm.writeHNT("FLTV", mFltv);
|
||||||
|
@ -281,10 +284,15 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref)
|
||||||
ref.mFactIndex = -2;
|
ref.mFactIndex = -2;
|
||||||
esm.getHNOT(ref.mFactIndex, "INDX");
|
esm.getHNOT(ref.mFactIndex, "INDX");
|
||||||
|
|
||||||
ref.mNam9 = 0;
|
ref.mGoldValue = 1;
|
||||||
ref.mCharge = -1;
|
ref.mCharge = -1;
|
||||||
|
ref.mEnchantmentCharge = -1;
|
||||||
|
|
||||||
|
esm.getHNOT(ref.mEnchantmentCharge, "XCHG");
|
||||||
|
|
||||||
esm.getHNOT(ref.mCharge, "INTV");
|
esm.getHNOT(ref.mCharge, "INTV");
|
||||||
esm.getHNOT(ref.mNam9, "NAM9");
|
|
||||||
|
esm.getHNOT(ref.mGoldValue, "NAM9");
|
||||||
|
|
||||||
// Present for doors that teleport you to another cell.
|
// Present for doors that teleport you to another cell.
|
||||||
if (esm.isNextSub("DODT"))
|
if (esm.isNextSub("DODT"))
|
||||||
|
@ -302,9 +310,9 @@ bool Cell::getNextRef(ESMReader &esm, CellRef &ref)
|
||||||
ref.mKey = esm.getHNOString("KNAM");
|
ref.mKey = esm.getHNOString("KNAM");
|
||||||
ref.mTrap = esm.getHNOString("TNAM");
|
ref.mTrap = esm.getHNOString("TNAM");
|
||||||
|
|
||||||
ref.mUnam = -1;
|
ref.mReferenceBlocked = -1;
|
||||||
ref.mFltv = 0;
|
ref.mFltv = 0;
|
||||||
esm.getHNOT(ref.mUnam, "UNAM");
|
esm.getHNOT(ref.mReferenceBlocked, "UNAM");
|
||||||
esm.getHNOT(ref.mFltv, "FLTV");
|
esm.getHNOT(ref.mFltv, "FLTV");
|
||||||
|
|
||||||
esm.getHNOT(ref.mPos, "DATA", 24);
|
esm.getHNOT(ref.mPos, "DATA", 24);
|
||||||
|
|
|
@ -56,7 +56,11 @@ public:
|
||||||
// For tools (lockpicks, probes, repair hammer) it is the remaining uses.
|
// For tools (lockpicks, probes, repair hammer) it is the remaining uses.
|
||||||
int mCharge;
|
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
|
// For doors - true if this door teleports to somewhere else, false
|
||||||
// if it should open through animation.
|
// if it should open through animation.
|
||||||
|
@ -72,8 +76,10 @@ public:
|
||||||
int mLockLevel;
|
int mLockLevel;
|
||||||
std::string mKey, mTrap; // Key and trap ID names, if any
|
std::string mKey, mTrap; // Key and trap ID names, if any
|
||||||
|
|
||||||
// No idea - occurs ONCE in Morrowind.esm, for an activator
|
// This corresponds to the "Reference Blocked" checkbox in the construction set,
|
||||||
signed char mUnam;
|
// 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.
|
// Track deleted references. 0 - not deleted, 1 - deleted, but respawns, 2 - deleted and does not respawn.
|
||||||
int mDeleted;
|
int mDeleted;
|
||||||
|
|
Loading…
Reference in a new issue