forked from teamnwah/openmw-tes3coop
added blank function to CellRef and moved a function that was in the wrong file
This commit is contained in:
parent
1e60ad3cd6
commit
744198fc44
3 changed files with 89 additions and 52 deletions
87
components/esm/cellref.cpp
Normal file
87
components/esm/cellref.cpp
Normal file
|
@ -0,0 +1,87 @@
|
||||||
|
|
||||||
|
#include "cellref.hpp"
|
||||||
|
|
||||||
|
#include "esmwriter.hpp"
|
||||||
|
|
||||||
|
void ESM::CellRef::save(ESMWriter &esm)
|
||||||
|
{
|
||||||
|
esm.writeHNT("FRMR", mRefnum);
|
||||||
|
esm.writeHNCString("NAME", mRefID);
|
||||||
|
|
||||||
|
if (mScale != 1.0) {
|
||||||
|
esm.writeHNT("XSCL", mScale);
|
||||||
|
}
|
||||||
|
|
||||||
|
esm.writeHNOCString("ANAM", mOwner);
|
||||||
|
esm.writeHNOCString("BNAM", mGlob);
|
||||||
|
esm.writeHNOCString("XSOL", mSoul);
|
||||||
|
|
||||||
|
esm.writeHNOCString("CNAM", mFaction);
|
||||||
|
if (mFactIndex != -2) {
|
||||||
|
esm.writeHNT("INDX", mFactIndex);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mEnchantmentCharge != -1)
|
||||||
|
esm.writeHNT("XCHG", mEnchantmentCharge);
|
||||||
|
|
||||||
|
if (mCharge != -1)
|
||||||
|
esm.writeHNT("INTV", mCharge);
|
||||||
|
|
||||||
|
if (mGoldValue != 1) {
|
||||||
|
esm.writeHNT("NAM9", mGoldValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mTeleport)
|
||||||
|
{
|
||||||
|
esm.writeHNT("DODT", mDoorDest);
|
||||||
|
esm.writeHNOCString("DNAM", mDestCell);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mLockLevel != -1) {
|
||||||
|
esm.writeHNT("FLTV", mLockLevel);
|
||||||
|
}
|
||||||
|
esm.writeHNOCString("KNAM", mKey);
|
||||||
|
esm.writeHNOCString("TNAM", mTrap);
|
||||||
|
|
||||||
|
if (mReferenceBlocked != -1) {
|
||||||
|
esm.writeHNT("UNAM", mReferenceBlocked);
|
||||||
|
}
|
||||||
|
if (mFltv != 0) {
|
||||||
|
esm.writeHNT("FLTV", mFltv);
|
||||||
|
}
|
||||||
|
|
||||||
|
esm.writeHNT("DATA", mPos, 24);
|
||||||
|
if (mNam0 != 0) {
|
||||||
|
esm.writeHNT("NAM0", mNam0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ESM::CellRef::blank()
|
||||||
|
{
|
||||||
|
mRefnum = 0;
|
||||||
|
mRefID.clear();
|
||||||
|
mScale = 1;
|
||||||
|
mOwner.clear();
|
||||||
|
mGlob.clear();
|
||||||
|
mSoul.clear();
|
||||||
|
mFaction.clear();
|
||||||
|
mFactIndex = -1;
|
||||||
|
mCharge = 0;
|
||||||
|
mEnchantmentCharge = 0;
|
||||||
|
mGoldValue = 0;
|
||||||
|
mDestCell.clear();
|
||||||
|
mLockLevel = 0;
|
||||||
|
mKey.clear();
|
||||||
|
mTrap.clear();
|
||||||
|
mReferenceBlocked = 0;
|
||||||
|
mFltv = 0;
|
||||||
|
mNam0 = 0;
|
||||||
|
|
||||||
|
for (int i=0; i<3; ++i)
|
||||||
|
{
|
||||||
|
mDoorDest.pos[i] = 0;
|
||||||
|
mDoorDest.rot[i] = 0;
|
||||||
|
mPos.pos[i] = 0;
|
||||||
|
mPos.rot[i] = 0;
|
||||||
|
}
|
||||||
|
}
|
|
@ -84,6 +84,8 @@ namespace ESM
|
||||||
Position mPos;
|
Position mPos;
|
||||||
|
|
||||||
void save(ESMWriter &esm);
|
void save(ESMWriter &esm);
|
||||||
|
|
||||||
|
void blank();
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,58 +22,6 @@ bool operator==(const CellRef& ref, int pRefnum)
|
||||||
return (ref.mRefnum == pRefnum);
|
return (ref.mRefnum == pRefnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
void CellRef::save(ESMWriter &esm)
|
|
||||||
{
|
|
||||||
esm.writeHNT("FRMR", mRefnum);
|
|
||||||
esm.writeHNCString("NAME", mRefID);
|
|
||||||
|
|
||||||
if (mScale != 1.0) {
|
|
||||||
esm.writeHNT("XSCL", mScale);
|
|
||||||
}
|
|
||||||
|
|
||||||
esm.writeHNOCString("ANAM", mOwner);
|
|
||||||
esm.writeHNOCString("BNAM", mGlob);
|
|
||||||
esm.writeHNOCString("XSOL", mSoul);
|
|
||||||
|
|
||||||
esm.writeHNOCString("CNAM", mFaction);
|
|
||||||
if (mFactIndex != -2) {
|
|
||||||
esm.writeHNT("INDX", mFactIndex);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mEnchantmentCharge != -1)
|
|
||||||
esm.writeHNT("XCHG", mEnchantmentCharge);
|
|
||||||
|
|
||||||
if (mCharge != -1)
|
|
||||||
esm.writeHNT("INTV", mCharge);
|
|
||||||
|
|
||||||
if (mGoldValue != 1) {
|
|
||||||
esm.writeHNT("NAM9", mGoldValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mTeleport)
|
|
||||||
{
|
|
||||||
esm.writeHNT("DODT", mDoorDest);
|
|
||||||
esm.writeHNOCString("DNAM", mDestCell);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mLockLevel != -1) {
|
|
||||||
esm.writeHNT("FLTV", mLockLevel);
|
|
||||||
}
|
|
||||||
esm.writeHNOCString("KNAM", mKey);
|
|
||||||
esm.writeHNOCString("TNAM", mTrap);
|
|
||||||
|
|
||||||
if (mReferenceBlocked != -1) {
|
|
||||||
esm.writeHNT("UNAM", mReferenceBlocked);
|
|
||||||
}
|
|
||||||
if (mFltv != 0) {
|
|
||||||
esm.writeHNT("FLTV", mFltv);
|
|
||||||
}
|
|
||||||
|
|
||||||
esm.writeHNT("DATA", mPos, 24);
|
|
||||||
if (mNam0 != 0) {
|
|
||||||
esm.writeHNT("NAM0", mNam0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void Cell::load(ESMReader &esm, bool saveContext)
|
void Cell::load(ESMReader &esm, bool saveContext)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue