Remove ESM:: namespace qualifier in components/esm3/ and tests

pull/3226/head
elsid 3 years ago
parent fd6899e91d
commit 4447ab0ed7
No known key found for this signature in database
GPG Key ID: B845CB9FEE18AB40

@ -425,7 +425,7 @@ namespace
std::string write(const Variant& variant, const Variant::Format format) std::string write(const Variant& variant, const Variant::Format format)
{ {
std::ostringstream out; std::ostringstream out;
ESM::ESMWriter writer; ESMWriter writer;
writer.save(out); writer.save(out);
variant.write(writer, format); variant.write(writer, format);
writer.close(); writer.close();
@ -435,7 +435,7 @@ namespace
Variant read(const Variant::Format format, const std::string& data) Variant read(const Variant::Format format, const std::string& data)
{ {
Variant result; Variant result;
ESM::ESMReader reader; ESMReader reader;
reader.open(std::make_shared<std::istringstream>(data), ""); reader.open(std::make_shared<std::istringstream>(data), "");
result.read(reader, format); result.read(reader, format);
return result; return result;
@ -490,7 +490,7 @@ namespace
{ {
const auto param = GetParam(); const auto param = GetParam();
std::ostringstream out; std::ostringstream out;
ESM::ESMWriter writer; ESMWriter writer;
writer.save(out); writer.save(out);
ASSERT_THROW(param.mVariant.write(writer, param.mFormat), std::runtime_error); ASSERT_THROW(param.mVariant.write(writer, param.mFormat), std::runtime_error);
} }

@ -3,9 +3,11 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
namespace ESM
{
namespace namespace
{ {
void save(ESM::ESMWriter& esm, const std::vector<ESM::ActiveSpells::ActiveSpellParams>& spells, ESM::NAME tag) void saveImpl(ESMWriter& esm, const std::vector<ActiveSpells::ActiveSpellParams>& spells, NAME tag)
{ {
for (const auto& params : spells) for (const auto& params : spells)
{ {
@ -38,19 +40,19 @@ namespace
} }
} }
void load(ESM::ESMReader& esm, std::vector<ESM::ActiveSpells::ActiveSpellParams>& spells, ESM::NAME tag) void loadImpl(ESMReader& esm, std::vector<ActiveSpells::ActiveSpellParams>& spells, NAME tag)
{ {
int format = esm.getFormat(); int format = esm.getFormat();
while (esm.isNextSub(tag)) while (esm.isNextSub(tag))
{ {
ESM::ActiveSpells::ActiveSpellParams params; ActiveSpells::ActiveSpellParams params;
params.mId = esm.getHString(); params.mId = esm.getHString();
esm.getHNT (params.mCasterActorId, "CAST"); esm.getHNT (params.mCasterActorId, "CAST");
params.mDisplayName = esm.getHNString ("DISP"); params.mDisplayName = esm.getHNString ("DISP");
params.mItem.unset(); params.mItem.unset();
if (format < 17) if (format < 17)
params.mType = ESM::ActiveSpells::Type_Temporary; params.mType = ActiveSpells::Type_Temporary;
else else
{ {
esm.getHNT (params.mType, "TYPE"); esm.getHNT (params.mType, "TYPE");
@ -71,7 +73,7 @@ namespace
while (esm.isNextSub("MGEF")) while (esm.isNextSub("MGEF"))
{ {
ESM::ActiveEffect effect; ActiveEffect effect;
esm.getHT(effect.mEffectId); esm.getHT(effect.mEffectId);
effect.mArg = -1; effect.mArg = -1;
esm.getHNOT(effect.mArg, "ARG_"); esm.getHNOT(effect.mArg, "ARG_");
@ -94,7 +96,7 @@ namespace
else else
esm.getHNT (effect.mTimeLeft, "LEFT"); esm.getHNT (effect.mTimeLeft, "LEFT");
if (format < 17) if (format < 17)
effect.mFlags = ESM::ActiveEffect::Flag_None; effect.mFlags = ActiveEffect::Flag_None;
else else
esm.getHNT (effect.mFlags, "FLAG"); esm.getHNT (effect.mFlags, "FLAG");
@ -104,19 +106,19 @@ namespace
} }
} }
} }
}
namespace ESM namespace ESM
{ {
void ActiveSpells::save(ESMWriter &esm) const void ActiveSpells::save(ESMWriter &esm) const
{ {
::save(esm, mSpells, "ID__"); saveImpl(esm, mSpells, "ID__");
::save(esm, mQueue, "QID_"); saveImpl(esm, mQueue, "QID_");
} }
void ActiveSpells::load(ESMReader &esm) void ActiveSpells::load(ESMReader &esm)
{ {
::load(esm, mSpells, "ID__"); loadImpl(esm, mSpells, "ID__");
::load(esm, mQueue, "QID_"); loadImpl(esm, mQueue, "QID_");
} }
} }

@ -65,7 +65,7 @@ namespace ESM
case AI_Escort: case AI_Escort:
case AI_Follow: { case AI_Follow: {
const ESM::NAME name = (it->mType == AI_Escort) ? ESM::NAME("AI_E") : ESM::NAME("AI_F"); const NAME name = (it->mType == AI_Escort) ? NAME("AI_E") : NAME("AI_F");
esm.writeHNT(name, it->mTarget, sizeof(it->mTarget)); esm.writeHNT(name, it->mTarget, sizeof(it->mTarget));
esm.writeHNOCString("CNDT", it->mCellName); esm.writeHNOCString("CNDT", it->mCellName);
break; break;

@ -22,13 +22,13 @@ namespace ESM
enum AiPackages enum AiPackages
{ {
Ai_Wander = ESM::fourCC("WAND"), Ai_Wander = fourCC("WAND"),
Ai_Travel = ESM::fourCC("TRAV"), Ai_Travel = fourCC("TRAV"),
Ai_Escort = ESM::fourCC("ESCO"), Ai_Escort = fourCC("ESCO"),
Ai_Follow = ESM::fourCC("FOLL"), Ai_Follow = fourCC("FOLL"),
Ai_Activate = ESM::fourCC("ACTI"), Ai_Activate = fourCC("ACTI"),
Ai_Combat = ESM::fourCC("COMB"), Ai_Combat = fourCC("COMB"),
Ai_Pursue = ESM::fourCC("PURS") Ai_Pursue = fourCC("PURS")
}; };
@ -67,10 +67,10 @@ namespace ESM
struct AiWander : AiPackage struct AiWander : AiPackage
{ {
AiWanderData mData; AiWanderData mData;
AiWanderDuration mDurationData; // was ESM::TimeStamp mStartTime AiWanderDuration mDurationData; // was TimeStamp mStartTime
bool mStoredInitialActorPosition; bool mStoredInitialActorPosition;
ESM::Vector3 mInitialActorPosition; Vector3 mInitialActorPosition;
/// \todo add more AiWander state /// \todo add more AiWander state

@ -3,9 +3,12 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
const std::string ESM::CellId::sDefaultWorldspace = "sys::default"; namespace ESM
{
const std::string CellId::sDefaultWorldspace = "sys::default";
void ESM::CellId::load (ESMReader &esm) void CellId::load (ESMReader &esm)
{ {
mWorldspace = esm.getHNString ("SPAC"); mWorldspace = esm.getHNString ("SPAC");
@ -18,7 +21,7 @@ void ESM::CellId::load (ESMReader &esm)
mPaged = false; mPaged = false;
} }
void ESM::CellId::save (ESMWriter &esm) const void CellId::save (ESMWriter &esm) const
{ {
esm.writeHNString ("SPAC", mWorldspace); esm.writeHNString ("SPAC", mWorldspace);
@ -26,18 +29,18 @@ void ESM::CellId::save (ESMWriter &esm) const
esm.writeHNT ("CIDX", mIndex, 8); esm.writeHNT ("CIDX", mIndex, 8);
} }
bool ESM::operator== (const CellId& left, const CellId& right) bool operator== (const CellId& left, const CellId& right)
{ {
return left.mWorldspace==right.mWorldspace && left.mPaged==right.mPaged && return left.mWorldspace==right.mWorldspace && left.mPaged==right.mPaged &&
(!left.mPaged || (left.mIndex.mX==right.mIndex.mX && left.mIndex.mY==right.mIndex.mY)); (!left.mPaged || (left.mIndex.mX==right.mIndex.mX && left.mIndex.mY==right.mIndex.mY));
} }
bool ESM::operator!= (const CellId& left, const CellId& right) bool operator!= (const CellId& left, const CellId& right)
{ {
return !(left==right); return !(left==right);
} }
bool ESM::operator < (const CellId& left, const CellId& right) bool operator < (const CellId& left, const CellId& right)
{ {
if (left.mPaged < right.mPaged) if (left.mPaged < right.mPaged)
return true; return true;
@ -59,3 +62,5 @@ bool ESM::operator < (const CellId& left, const CellId& right)
return left.mWorldspace < right.mWorldspace; return left.mWorldspace < right.mWorldspace;
} }
}

@ -63,67 +63,67 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::fourCC("UNAM"): case fourCC("UNAM"):
getHTOrSkip(cellRef.mReferenceBlocked); getHTOrSkip(cellRef.mReferenceBlocked);
break; break;
case ESM::fourCC("XSCL"): case fourCC("XSCL"):
getHTOrSkip(cellRef.mScale); getHTOrSkip(cellRef.mScale);
if constexpr (load) if constexpr (load)
cellRef.mScale = std::clamp(cellRef.mScale, 0.5f, 2.0f); cellRef.mScale = std::clamp(cellRef.mScale, 0.5f, 2.0f);
break; break;
case ESM::fourCC("ANAM"): case fourCC("ANAM"):
getHStringOrSkip(cellRef.mOwner); getHStringOrSkip(cellRef.mOwner);
break; break;
case ESM::fourCC("BNAM"): case fourCC("BNAM"):
getHStringOrSkip(cellRef.mGlobalVariable); getHStringOrSkip(cellRef.mGlobalVariable);
break; break;
case ESM::fourCC("XSOL"): case fourCC("XSOL"):
getHStringOrSkip(cellRef.mSoul); getHStringOrSkip(cellRef.mSoul);
break; break;
case ESM::fourCC("CNAM"): case fourCC("CNAM"):
getHStringOrSkip(cellRef.mFaction); getHStringOrSkip(cellRef.mFaction);
break; break;
case ESM::fourCC("INDX"): case fourCC("INDX"):
getHTOrSkip(cellRef.mFactionRank); getHTOrSkip(cellRef.mFactionRank);
break; break;
case ESM::fourCC("XCHG"): case fourCC("XCHG"):
getHTOrSkip(cellRef.mEnchantmentCharge); getHTOrSkip(cellRef.mEnchantmentCharge);
break; break;
case ESM::fourCC("INTV"): case fourCC("INTV"):
getHTOrSkip(cellRef.mChargeInt); getHTOrSkip(cellRef.mChargeInt);
break; break;
case ESM::fourCC("NAM9"): case fourCC("NAM9"):
getHTOrSkip(cellRef.mGoldValue); getHTOrSkip(cellRef.mGoldValue);
break; break;
case ESM::fourCC("DODT"): case fourCC("DODT"):
getHTOrSkip(cellRef.mDoorDest); getHTOrSkip(cellRef.mDoorDest);
if constexpr (load) if constexpr (load)
cellRef.mTeleport = true; cellRef.mTeleport = true;
break; break;
case ESM::fourCC("DNAM"): case fourCC("DNAM"):
getHStringOrSkip(cellRef.mDestCell); getHStringOrSkip(cellRef.mDestCell);
break; break;
case ESM::fourCC("FLTV"): case fourCC("FLTV"):
getHTOrSkip(cellRef.mLockLevel); getHTOrSkip(cellRef.mLockLevel);
break; break;
case ESM::fourCC("KNAM"): case fourCC("KNAM"):
getHStringOrSkip(cellRef.mKey); getHStringOrSkip(cellRef.mKey);
break; break;
case ESM::fourCC("TNAM"): case fourCC("TNAM"):
getHStringOrSkip(cellRef.mTrap); getHStringOrSkip(cellRef.mTrap);
break; break;
case ESM::fourCC("DATA"): case fourCC("DATA"):
if constexpr (load) if constexpr (load)
esm.getHTSized<24>(cellRef.mPos); esm.getHTSized<24>(cellRef.mPos);
else else
esm.skipHTSized<24, decltype(cellRef.mPos)>(); esm.skipHTSized<24, decltype(cellRef.mPos)>();
break; break;
case ESM::fourCC("NAM0"): case fourCC("NAM0"):
{ {
esm.skipHSub(); esm.skipHSub();
break; break;
} }
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
if constexpr (load) if constexpr (load)
isDeleted = true; isDeleted = true;
@ -145,9 +145,8 @@ namespace ESM
} }
} }
} }
}
void ESM::RefNum::load(ESMReader& esm, bool wide, ESM::NAME tag) void RefNum::load(ESMReader& esm, bool wide, NAME tag)
{ {
if (wide) if (wide)
esm.getHNTSized<8>(*this, tag); esm.getHNTSized<8>(*this, tag);
@ -155,7 +154,7 @@ void ESM::RefNum::load(ESMReader& esm, bool wide, ESM::NAME tag)
esm.getHNT(mIndex, tag); esm.getHNT(mIndex, tag);
} }
void ESM::RefNum::save(ESMWriter &esm, bool wide, ESM::NAME tag) const void RefNum::save(ESMWriter &esm, bool wide, NAME tag) const
{ {
if (wide) if (wide)
esm.writeHNT (tag, *this, 8); esm.writeHNT (tag, *this, 8);
@ -168,23 +167,23 @@ void ESM::RefNum::save(ESMWriter &esm, bool wide, ESM::NAME tag) const
} }
} }
void ESM::CellRef::load (ESMReader& esm, bool &isDeleted, bool wideRefNum) void CellRef::load (ESMReader& esm, bool &isDeleted, bool wideRefNum)
{ {
loadId(esm, wideRefNum); loadId(esm, wideRefNum);
loadData(esm, isDeleted); loadData(esm, isDeleted);
} }
void ESM::CellRef::loadId (ESMReader& esm, bool wideRefNum) void CellRef::loadId (ESMReader& esm, bool wideRefNum)
{ {
loadIdImpl<true>(esm, wideRefNum, *this); loadIdImpl<true>(esm, wideRefNum, *this);
} }
void ESM::CellRef::loadData(ESMReader &esm, bool &isDeleted) void CellRef::loadData(ESMReader &esm, bool &isDeleted)
{ {
loadDataImpl<true>(esm, isDeleted, *this); loadDataImpl<true>(esm, isDeleted, *this);
} }
void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory, bool isDeleted) const void CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory, bool isDeleted) const
{ {
mRefNum.save (esm, wideRefNum); mRefNum.save (esm, wideRefNum);
@ -246,7 +245,7 @@ void ESM::CellRef::save (ESMWriter &esm, bool wideRefNum, bool inInventory, bool
esm.writeHNT("DATA", mPos, 24); esm.writeHNT("DATA", mPos, 24);
} }
void ESM::CellRef::blank() void CellRef::blank()
{ {
mRefNum.unset(); mRefNum.unset();
mRefID.clear(); mRefID.clear();
@ -276,10 +275,12 @@ void ESM::CellRef::blank()
} }
} }
void ESM::skipLoadCellRef(ESMReader& esm, bool wideRefNum) void skipLoadCellRef(ESMReader& esm, bool wideRefNum)
{ {
CellRef cellRef; CellRef cellRef;
loadIdImpl<false>(esm, wideRefNum, cellRef); loadIdImpl<false>(esm, wideRefNum, cellRef);
bool isDeleted; bool isDeleted;
loadDataImpl<false>(esm, isDeleted, cellRef); loadDataImpl<false>(esm, isDeleted, cellRef);
} }
}

@ -19,9 +19,9 @@ namespace ESM
unsigned int mIndex; unsigned int mIndex;
int mContentFile; int mContentFile;
void load(ESMReader& esm, bool wide = false, ESM::NAME tag = "FRMR"); void load(ESMReader& esm, bool wide = false, NAME tag = "FRMR");
void save(ESMWriter &esm, bool wide = false, ESM::NAME tag = "FRMR") const; void save(ESMWriter &esm, bool wide = false, NAME tag = "FRMR") const;
inline bool hasContentFile() const { return mContentFile >= 0; } inline bool hasContentFile() const { return mContentFile >= 0; }

@ -3,7 +3,10 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
void ESM::CellState::load (ESMReader &esm) namespace ESM
{
void CellState::load (ESMReader &esm)
{ {
mWaterLevel = 0; mWaterLevel = 0;
esm.getHNOT (mWaterLevel, "WLVL"); esm.getHNOT (mWaterLevel, "WLVL");
@ -16,7 +19,7 @@ void ESM::CellState::load (ESMReader &esm)
esm.getHNOT (mLastRespawn, "RESP"); esm.getHNOT (mLastRespawn, "RESP");
} }
void ESM::CellState::save (ESMWriter &esm) const void CellState::save (ESMWriter &esm) const
{ {
if (!mId.mPaged) if (!mId.mPaged)
esm.writeHNT ("WLVL", mWaterLevel); esm.writeHNT ("WLVL", mWaterLevel);
@ -25,3 +28,5 @@ void ESM::CellState::save (ESMWriter &esm) const
esm.writeHNT ("RESP", mLastRespawn); esm.writeHNT ("RESP", mLastRespawn);
} }
}

@ -21,7 +21,7 @@ namespace ESM
int mHasFogOfWar; // Do we have fog of war state (0 or 1)? (see fogstate.hpp) int mHasFogOfWar; // Do we have fog of war state (0 or 1)? (see fogstate.hpp)
ESM::TimeStamp mLastRespawn; TimeStamp mLastRespawn;
void load (ESMReader &esm); void load (ESMReader &esm);
void save (ESMWriter &esm) const; void save (ESMWriter &esm) const;

@ -1,15 +1,20 @@
#include "containerstate.hpp" #include "containerstate.hpp"
void ESM::ContainerState::load (ESMReader &esm) namespace ESM
{
void ContainerState::load (ESMReader &esm)
{ {
ObjectState::load (esm); ObjectState::load (esm);
mInventory.load (esm); mInventory.load (esm);
} }
void ESM::ContainerState::save (ESMWriter &esm, bool inInventory) const void ContainerState::save (ESMWriter &esm, bool inInventory) const
{ {
ObjectState::save (esm, inInventory); ObjectState::save (esm, inInventory);
mInventory.save (esm); mInventory.save (esm);
} }
}

@ -3,7 +3,10 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
ESM::ControlsState::ControlsState() namespace ESM
{
ControlsState::ControlsState()
: mViewSwitchDisabled(false), : mViewSwitchDisabled(false),
mControlsDisabled(false), mControlsDisabled(false),
mJumpingDisabled(false), mJumpingDisabled(false),
@ -14,7 +17,7 @@ ESM::ControlsState::ControlsState()
{ {
} }
void ESM::ControlsState::load(ESM::ESMReader& esm) void ControlsState::load(ESMReader& esm)
{ {
int flags; int flags;
esm.getHNT(flags, "CFLG"); esm.getHNT(flags, "CFLG");
@ -28,7 +31,7 @@ void ESM::ControlsState::load(ESM::ESMReader& esm)
mSpellDrawingDisabled = flags & SpellDrawingDisabled; mSpellDrawingDisabled = flags & SpellDrawingDisabled;
} }
void ESM::ControlsState::save(ESM::ESMWriter& esm) const void ControlsState::save(ESMWriter& esm) const
{ {
int flags = 0; int flags = 0;
if (mViewSwitchDisabled) flags |= ViewSwitchDisabled; if (mViewSwitchDisabled) flags |= ViewSwitchDisabled;
@ -41,3 +44,5 @@ void ESM::ControlsState::save(ESM::ESMWriter& esm) const
esm.writeHNT("CFLG", flags); esm.writeHNT("CFLG", flags);
} }
}

@ -1,6 +1,9 @@
#include "creaturestate.hpp" #include "creaturestate.hpp"
void ESM::CreatureState::load (ESMReader &esm) namespace ESM
{
void CreatureState::load (ESMReader &esm)
{ {
ObjectState::load (esm); ObjectState::load (esm);
@ -12,7 +15,7 @@ void ESM::CreatureState::load (ESMReader &esm)
} }
} }
void ESM::CreatureState::save (ESMWriter &esm, bool inInventory) const void CreatureState::save (ESMWriter &esm, bool inInventory) const
{ {
ObjectState::save (esm, inInventory); ObjectState::save (esm, inInventory);
@ -24,8 +27,10 @@ void ESM::CreatureState::save (ESMWriter &esm, bool inInventory) const
} }
} }
void ESM::CreatureState::blank() void CreatureState::blank()
{ {
ObjectState::blank(); ObjectState::blank();
mCreatureStats.blank(); mCreatureStats.blank();
} }
}

@ -4,7 +4,10 @@
#include <limits> #include <limits>
void ESM::CreatureStats::load (ESMReader &esm) namespace ESM
{
void CreatureStats::load (ESMReader &esm)
{ {
bool intFallback = esm.getFormat() < 11; bool intFallback = esm.getFormat() < 11;
for (int i=0; i<8; ++i) for (int i=0; i<8; ++i)
@ -174,7 +177,7 @@ void ESM::CreatureStats::load (ESMReader &esm)
} }
} }
void ESM::CreatureStats::save (ESMWriter &esm) const void CreatureStats::save (ESMWriter &esm) const
{ {
for (int i=0; i<8; ++i) for (int i=0; i<8; ++i)
mAttributes[i].save (esm); mAttributes[i].save (esm);
@ -259,7 +262,7 @@ void ESM::CreatureStats::save (ESMWriter &esm) const
esm.writeHNT("NOAC", mMissingACDT); esm.writeHNT("NOAC", mMissingACDT);
} }
void ESM::CreatureStats::blank() void CreatureStats::blank()
{ {
mTradeTime.mHour = 0; mTradeTime.mHour = 0;
mTradeTime.mDay = 0; mTradeTime.mDay = 0;
@ -287,3 +290,5 @@ void ESM::CreatureStats::blank()
mCorprusSpells.clear(); mCorprusSpells.clear();
mMissingACDT = false; mMissingACDT = false;
} }
}

@ -43,7 +43,7 @@ namespace ESM
std::multimap<int, int> mSummonedCreatures; std::multimap<int, int> mSummonedCreatures;
std::vector<int> mSummonGraveyard; std::vector<int> mSummonGraveyard;
ESM::TimeStamp mTradeTime; TimeStamp mTradeTime;
int mGoldPool; int mGoldPool;
int mActorId; int mActorId;
//int mHitAttemptActorId; //int mHitAttemptActorId;
@ -83,7 +83,7 @@ namespace ESM
bool mRecalcDynamicStats; bool mRecalcDynamicStats;
int mDrawState; int mDrawState;
signed char mDeathAnimation; signed char mDeathAnimation;
ESM::TimeStamp mTimeOfDeath; TimeStamp mTimeOfDeath;
int mLevel; int mLevel;
bool mMissingACDT; bool mMissingACDT;

@ -6,7 +6,7 @@
namespace ESM namespace ESM
{ {
void CustomMarker::save(ESM::ESMWriter &esm) const void CustomMarker::save(ESMWriter &esm) const
{ {
esm.writeHNT("POSX", mWorldX); esm.writeHNT("POSX", mWorldX);
esm.writeHNT("POSY", mWorldY); esm.writeHNT("POSY", mWorldY);
@ -15,7 +15,7 @@ void CustomMarker::save(ESM::ESMWriter &esm) const
esm.writeHNString("NOTE", mNote); esm.writeHNString("NOTE", mNote);
} }
void CustomMarker::load(ESM::ESMReader &esm) void CustomMarker::load(ESMReader &esm)
{ {
esm.getHNT(mWorldX, "POSX"); esm.getHNT(mWorldX, "POSX");
esm.getHNT(mWorldY, "POSY"); esm.getHNT(mWorldY, "POSY");

@ -12,7 +12,7 @@ struct CustomMarker
float mWorldX; float mWorldX;
float mWorldY; float mWorldY;
ESM::CellId mCell; CellId mCell;
std::string mNote; std::string mNote;
@ -21,8 +21,8 @@ struct CustomMarker
return mNote == other.mNote && mCell == other.mCell && mWorldX == other.mWorldX && mWorldY == other.mWorldY; return mNote == other.mNote && mCell == other.mCell && mWorldX == other.mWorldX && mWorldY == other.mWorldY;
} }
void load (ESM::ESMReader& reader); void load (ESMReader& reader);
void save (ESM::ESMWriter& writer) const; void save (ESMWriter& writer) const;
}; };
} }

@ -4,9 +4,12 @@
#include "esmwriter.hpp" #include "esmwriter.hpp"
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
unsigned int ESM::DebugProfile::sRecordId = REC_DBGP; namespace ESM
{
unsigned int DebugProfile::sRecordId = REC_DBGP;
void ESM::DebugProfile::load (ESMReader& esm, bool &isDeleted) void DebugProfile::load (ESMReader& esm, bool &isDeleted)
{ {
isDeleted = false; isDeleted = false;
mRecordFlags = esm.getRecordFlags(); mRecordFlags = esm.getRecordFlags();
@ -16,19 +19,19 @@ void ESM::DebugProfile::load (ESMReader& esm, bool &isDeleted)
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
break; break;
case ESM::fourCC("DESC"): case fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
case ESM::fourCC("SCRP"): case fourCC("SCRP"):
mScriptText = esm.getHString(); mScriptText = esm.getHString();
break; break;
case ESM::fourCC("FLAG"): case fourCC("FLAG"):
esm.getHT(mFlags); esm.getHT(mFlags);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;
@ -39,7 +42,7 @@ void ESM::DebugProfile::load (ESMReader& esm, bool &isDeleted)
} }
} }
void ESM::DebugProfile::save (ESMWriter& esm, bool isDeleted) const void DebugProfile::save (ESMWriter& esm, bool isDeleted) const
{ {
esm.writeHNCString ("NAME", mId); esm.writeHNCString ("NAME", mId);
@ -54,9 +57,11 @@ void ESM::DebugProfile::save (ESMWriter& esm, bool isDeleted) const
esm.writeHNT ("FLAG", mFlags); esm.writeHNT ("FLAG", mFlags);
} }
void ESM::DebugProfile::blank() void DebugProfile::blank()
{ {
mDescription.clear(); mDescription.clear();
mScriptText.clear(); mScriptText.clear();
mFlags = 0; mFlags = 0;
} }
}

@ -3,7 +3,10 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
void ESM::DialogueState::load (ESMReader &esm) namespace ESM
{
void DialogueState::load (ESMReader &esm)
{ {
while (esm.isNextSub ("TOPI")) while (esm.isNextSub ("TOPI"))
mKnownTopics.push_back (esm.getHString()); mKnownTopics.push_back (esm.getHString());
@ -30,7 +33,7 @@ void ESM::DialogueState::load (ESMReader &esm)
} }
} }
void ESM::DialogueState::save (ESMWriter &esm) const void DialogueState::save (ESMWriter &esm) const
{ {
for (std::vector<std::string>::const_iterator iter (mKnownTopics.begin()); for (std::vector<std::string>::const_iterator iter (mKnownTopics.begin());
iter!=mKnownTopics.end(); ++iter) iter!=mKnownTopics.end(); ++iter)
@ -51,3 +54,5 @@ void ESM::DialogueState::save (ESMWriter &esm) const
} }
} }
} }
}

@ -3,7 +3,8 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
namespace ESM { namespace ESM
{
void EffectList::load(ESMReader &esm) void EffectList::load(ESMReader &esm)
{ {

@ -13,7 +13,8 @@
#include "components/esm/esmcommon.hpp" #include "components/esm/esmcommon.hpp"
#include "loadtes3.hpp" #include "loadtes3.hpp"
namespace ESM { namespace ESM
{
class ESMReader class ESMReader
{ {

@ -86,7 +86,7 @@ namespace ESM
throw std::runtime_error ("Unclosed record remaining"); throw std::runtime_error ("Unclosed record remaining");
} }
void ESMWriter::startRecord(ESM::NAME name, uint32_t flags) void ESMWriter::startRecord(NAME name, uint32_t flags)
{ {
mRecordCount++; mRecordCount++;
@ -105,10 +105,10 @@ namespace ESM
void ESMWriter::startRecord (uint32_t name, uint32_t flags) void ESMWriter::startRecord (uint32_t name, uint32_t flags)
{ {
startRecord(ESM::NAME(name), flags); startRecord(NAME(name), flags);
} }
void ESMWriter::startSubRecord(ESM::NAME name) void ESMWriter::startSubRecord(NAME name)
{ {
// Sub-record hierarchies are not properly supported in ESMReader. This should be fixed later. // Sub-record hierarchies are not properly supported in ESMReader. This should be fixed later.
assert (mRecords.size() <= 1); assert (mRecords.size() <= 1);
@ -124,7 +124,7 @@ namespace ESM
assert(mRecords.back().size == 0); assert(mRecords.back().size == 0);
} }
void ESMWriter::endRecord(ESM::NAME name) void ESMWriter::endRecord(NAME name)
{ {
RecordData rec = mRecords.back(); RecordData rec = mRecords.back();
assert(rec.name == name); assert(rec.name == name);
@ -142,17 +142,17 @@ namespace ESM
void ESMWriter::endRecord (uint32_t name) void ESMWriter::endRecord (uint32_t name)
{ {
endRecord(ESM::NAME(name)); endRecord(NAME(name));
} }
void ESMWriter::writeHNString(ESM::NAME name, const std::string& data) void ESMWriter::writeHNString(NAME name, const std::string& data)
{ {
startSubRecord(name); startSubRecord(name);
writeHString(data); writeHString(data);
endRecord(name); endRecord(name);
} }
void ESMWriter::writeHNString(ESM::NAME name, const std::string& data, size_t size) void ESMWriter::writeHNString(NAME name, const std::string& data, size_t size)
{ {
assert(data.size() <= size); assert(data.size() <= size);
startSubRecord(name); startSubRecord(name);
@ -196,9 +196,9 @@ namespace ESM
write("\0", 1); write("\0", 1);
} }
void ESMWriter::writeName(ESM::NAME name) void ESMWriter::writeName(NAME name)
{ {
write(name.mData, ESM::NAME::sCapacity); write(name.mData, NAME::sCapacity);
} }
void ESMWriter::write(const char* data, size_t size) void ESMWriter::write(const char* data, size_t size)

@ -13,13 +13,14 @@ namespace ToUTF8
class Utf8Encoder; class Utf8Encoder;
} }
namespace ESM { namespace ESM
{
class ESMWriter class ESMWriter
{ {
struct RecordData struct RecordData
{ {
ESM::NAME name; NAME name;
std::streampos position; std::streampos position;
uint32_t size; uint32_t size;
}; };
@ -30,7 +31,7 @@ class ESMWriter
unsigned int getVersion() const; unsigned int getVersion() const;
// Set various header data (ESM::Header::Data). All of the below functions must be called before writing, // Set various header data (Header::Data). All of the below functions must be called before writing,
// otherwise this data will be left uninitialized. // otherwise this data will be left uninitialized.
void setVersion(unsigned int ver = 0x3fa66666); void setVersion(unsigned int ver = 0x3fa66666);
void setType(int type); void setType(int type);
@ -56,27 +57,27 @@ class ESMWriter
void close(); void close();
///< \note Does not close the stream. ///< \note Does not close the stream.
void writeHNString(ESM::NAME name, const std::string& data); void writeHNString(NAME name, const std::string& data);
void writeHNString(ESM::NAME name, const std::string& data, size_t size); void writeHNString(NAME name, const std::string& data, size_t size);
void writeHNCString(ESM::NAME name, const std::string& data) void writeHNCString(NAME name, const std::string& data)
{ {
startSubRecord(name); startSubRecord(name);
writeHCString(data); writeHCString(data);
endRecord(name); endRecord(name);
} }
void writeHNOString(ESM::NAME name, const std::string& data) void writeHNOString(NAME name, const std::string& data)
{ {
if (!data.empty()) if (!data.empty())
writeHNString(name, data); writeHNString(name, data);
} }
void writeHNOCString(ESM::NAME name, const std::string& data) void writeHNOCString(NAME name, const std::string& data)
{ {
if (!data.empty()) if (!data.empty())
writeHNCString(name, data); writeHNCString(name, data);
} }
template<typename T> template<typename T>
void writeHNT(ESM::NAME name, const T& data) void writeHNT(NAME name, const T& data)
{ {
startSubRecord(name); startSubRecord(name);
writeT(data); writeT(data);
@ -84,7 +85,7 @@ class ESMWriter
} }
template<typename T, std::size_t size> template<typename T, std::size_t size>
void writeHNT(ESM::NAME name, const T (&data)[size]) void writeHNT(NAME name, const T (&data)[size])
{ {
startSubRecord(name); startSubRecord(name);
writeT(data); writeT(data);
@ -94,15 +95,15 @@ class ESMWriter
// Prevent using writeHNT with strings. This already happened by accident and results in // Prevent using writeHNT with strings. This already happened by accident and results in
// state being discarded without any error on writing or reading it. :( // state being discarded without any error on writing or reading it. :(
// writeHNString and friends must be used instead. // writeHNString and friends must be used instead.
void writeHNT(ESM::NAME name, const std::string& data) = delete; void writeHNT(NAME name, const std::string& data) = delete;
void writeT(ESM::NAME data) = delete; void writeT(NAME data) = delete;
template<typename T, std::size_t size> template<typename T, std::size_t size>
void writeHNT(ESM::NAME name, const T (&data)[size], int) = delete; void writeHNT(NAME name, const T (&data)[size], int) = delete;
template<typename T> template<typename T>
void writeHNT(ESM::NAME name, const T& data, int size) void writeHNT(NAME name, const T& data, int size)
{ {
startSubRecord(name); startSubRecord(name);
writeT(data, size); writeT(data, size);
@ -129,16 +130,16 @@ class ESMWriter
write((char*)&data, size); write((char*)&data, size);
} }
void startRecord(ESM::NAME name, uint32_t flags = 0); void startRecord(NAME name, uint32_t flags = 0);
void startRecord(uint32_t name, uint32_t flags = 0); void startRecord(uint32_t name, uint32_t flags = 0);
/// @note Sub-record hierarchies are not properly supported in ESMReader. This should be fixed later. /// @note Sub-record hierarchies are not properly supported in ESMReader. This should be fixed later.
void startSubRecord(ESM::NAME name); void startSubRecord(NAME name);
void endRecord(ESM::NAME name); void endRecord(NAME name);
void endRecord(uint32_t name); void endRecord(uint32_t name);
void writeFixedSizeString(const std::string& data, int size); void writeFixedSizeString(const std::string& data, int size);
void writeHString(const std::string& data); void writeHString(const std::string& data);
void writeHCString(const std::string& data); void writeHCString(const std::string& data);
void writeName(ESM::NAME data); void writeName(NAME data);
void write(const char* data, size_t size); void write(const char* data, size_t size);
private: private:

@ -4,9 +4,12 @@
#include "esmwriter.hpp" #include "esmwriter.hpp"
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
unsigned int ESM::Filter::sRecordId = REC_FILT; namespace ESM
{
unsigned int Filter::sRecordId = REC_FILT;
void ESM::Filter::load (ESMReader& esm, bool &isDeleted) void Filter::load (ESMReader& esm, bool &isDeleted)
{ {
isDeleted = false; isDeleted = false;
mRecordFlags = esm.getRecordFlags(); mRecordFlags = esm.getRecordFlags();
@ -17,16 +20,16 @@ void ESM::Filter::load (ESMReader& esm, bool &isDeleted)
uint32_t name = esm.retSubName().toInt(); uint32_t name = esm.retSubName().toInt();
switch (name) switch (name)
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
break; break;
case ESM::fourCC("FILT"): case fourCC("FILT"):
mFilter = esm.getHString(); mFilter = esm.getHString();
break; break;
case ESM::fourCC("DESC"): case fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;
@ -37,7 +40,7 @@ void ESM::Filter::load (ESMReader& esm, bool &isDeleted)
} }
} }
void ESM::Filter::save (ESMWriter& esm, bool isDeleted) const void Filter::save (ESMWriter& esm, bool isDeleted) const
{ {
esm.writeHNCString ("NAME", mId); esm.writeHNCString ("NAME", mId);
@ -51,8 +54,10 @@ void ESM::Filter::save (ESMWriter& esm, bool isDeleted) const
esm.writeHNCString ("DESC", mDescription); esm.writeHNCString ("DESC", mDescription);
} }
void ESM::Filter::blank() void Filter::blank()
{ {
mFilter.clear(); mFilter.clear();
mDescription.clear(); mDescription.clear();
} }
}

@ -10,6 +10,10 @@
#include "savedgame.hpp" #include "savedgame.hpp"
namespace ESM
{
namespace
{
void convertFogOfWar(std::vector<char>& imageData) void convertFogOfWar(std::vector<char>& imageData)
{ {
if (imageData.empty()) if (imageData.empty())
@ -52,7 +56,9 @@ void convertFogOfWar(std::vector<char>& imageData)
imageData = std::vector<char>(str.begin(), str.end()); imageData = std::vector<char>(str.begin(), str.end());
} }
void ESM::FogState::load (ESMReader &esm) }
void FogState::load (ESMReader &esm)
{ {
esm.getHNOT(mBounds, "BOUN"); esm.getHNOT(mBounds, "BOUN");
esm.getHNOT(mNorthMarkerAngle, "ANGL"); esm.getHNOT(mNorthMarkerAngle, "ANGL");
@ -76,7 +82,7 @@ void ESM::FogState::load (ESMReader &esm)
} }
} }
void ESM::FogState::save (ESMWriter &esm, bool interiorCell) const void FogState::save (ESMWriter &esm, bool interiorCell) const
{ {
if (interiorCell) if (interiorCell)
{ {
@ -92,3 +98,5 @@ void ESM::FogState::save (ESMWriter &esm, bool interiorCell) const
esm.endRecord("FTEX"); esm.endRecord("FTEX");
} }
} }
}

@ -4,9 +4,12 @@
#include "esmwriter.hpp" #include "esmwriter.hpp"
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
unsigned int ESM::GlobalMap::sRecordId = ESM::REC_GMAP; namespace ESM
{
unsigned int GlobalMap::sRecordId = REC_GMAP;
void ESM::GlobalMap::load (ESMReader &esm) void GlobalMap::load (ESMReader &esm)
{ {
esm.getHNT(mBounds, "BNDS"); esm.getHNT(mBounds, "BNDS");
@ -25,7 +28,7 @@ void ESM::GlobalMap::load (ESMReader &esm)
} }
} }
void ESM::GlobalMap::save (ESMWriter &esm) const void GlobalMap::save (ESMWriter &esm) const
{ {
esm.writeHNT("BNDS", mBounds); esm.writeHNT("BNDS", mBounds);
@ -41,3 +44,5 @@ void ESM::GlobalMap::save (ESMWriter &esm) const
esm.endRecord("MRK_"); esm.endRecord("MRK_");
} }
} }
}

@ -3,7 +3,10 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
void ESM::GlobalScript::load (ESMReader &esm) namespace ESM
{
void GlobalScript::load (ESMReader &esm)
{ {
mId = esm.getHNString ("NAME"); mId = esm.getHNString ("NAME");
@ -18,7 +21,7 @@ void ESM::GlobalScript::load (ESMReader &esm)
mTargetRef.load(esm, true, "FRMR"); mTargetRef.load(esm, true, "FRMR");
} }
void ESM::GlobalScript::save (ESMWriter &esm) const void GlobalScript::save (ESMWriter &esm) const
{ {
esm.writeHNString ("NAME", mId); esm.writeHNString ("NAME", mId);
@ -34,3 +37,5 @@ void ESM::GlobalScript::save (ESMWriter &esm) const
mTargetRef.save (esm, true, "FRMR"); mTargetRef.save (esm, true, "FRMR");
} }
} }
}

@ -5,7 +5,10 @@
#include <components/misc/stringops.hpp> #include <components/misc/stringops.hpp>
void ESM::InventoryState::load (ESMReader &esm) namespace ESM
{
void InventoryState::load (ESMReader &esm)
{ {
// obsolete // obsolete
int index = 0; int index = 0;
@ -123,7 +126,7 @@ void ESM::InventoryState::load (ESMReader &esm)
} }
} }
void ESM::InventoryState::save (ESMWriter &esm) const void InventoryState::save (ESMWriter &esm) const
{ {
int itemsCount = static_cast<int>(mItems.size()); int itemsCount = static_cast<int>(mItems.size());
if (itemsCount > 0) if (itemsCount > 0)
@ -170,3 +173,5 @@ void ESM::InventoryState::save (ESMWriter &esm) const
if (mSelectedEnchantItem != -1) if (mSelectedEnchantItem != -1)
esm.writeHNT ("SELE", mSelectedEnchantItem); esm.writeHNT ("SELE", mSelectedEnchantItem);
} }
}

@ -3,7 +3,10 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
void ESM::JournalEntry::load (ESMReader &esm) namespace ESM
{
void JournalEntry::load (ESMReader &esm)
{ {
esm.getHNOT (mType, "JETY"); esm.getHNOT (mType, "JETY");
mTopic = esm.getHNString ("YETO"); mTopic = esm.getHNString ("YETO");
@ -20,7 +23,7 @@ void ESM::JournalEntry::load (ESMReader &esm)
mActorName = esm.getHNOString("ACT_"); mActorName = esm.getHNOString("ACT_");
} }
void ESM::JournalEntry::save (ESMWriter &esm) const void JournalEntry::save (ESMWriter &esm) const
{ {
esm.writeHNT ("JETY", mType); esm.writeHNT ("JETY", mType);
esm.writeHNString ("YETO", mTopic); esm.writeHNString ("YETO", mTopic);
@ -36,3 +39,5 @@ void ESM::JournalEntry::save (ESMWriter &esm) const
else if (mType==Type_Topic) else if (mType==Type_Topic)
esm.writeHNString ("ACT_", mActorName); esm.writeHNString ("ACT_", mActorName);
} }
}

@ -19,20 +19,20 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -22,30 +22,30 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("TEXT"): // not ITEX here for some reason case fourCC("TEXT"): // not ITEX here for some reason
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("ALDT"): case fourCC("ALDT"):
esm.getHTSized<12>(mData); esm.getHTSized<12>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("ENAM"): case fourCC("ENAM"):
mEffects.add(esm); mEffects.add(esm);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -20,27 +20,27 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("AADT"): case fourCC("AADT"):
esm.getHT(mData); esm.getHT(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -52,33 +52,33 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("AODT"): case fourCC("AODT"):
esm.getHTSized<24>(mData); esm.getHTSized<24>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::fourCC("ENAM"): case fourCC("ENAM"):
mEnchant = esm.getHString(); mEnchant = esm.getHString();
break; break;
case ESM::fourCC("INDX"): case fourCC("INDX"):
mParts.add(esm); mParts.add(esm);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -20,21 +20,21 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mRace = esm.getHString(); mRace = esm.getHString();
break; break;
case ESM::fourCC("BYDT"): case fourCC("BYDT"):
esm.getHTSized<4>(mData); esm.getHTSized<4>(mData);
hasData = true; hasData = true;
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -20,33 +20,33 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("BKDT"): case fourCC("BKDT"):
esm.getHTSized<20>(mData); esm.getHTSized<20>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::fourCC("ENAM"): case fourCC("ENAM"):
mEnchant = esm.getHString(); mEnchant = esm.getHString();
break; break;
case ESM::fourCC("TEXT"): case fourCC("TEXT"):
mText = esm.getHString(); mText = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -21,23 +21,23 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("TNAM"): case fourCC("TNAM"):
mTexture = esm.getHString(); mTexture = esm.getHString();
break; break;
case ESM::fourCC("DESC"): case fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
case ESM::fourCC("NPCS"): case fourCC("NPCS"):
mPowers.add(esm); mPowers.add(esm);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -14,10 +14,12 @@
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
#include "cellid.hpp" #include "cellid.hpp"
namespace ESM
{
namespace namespace
{ {
///< Translate 8bit/24bit code (stored in refNum.mIndex) into a proper refNum ///< Translate 8bit/24bit code (stored in refNum.mIndex) into a proper refNum
void adjustRefNum (ESM::RefNum& refNum, const ESM::ESMReader& reader) void adjustRefNum (RefNum& refNum, const ESMReader& reader)
{ {
unsigned int local = (refNum.mIndex & 0xff000000) >> 24; unsigned int local = (refNum.mIndex & 0xff000000) >> 24;
@ -37,6 +39,7 @@ namespace
} }
} }
} }
}
namespace ESM namespace ESM
{ {
@ -72,14 +75,14 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("DATA"): case fourCC("DATA"):
esm.getHTSized<12>(mData); esm.getHTSized<12>(mData);
hasData = true; hasData = true;
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;
@ -97,7 +100,7 @@ namespace ESM
if (mCellId.mPaged) if (mCellId.mPaged)
{ {
mCellId.mWorldspace = ESM::CellId::sDefaultWorldspace; mCellId.mWorldspace = CellId::sDefaultWorldspace;
mCellId.mIndex.mX = mData.mX; mCellId.mIndex.mX = mData.mX;
mCellId.mIndex.mY = mData.mY; mCellId.mIndex.mY = mData.mY;
} }
@ -119,13 +122,13 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::fourCC("INTV"): case fourCC("INTV"):
int waterl; int waterl;
esm.getHT(waterl); esm.getHT(waterl);
mWater = static_cast<float>(waterl); mWater = static_cast<float>(waterl);
mWaterInt = true; mWaterInt = true;
break; break;
case ESM::fourCC("WHGT"): case fourCC("WHGT"):
float waterLevel; float waterLevel;
esm.getHT(waterLevel); esm.getHT(waterLevel);
mWaterInt = false; mWaterInt = false;
@ -138,17 +141,17 @@ namespace ESM
else else
mWater = waterLevel; mWater = waterLevel;
break; break;
case ESM::fourCC("AMBI"): case fourCC("AMBI"):
esm.getHT(mAmbi); esm.getHT(mAmbi);
mHasAmbi = true; mHasAmbi = true;
break; break;
case ESM::fourCC("RGNN"): case fourCC("RGNN"):
mRegion = esm.getHString(); mRegion = esm.getHString();
break; break;
case ESM::fourCC("NAM5"): case fourCC("NAM5"):
esm.getHT(mMapColor); esm.getHT(mMapColor);
break; break;
case ESM::fourCC("NAM0"): case fourCC("NAM0"):
esm.getHT(mRefNumCounter); esm.getHT(mRefNumCounter);
break; break;
default: default:

@ -50,23 +50,23 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("CLDT"): case fourCC("CLDT"):
esm.getHTSized<60>(mData); esm.getHTSized<60>(mData);
if (mData.mIsPlayable > 1) if (mData.mIsPlayable > 1)
esm.fail("Unknown bool value"); esm.fail("Unknown bool value");
hasData = true; hasData = true;
break; break;
case ESM::fourCC("DESC"): case fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -22,33 +22,33 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("CTDT"): case fourCC("CTDT"):
esm.getHTSized<12>(mData); esm.getHTSized<12>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::fourCC("ENAM"): case fourCC("ENAM"):
mEnchant = esm.getHString(); mEnchant = esm.getHString();
break; break;
case ESM::fourCC("INDX"): case fourCC("INDX"):
mParts.add(esm); mParts.add(esm);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -44,21 +44,21 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("CNDT"): case fourCC("CNDT"):
esm.getHTSized<4>(mWeight); esm.getHTSized<4>(mWeight);
hasWeight = true; hasWeight = true;
break; break;
case ESM::fourCC("FLAG"): case fourCC("FLAG"):
esm.getHTSized<4>(mFlags); esm.getHTSized<4>(mFlags);
if (mFlags & 0xf4) if (mFlags & 0xf4)
esm.fail("Unknown flags"); esm.fail("Unknown flags");
@ -66,13 +66,13 @@ namespace ESM
esm.fail("Flag 8 not set"); esm.fail("Flag 8 not set");
hasFlags = true; hasFlags = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("NPCO"): case fourCC("NPCO"):
mInventory.add(esm); mInventory.add(esm);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -6,7 +6,8 @@
#include "esmwriter.hpp" #include "esmwriter.hpp"
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
namespace ESM { namespace ESM
{
unsigned int Creature::sRecordId = REC_CREA; unsigned int Creature::sRecordId = REC_CREA;
@ -33,47 +34,47 @@ namespace ESM {
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("CNAM"): case fourCC("CNAM"):
mOriginal = esm.getHString(); mOriginal = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("NPDT"): case fourCC("NPDT"):
esm.getHTSized<96>(mData); esm.getHTSized<96>(mData);
hasNpdt = true; hasNpdt = true;
break; break;
case ESM::fourCC("FLAG"): case fourCC("FLAG"):
int flags; int flags;
esm.getHT(flags); esm.getHT(flags);
mFlags = flags & 0xFF; mFlags = flags & 0xFF;
mBloodType = ((flags >> 8) & 0xFF) >> 2; mBloodType = ((flags >> 8) & 0xFF) >> 2;
hasFlags = true; hasFlags = true;
break; break;
case ESM::fourCC("XSCL"): case fourCC("XSCL"):
esm.getHT(mScale); esm.getHT(mScale);
break; break;
case ESM::fourCC("NPCO"): case fourCC("NPCO"):
mInventory.add(esm); mInventory.add(esm);
break; break;
case ESM::fourCC("NPCS"): case fourCC("NPCS"):
mSpells.add(esm); mSpells.add(esm);
break; break;
case ESM::fourCC("AIDT"): case fourCC("AIDT"):
esm.getHExact(&mAiData, sizeof(mAiData)); esm.getHExact(&mAiData, sizeof(mAiData));
break; break;
case ESM::fourCC("DODT"): case fourCC("DODT"):
case ESM::fourCC("DNAM"): case fourCC("DNAM"):
mTransport.add(esm); mTransport.add(esm);
break; break;
case AI_Wander: case AI_Wander:
@ -84,11 +85,11 @@ namespace ESM {
case AI_CNDT: case AI_CNDT:
mAiPackage.add(esm); mAiPackage.add(esm);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;
case ESM::fourCC("INDX"): case fourCC("INDX"):
// seems to occur only in .ESS files, unsure of purpose // seems to occur only in .ESS files, unsure of purpose
int index; int index;
esm.getHT(index); esm.getHT(index);

@ -30,7 +30,7 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::fourCC("DATA"): case fourCC("DATA"):
{ {
esm.getSubHeader(); esm.getSubHeader();
int size = esm.getSubSize(); int size = esm.getSubSize();
@ -44,7 +44,7 @@ namespace ESM
} }
break; break;
} }
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
mType = Unknown; mType = Unknown;
isDeleted = true; isDeleted = true;
@ -76,7 +76,7 @@ namespace ESM
void Dialogue::readInfo(ESMReader &esm, bool merge) void Dialogue::readInfo(ESMReader &esm, bool merge)
{ {
ESM::DialInfo info; DialInfo info;
bool isDeleted = false; bool isDeleted = false;
info.load(esm, isDeleted); info.load(esm, isDeleted);

@ -61,7 +61,7 @@ struct Dialogue
/// Read the next info record /// Read the next info record
/// @param merge Merge with existing list, or just push each record to the end of the list? /// @param merge Merge with existing list, or just push each record to the end of the list?
void readInfo (ESM::ESMReader& esm, bool merge); void readInfo (ESMReader& esm, bool merge);
void blank(); void blank();
///< Set record to default state (does not touch the ID and does not change the type). ///< Set record to default state (does not touch the ID and does not change the type).

@ -19,26 +19,26 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("SNAM"): case fourCC("SNAM"):
mOpenSound = esm.getHString(); mOpenSound = esm.getHString();
break; break;
case ESM::fourCC("ANAM"): case fourCC("ANAM"):
mCloseSound = esm.getHString(); mCloseSound = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -21,18 +21,18 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("ENDT"): case fourCC("ENDT"):
esm.getHTSized<16>(mData); esm.getHTSized<16>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("ENAM"): case fourCC("ENAM"):
mEffects.add(esm); mEffects.add(esm);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -43,25 +43,25 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("RNAM"): case fourCC("RNAM"):
if (rankCounter >= 10) if (rankCounter >= 10)
esm.fail("Rank out of range"); esm.fail("Rank out of range");
mRanks[rankCounter++] = esm.getHString(); mRanks[rankCounter++] = esm.getHString();
break; break;
case ESM::fourCC("FADT"): case fourCC("FADT"):
esm.getHTSized<240>(mData); esm.getHTSized<240>(mData);
if (mData.mIsHidden > 1) if (mData.mIsHidden > 1)
esm.fail("Unknown flag!"); esm.fail("Unknown flag!");
hasData = true; hasData = true;
break; break;
case ESM::fourCC("ANAM"): case fourCC("ANAM"):
{ {
std::string faction = esm.getHString(); std::string faction = esm.getHString();
int reaction; int reaction;
@ -69,7 +69,7 @@ namespace ESM
mReactions[faction] = reaction; mReactions[faction] = reaction;
break; break;
} }
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -45,7 +45,7 @@ struct Faction
RankData mRankData[10]; RankData mRankData[10];
int mSkills[7]; // IDs of skills this faction require int mSkills[7]; // IDs of skills this faction require
// Each element will either contain an ESM::Skill index, or -1. // Each element will either contain an Skill index, or -1.
int mIsHidden; // 1 - hidden from player int mIsHidden; // 1 - hidden from player

@ -22,7 +22,7 @@ namespace ESM
} }
else else
{ {
mValue.read (esm, ESM::Variant::Format_Global); mValue.read (esm, Variant::Format_Global);
} }
} }
@ -36,13 +36,13 @@ namespace ESM
} }
else else
{ {
mValue.write (esm, ESM::Variant::Format_Global); mValue.write (esm, Variant::Format_Global);
} }
} }
void Global::blank() void Global::blank()
{ {
mValue.setType (ESM::VT_None); mValue.setType (VT_None);
} }
bool operator== (const Global& left, const Global& right) bool operator== (const Global& left, const Global& right)

@ -14,18 +14,18 @@ namespace ESM
mRecordFlags = esm.getRecordFlags(); mRecordFlags = esm.getRecordFlags();
mId = esm.getHNString("NAME"); mId = esm.getHNString("NAME");
mValue.read (esm, ESM::Variant::Format_Gmst); mValue.read (esm, Variant::Format_Gmst);
} }
void GameSetting::save (ESMWriter &esm, bool /*isDeleted*/) const void GameSetting::save (ESMWriter &esm, bool /*isDeleted*/) const
{ {
esm.writeHNCString("NAME", mId); esm.writeHNCString("NAME", mId);
mValue.write (esm, ESM::Variant::Format_Gmst); mValue.write (esm, Variant::Format_Gmst);
} }
void GameSetting::blank() void GameSetting::blank()
{ {
mValue.setType (ESM::VT_None); mValue.setType (VT_None);
} }
bool operator== (const GameSetting& left, const GameSetting& right) bool operator== (const GameSetting& left, const GameSetting& right)

@ -25,19 +25,19 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::fourCC("DATA"): case fourCC("DATA"):
esm.getHTSized<12>(mData); esm.getHTSized<12>(mData);
break; break;
case ESM::fourCC("ONAM"): case fourCC("ONAM"):
mActor = esm.getHString(); mActor = esm.getHString();
break; break;
case ESM::fourCC("RNAM"): case fourCC("RNAM"):
mRace = esm.getHString(); mRace = esm.getHString();
break; break;
case ESM::fourCC("CNAM"): case fourCC("CNAM"):
mClass = esm.getHString(); mClass = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
{ {
mFaction = esm.getHString(); mFaction = esm.getHString();
if (mFaction == "FFFF") if (mFaction == "FFFF")
@ -46,19 +46,19 @@ namespace ESM
} }
break; break;
} }
case ESM::fourCC("ANAM"): case fourCC("ANAM"):
mCell = esm.getHString(); mCell = esm.getHString();
break; break;
case ESM::fourCC("DNAM"): case fourCC("DNAM"):
mPcFaction = esm.getHString(); mPcFaction = esm.getHString();
break; break;
case ESM::fourCC("SNAM"): case fourCC("SNAM"):
mSound = esm.getHString(); mSound = esm.getHString();
break; break;
case ESM::SREC_NAME: case SREC_NAME:
mResponse = esm.getHString(); mResponse = esm.getHString();
break; break;
case ESM::fourCC("SCVR"): case fourCC("SCVR"):
{ {
SelectStruct ss; SelectStruct ss;
ss.mSelectRule = esm.getHString(); ss.mSelectRule = esm.getHString();
@ -66,22 +66,22 @@ namespace ESM
mSelects.push_back(ss); mSelects.push_back(ss);
break; break;
} }
case ESM::fourCC("BNAM"): case fourCC("BNAM"):
mResultScript = esm.getHString(); mResultScript = esm.getHString();
break; break;
case ESM::fourCC("QSTN"): case fourCC("QSTN"):
mQuestStatus = QS_Name; mQuestStatus = QS_Name;
esm.skipRecord(); esm.skipRecord();
break; break;
case ESM::fourCC("QSTF"): case fourCC("QSTF"):
mQuestStatus = QS_Finished; mQuestStatus = QS_Finished;
esm.skipRecord(); esm.skipRecord();
break; break;
case ESM::fourCC("QSTR"): case fourCC("QSTR"):
mQuestStatus = QS_Restart; mQuestStatus = QS_Restart;
esm.skipRecord(); esm.skipRecord();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -20,27 +20,27 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("IRDT"): case fourCC("IRDT"):
esm.getHTSized<56>(mData); esm.getHTSized<56>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -46,7 +46,7 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::fourCC("INTV"): case fourCC("INTV"):
esm.getSubHeader(); esm.getSubHeader();
if (esm.getSubSize() != 8) if (esm.getSubSize() != 8)
esm.fail("Subrecord size is not equal to 8"); esm.fail("Subrecord size is not equal to 8");
@ -54,10 +54,10 @@ namespace ESM
esm.getT<int>(mY); esm.getT<int>(mY);
hasLocation = true; hasLocation = true;
break; break;
case ESM::fourCC("DATA"): case fourCC("DATA"):
esm.getHT(mFlags); esm.getHT(mFlags);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;
@ -82,23 +82,23 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::fourCC("VNML"): case fourCC("VNML"):
esm.skipHSub(); esm.skipHSub();
mDataTypes |= DATA_VNML; mDataTypes |= DATA_VNML;
break; break;
case ESM::fourCC("VHGT"): case fourCC("VHGT"):
esm.skipHSub(); esm.skipHSub();
mDataTypes |= DATA_VHGT; mDataTypes |= DATA_VHGT;
break; break;
case ESM::fourCC("WNAM"): case fourCC("WNAM"):
esm.getHExact(mWnam, sizeof(mWnam)); esm.getHExact(mWnam, sizeof(mWnam));
mDataTypes |= DATA_WNAM; mDataTypes |= DATA_WNAM;
break; break;
case ESM::fourCC("VCLR"): case fourCC("VCLR"):
esm.skipHSub(); esm.skipHSub();
mDataTypes |= DATA_VCLR; mDataTypes |= DATA_VCLR;
break; break;
case ESM::fourCC("VTEX"): case fourCC("VTEX"):
esm.skipHSub(); esm.skipHSub();
mDataTypes |= DATA_VTEX; mDataTypes |= DATA_VTEX;
break; break;
@ -162,12 +162,12 @@ namespace ESM
signed char wnam[LAND_GLOBAL_MAP_LOD_SIZE]; signed char wnam[LAND_GLOBAL_MAP_LOD_SIZE];
constexpr float max = std::numeric_limits<signed char>::max(); constexpr float max = std::numeric_limits<signed char>::max();
constexpr float min = std::numeric_limits<signed char>::min(); constexpr float min = std::numeric_limits<signed char>::min();
constexpr float vertMult = static_cast<float>(ESM::Land::LAND_SIZE - 1) / LAND_GLOBAL_MAP_LOD_SIZE_SQRT; constexpr float vertMult = static_cast<float>(Land::LAND_SIZE - 1) / LAND_GLOBAL_MAP_LOD_SIZE_SQRT;
for (int row = 0; row < LAND_GLOBAL_MAP_LOD_SIZE_SQRT; ++row) for (int row = 0; row < LAND_GLOBAL_MAP_LOD_SIZE_SQRT; ++row)
{ {
for (int col = 0; col < LAND_GLOBAL_MAP_LOD_SIZE_SQRT; ++col) for (int col = 0; col < LAND_GLOBAL_MAP_LOD_SIZE_SQRT; ++col)
{ {
float height = mLandData->mHeights[int(row * vertMult) * ESM::Land::LAND_SIZE + int(col * vertMult)]; float height = mLandData->mHeights[int(row * vertMult) * Land::LAND_SIZE + int(col * vertMult)];
height /= height > 0 ? 128.f : 16.f; height /= height > 0 ? 128.f : 16.f;
height = std::clamp(height, min, max); height = std::clamp(height, min, max);
wnam[row * LAND_GLOBAL_MAP_LOD_SIZE_SQRT + col] = static_cast<signed char>(height); wnam[row * LAND_GLOBAL_MAP_LOD_SIZE_SQRT + col] = static_cast<signed char>(height);
@ -246,7 +246,7 @@ namespace ESM
return; return;
} }
ESM::ESMReader reader; ESMReader reader;
reader.restoreContext(mContext); reader.restoreContext(mContext);
if (reader.isNextSub("VNML")) { if (reader.isNextSub("VNML")) {
@ -306,7 +306,7 @@ namespace ESM
} }
} }
bool Land::condLoad(ESM::ESMReader& reader, int flags, int& targetFlags, int dataFlag, void *ptr, unsigned int size) const bool Land::condLoad(ESMReader& reader, int flags, int& targetFlags, int dataFlag, void *ptr, unsigned int size) const
{ {
if ((targetFlags & dataFlag) == 0 && (flags & dataFlag) != 0) { if ((targetFlags & dataFlag) == 0 && (flags & dataFlag) != 0) {
reader.getHExact(ptr, size); reader.getHExact(ptr, size);

@ -109,7 +109,7 @@ struct Land
// 24-bit normals, these aren't always correct though. Edge and corner normals may be garbage. // 24-bit normals, these aren't always correct though. Edge and corner normals may be garbage.
VNML mNormals[LAND_NUM_VERTS * 3]; VNML mNormals[LAND_NUM_VERTS * 3];
// 2D array of texture indices. An index can be used to look up an ESM::LandTexture, // 2D array of texture indices. An index can be used to look up an LandTexture,
// but to do so you must subtract 1 from the index first! // but to do so you must subtract 1 from the index first!
// An index of 0 indicates the default texture. // An index of 0 indicates the default texture.
uint16_t mTextures[LAND_NUM_TEXTURES]; uint16_t mTextures[LAND_NUM_TEXTURES];
@ -179,7 +179,7 @@ struct Land
/// Loads data and marks it as loaded /// Loads data and marks it as loaded
/// \return true if data is actually loaded from file, false otherwise /// \return true if data is actually loaded from file, false otherwise
/// including the case when data is already loaded /// including the case when data is already loaded
bool condLoad(ESM::ESMReader& reader, int flags, int& targetFlags, int dataFlag, void *ptr, unsigned int size) const; bool condLoad(ESMReader& reader, int flags, int& targetFlags, int dataFlag, void *ptr, unsigned int size) const;
mutable LandData *mLandData; mutable LandData *mLandData;
}; };

@ -6,7 +6,7 @@
namespace ESM namespace ESM
{ {
void LevelledListBase::load(ESMReader& esm, ESM::NAME recName, bool& isDeleted) void LevelledListBase::load(ESMReader& esm, NAME recName, bool& isDeleted)
{ {
isDeleted = false; isDeleted = false;
mRecordFlags = esm.getRecordFlags(); mRecordFlags = esm.getRecordFlags();
@ -18,17 +18,17 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("DATA"): case fourCC("DATA"):
esm.getHT(mFlags); esm.getHT(mFlags);
break; break;
case ESM::fourCC("NNAM"): case fourCC("NNAM"):
esm.getHT(mChanceNone); esm.getHT(mChanceNone);
break; break;
case ESM::fourCC("INDX"): case fourCC("INDX"):
{ {
int length = 0; int length = 0;
esm.getHT(length); esm.getHT(length);
@ -50,7 +50,7 @@ namespace ESM
hasList = true; hasList = true;
break; break;
} }
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;
@ -75,7 +75,7 @@ namespace ESM
esm.fail("Missing NAME subrecord"); esm.fail("Missing NAME subrecord");
} }
void LevelledListBase::save(ESMWriter& esm, ESM::NAME recName, bool isDeleted) const void LevelledListBase::save(ESMWriter& esm, NAME recName, bool isDeleted) const
{ {
esm.writeHNCString("NAME", mId); esm.writeHNCString("NAME", mId);

@ -36,8 +36,8 @@ struct LevelledListBase
std::vector<LevelItem> mList; std::vector<LevelItem> mList;
void load(ESMReader& esm, ESM::NAME recName, bool& isDeleted); void load(ESMReader& esm, NAME recName, bool& isDeleted);
void save(ESMWriter& esm, ESM::NAME recName, bool isDeleted) const; void save(ESMWriter& esm, NAME recName, bool isDeleted) const;
void blank(); void blank();
///< Set record to default state (does not touch the ID). ///< Set record to default state (does not touch the ID).
@ -53,7 +53,7 @@ struct CustomLevelledListBase : LevelledListBase
struct CreatureLevList : CustomLevelledListBase<CreatureLevList> struct CreatureLevList : CustomLevelledListBase<CreatureLevList>
{ {
/// Record name used to read references. /// Record name used to read references.
static constexpr ESM::NAME sRecName {"CNAM"}; static constexpr NAME sRecName {"CNAM"};
static constexpr RecNameInts sRecordId = RecNameInts::REC_LEVC; static constexpr RecNameInts sRecordId = RecNameInts::REC_LEVC;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only. /// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string_view getRecordType() { return "CreatureLevList"; } static std::string_view getRecordType() { return "CreatureLevList"; }
@ -70,7 +70,7 @@ struct CreatureLevList : CustomLevelledListBase<CreatureLevList>
struct ItemLevList : CustomLevelledListBase<ItemLevList> struct ItemLevList : CustomLevelledListBase<ItemLevList>
{ {
/// Record name used to read references. /// Record name used to read references.
static constexpr ESM::NAME sRecName {"INAM"}; static constexpr NAME sRecName {"INAM"};
static constexpr RecNameInts sRecordId = RecNameInts::REC_LEVI; static constexpr RecNameInts sRecordId = RecNameInts::REC_LEVI;
/// Return a string descriptor for this record type. Currently used for debugging / error logs only. /// Return a string descriptor for this record type. Currently used for debugging / error logs only.
static std::string_view getRecordType() { return "ItemLevList"; } static std::string_view getRecordType() { return "ItemLevList"; }

@ -20,30 +20,30 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::fourCC("LHDT"): case fourCC("LHDT"):
esm.getHTSized<24>(mData); esm.getHTSized<24>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("SNAM"): case fourCC("SNAM"):
mSound = esm.getHString(); mSound = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -20,27 +20,27 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("LKDT"): case fourCC("LKDT"):
esm.getHTSized<16>(mData); esm.getHTSized<16>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -19,18 +19,18 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("INTV"): case fourCC("INTV"):
esm.getHT(mIndex); esm.getHT(mIndex);
hasIndex = true; hasIndex = true;
break; break;
case ESM::fourCC("DATA"): case fourCC("DATA"):
mTexture = esm.getHString(); mTexture = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -6,9 +6,11 @@
#include "esmwriter.hpp" #include "esmwriter.hpp"
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
namespace ESM
{
namespace namespace
{ {
static const char *sIds[ESM::MagicEffect::Length] = static const char *sIds[MagicEffect::Length] =
{ {
"WaterBreathing", "WaterBreathing",
"SwiftSwim", "SwiftSwim",
@ -181,6 +183,7 @@ namespace
0x11c8, 0x1048, 0x1048, 0x1048, 0x1048, 0x1048, 0x1048 0x11c8, 0x1048, 0x1048, 0x1048, 0x1048, 0x1048, 0x1048
}; };
} }
}
namespace ESM namespace ESM
{ {
@ -211,37 +214,37 @@ void MagicEffect::load(ESMReader &esm, bool &isDeleted)
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::fourCC("PTEX"): case fourCC("PTEX"):
mParticle = esm.getHString(); mParticle = esm.getHString();
break; break;
case ESM::fourCC("BSND"): case fourCC("BSND"):
mBoltSound = esm.getHString(); mBoltSound = esm.getHString();
break; break;
case ESM::fourCC("CSND"): case fourCC("CSND"):
mCastSound = esm.getHString(); mCastSound = esm.getHString();
break; break;
case ESM::fourCC("HSND"): case fourCC("HSND"):
mHitSound = esm.getHString(); mHitSound = esm.getHString();
break; break;
case ESM::fourCC("ASND"): case fourCC("ASND"):
mAreaSound = esm.getHString(); mAreaSound = esm.getHString();
break; break;
case ESM::fourCC("CVFX"): case fourCC("CVFX"):
mCasting = esm.getHString(); mCasting = esm.getHString();
break; break;
case ESM::fourCC("BVFX"): case fourCC("BVFX"):
mBolt = esm.getHString(); mBolt = esm.getHString();
break; break;
case ESM::fourCC("HVFX"): case fourCC("HVFX"):
mHit = esm.getHString(); mHit = esm.getHString();
break; break;
case ESM::fourCC("AVFX"): case fourCC("AVFX"):
mArea = esm.getHString(); mArea = esm.getHString();
break; break;
case ESM::fourCC("DESC"): case fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
default: default:

@ -83,8 +83,8 @@ struct MagicEffect
MEDTstruct mData; MEDTstruct mData;
std::string mIcon, mParticle; // Textures std::string mIcon, mParticle; // Textures
std::string mCasting, mHit, mArea; // ESM::Static std::string mCasting, mHit, mArea; // Static
std::string mBolt; // ESM::Weapon std::string mBolt; // Weapon
std::string mCastSound, mBoltSound, mHitSound, mAreaSound; // Sounds std::string mCastSound, mBoltSound, mHitSound, mAreaSound; // Sounds
std::string mDescription; std::string mDescription;

@ -20,27 +20,27 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("MCDT"): case fourCC("MCDT"):
esm.getHTSized<12>(mData); esm.getHTSized<12>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -28,35 +28,35 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("RNAM"): case fourCC("RNAM"):
mRace = esm.getHString(); mRace = esm.getHString();
break; break;
case ESM::fourCC("CNAM"): case fourCC("CNAM"):
mClass = esm.getHString(); mClass = esm.getHString();
break; break;
case ESM::fourCC("ANAM"): case fourCC("ANAM"):
mFaction = esm.getHString(); mFaction = esm.getHString();
break; break;
case ESM::fourCC("BNAM"): case fourCC("BNAM"):
mHead = esm.getHString(); mHead = esm.getHString();
break; break;
case ESM::fourCC("KNAM"): case fourCC("KNAM"):
mHair = esm.getHString(); mHair = esm.getHString();
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("NPDT"): case fourCC("NPDT"):
hasNpdt = true; hasNpdt = true;
esm.getSubHeader(); esm.getSubHeader();
if (esm.getSubSize() == 52) if (esm.getSubSize() == 52)
@ -83,24 +83,24 @@ namespace ESM
else else
esm.fail("NPC_NPDT must be 12 or 52 bytes long"); esm.fail("NPC_NPDT must be 12 or 52 bytes long");
break; break;
case ESM::fourCC("FLAG"): case fourCC("FLAG"):
hasFlags = true; hasFlags = true;
int flags; int flags;
esm.getHT(flags); esm.getHT(flags);
mFlags = flags & 0xFF; mFlags = flags & 0xFF;
mBloodType = ((flags >> 8) & 0xFF) >> 2; mBloodType = ((flags >> 8) & 0xFF) >> 2;
break; break;
case ESM::fourCC("NPCS"): case fourCC("NPCS"):
mSpells.add(esm); mSpells.add(esm);
break; break;
case ESM::fourCC("NPCO"): case fourCC("NPCO"):
mInventory.add(esm); mInventory.add(esm);
break; break;
case ESM::fourCC("AIDT"): case fourCC("AIDT"):
esm.getHExact(&mAiData, sizeof(mAiData)); esm.getHExact(&mAiData, sizeof(mAiData));
break; break;
case ESM::fourCC("DODT"): case fourCC("DODT"):
case ESM::fourCC("DNAM"): case fourCC("DNAM"):
mTransport.add(esm); mTransport.add(esm);
break; break;
case AI_Wander: case AI_Wander:
@ -111,7 +111,7 @@ namespace ESM
case AI_CNDT: case AI_CNDT:
mAiPackage.add(esm); mAiPackage.add(esm);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -11,7 +11,8 @@
#include "loadskil.hpp" #include "loadskil.hpp"
#include "transport.hpp" #include "transport.hpp"
namespace ESM { namespace ESM
{
class ESMReader; class ESMReader;
class ESMWriter; class ESMWriter;

@ -48,14 +48,14 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mCell = esm.getHString(); mCell = esm.getHString();
break; break;
case ESM::fourCC("DATA"): case fourCC("DATA"):
esm.getHTSized<12>(mData); esm.getHTSized<12>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("PGRP"): case fourCC("PGRP"):
{ {
esm.getSubHeader(); esm.getSubHeader();
int size = esm.getSubSize(); int size = esm.getSubSize();
@ -76,7 +76,7 @@ namespace ESM
} }
break; break;
} }
case ESM::fourCC("PGRC"): case fourCC("PGRC"):
{ {
esm.getSubHeader(); esm.getSubHeader();
int size = esm.getSubSize(); int size = esm.getSubSize();
@ -113,7 +113,7 @@ namespace ESM
} }
break; break;
} }
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -20,27 +20,27 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("PBDT"): case fourCC("PBDT"):
esm.getHTSized<16>(mData); esm.getHTSized<16>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -32,24 +32,24 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("RADT"): case fourCC("RADT"):
esm.getHTSized<140>(mData); esm.getHTSized<140>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("DESC"): case fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
case ESM::fourCC("NPCS"): case fourCC("NPCS"):
mPowers.add(esm); mPowers.add(esm);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -19,14 +19,14 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("WEAT"): case fourCC("WEAT"):
{ {
esm.getSubHeader(); esm.getSubHeader();
if (esm.getVer() == VER_12) if (esm.getVer() == VER_12)
@ -55,13 +55,13 @@ namespace ESM
} }
break; break;
} }
case ESM::fourCC("BNAM"): case fourCC("BNAM"):
mSleepList = esm.getHString(); mSleepList = esm.getHString();
break; break;
case ESM::fourCC("CNAM"): case fourCC("CNAM"):
esm.getHT(mMapColor); esm.getHT(mMapColor);
break; break;
case ESM::fourCC("SNAM"): case fourCC("SNAM"):
{ {
esm.getSubHeader(); esm.getSubHeader();
SoundRef sr; SoundRef sr;
@ -70,7 +70,7 @@ namespace ESM
mSoundList.push_back(sr); mSoundList.push_back(sr);
break; break;
} }
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -20,27 +20,27 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("RIDT"): case fourCC("RIDT"):
esm.getHTSized<16>(mData); esm.getHTSized<16>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -95,7 +95,7 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::fourCC("SCHD"): case fourCC("SCHD"):
{ {
esm.getSubHeader(); esm.getSubHeader();
mId = esm.getString(32); mId = esm.getString(32);
@ -104,11 +104,11 @@ namespace ESM
hasHeader = true; hasHeader = true;
break; break;
} }
case ESM::fourCC("SCVR"): case fourCC("SCVR"):
// list of local variables // list of local variables
loadSCVR(esm); loadSCVR(esm);
break; break;
case ESM::fourCC("SCDT"): case fourCC("SCDT"):
{ {
// compiled script // compiled script
esm.getSubHeader(); esm.getSubHeader();
@ -127,10 +127,10 @@ namespace ESM
esm.getExact(mScriptData.data(), mScriptData.size()); esm.getExact(mScriptData.data(), mScriptData.size());
break; break;
} }
case ESM::fourCC("SCTX"): case fourCC("SCTX"):
mScriptText = esm.getHString(); mScriptText = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -139,15 +139,15 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::fourCC("INDX"): case fourCC("INDX"):
esm.getHT(mIndex); esm.getHT(mIndex);
hasIndex = true; hasIndex = true;
break; break;
case ESM::fourCC("SKDT"): case fourCC("SKDT"):
esm.getHTSized<24>(mData); esm.getHTSized<24>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("DESC"): case fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
default: default:

@ -6,7 +6,8 @@
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
namespace ESM { namespace ESM
{
class ESMReader; class ESMReader;
class ESMWriter; class ESMWriter;

@ -20,21 +20,21 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("DATA"): case fourCC("DATA"):
esm.getHTSized<4>(mType); esm.getHTSized<4>(mType);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("CNAM"): case fourCC("CNAM"):
mCreature = esm.getHString(); mCreature = esm.getHString();
break; break;
case ESM::fourCC("SNAM"): case fourCC("SNAM"):
mSound = esm.getHString(); mSound = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -20,18 +20,18 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mSound = esm.getHString(); mSound = esm.getHString();
break; break;
case ESM::fourCC("DATA"): case fourCC("DATA"):
esm.getHTSized<3>(mData); esm.getHTSized<3>(mData);
hasData = true; hasData = true;
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -22,23 +22,23 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("SPDT"): case fourCC("SPDT"):
esm.getHTSized<12>(mData); esm.getHTSized<12>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("ENAM"): case fourCC("ENAM"):
ENAMstruct s; ENAMstruct s;
esm.getHTSized<24>(s); esm.getHTSized<24>(s);
mEffects.mList.push_back(s); mEffects.mList.push_back(s);
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -20,15 +20,15 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("DATA"): case fourCC("DATA"):
mData = esm.getHString(); mData = esm.getHString();
hasData = true; hasData = true;
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -12,8 +12,8 @@ namespace ESM
{ {
isDeleted = false; isDeleted = false;
mRecordFlags = esm.getRecordFlags(); mRecordFlags = esm.getRecordFlags();
//bool isBlocked = (mRecordFlags & ESM::FLAG_Blocked) != 0; //bool isBlocked = (mRecordFlags & FLAG_Blocked) != 0;
//bool isPersistent = (mRecordFlags & ESM::FLAG_Persistent) != 0; //bool isPersistent = (mRecordFlags & FLAG_Persistent) != 0;
bool hasName = false; bool hasName = false;
while (esm.hasMoreSubs()) while (esm.hasMoreSubs())
@ -21,14 +21,14 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -3,7 +3,8 @@
#include <string> #include <string>
namespace ESM { namespace ESM
{
class ESMReader; class ESMReader;
class ESMWriter; class ESMWriter;

@ -5,9 +5,12 @@
#include "esmwriter.hpp" #include "esmwriter.hpp"
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
void ESM::Header::blank() namespace ESM
{ {
mData.version = ESM::VER_13;
void Header::blank()
{
mData.version = VER_13;
mData.type = 0; mData.type = 0;
mData.author.clear(); mData.author.clear();
mData.desc.clear(); mData.desc.clear();
@ -16,7 +19,7 @@ void ESM::Header::blank()
mMaster.clear(); mMaster.clear();
} }
void ESM::Header::load (ESMReader &esm) void Header::load (ESMReader &esm)
{ {
if (esm.isNextSub ("FORM")) if (esm.isNextSub ("FORM"))
{ {
@ -65,7 +68,7 @@ void ESM::Header::load (ESMReader &esm)
} }
} }
void ESM::Header::save (ESMWriter &esm) void Header::save (ESMWriter &esm)
{ {
if (mFormat>0) if (mFormat>0)
esm.writeHNT ("FORM", mFormat); esm.writeHNT ("FORM", mFormat);
@ -84,3 +87,5 @@ void ESM::Header::save (ESMWriter &esm)
esm.writeHNT ("DATA", data.size); esm.writeHNT ("DATA", data.size);
} }
} }
}

@ -20,30 +20,30 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::SREC_NAME: case SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::fourCC("MODL"): case fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::fourCC("FNAM"): case fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::fourCC("WPDT"): case fourCC("WPDT"):
esm.getHTSized<32>(mData); esm.getHTSized<32>(mData);
hasData = true; hasData = true;
break; break;
case ESM::fourCC("SCRI"): case fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::fourCC("ITEX"): case fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::fourCC("ENAM"): case fourCC("ENAM"):
mEnchant = esm.getHString(); mEnchant = esm.getHString();
break; break;
case ESM::SREC_DELE: case SREC_DELE:
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;

@ -105,7 +105,7 @@ struct WeaponType
std::string mSoundId; std::string mSoundId;
std::string mAttachBone; std::string mAttachBone;
std::string mSheathingBone; std::string mSheathingBone;
ESM::Skill::SkillEnum mSkill; Skill::SkillEnum mSkill;
Class mWeaponClass; Class mWeaponClass;
int mAmmoType; int mAmmoType;
int mFlags; int mFlags;

@ -3,7 +3,10 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
void ESM::Locals::load (ESMReader &esm) namespace ESM
{
void Locals::load (ESMReader &esm)
{ {
while (esm.isNextSub ("LOCA")) while (esm.isNextSub ("LOCA"))
{ {
@ -16,7 +19,7 @@ void ESM::Locals::load (ESMReader &esm)
} }
} }
void ESM::Locals::save (ESMWriter &esm) const void Locals::save (ESMWriter &esm) const
{ {
for (std::vector<std::pair<std::string, Variant> >::const_iterator iter (mVariables.begin()); for (std::vector<std::pair<std::string, Variant> >::const_iterator iter (mVariables.begin());
iter!=mVariables.end(); ++iter) iter!=mVariables.end(); ++iter)
@ -25,3 +28,5 @@ void ESM::Locals::save (ESMWriter &esm) const
iter->second.write (esm, Variant::Format_Local); iter->second.write (esm, Variant::Format_Local);
} }
} }
}

@ -4,128 +4,128 @@
namespace ESM namespace ESM
{ {
ESM::BodyPart::MeshPart getMeshPart(ESM::PartReferenceType type) BodyPart::MeshPart getMeshPart(PartReferenceType type)
{ {
switch(type) switch(type)
{ {
case ESM::PRT_Head: case PRT_Head:
return ESM::BodyPart::MP_Head; return BodyPart::MP_Head;
case ESM::PRT_Hair: case PRT_Hair:
return ESM::BodyPart::MP_Hair; return BodyPart::MP_Hair;
case ESM::PRT_Neck: case PRT_Neck:
return ESM::BodyPart::MP_Neck; return BodyPart::MP_Neck;
case ESM::PRT_Cuirass: case PRT_Cuirass:
return ESM::BodyPart::MP_Chest; return BodyPart::MP_Chest;
case ESM::PRT_Groin: case PRT_Groin:
return ESM::BodyPart::MP_Groin; return BodyPart::MP_Groin;
case ESM::PRT_RHand: case PRT_RHand:
return ESM::BodyPart::MP_Hand; return BodyPart::MP_Hand;
case ESM::PRT_LHand: case PRT_LHand:
return ESM::BodyPart::MP_Hand; return BodyPart::MP_Hand;
case ESM::PRT_RWrist: case PRT_RWrist:
return ESM::BodyPart::MP_Wrist; return BodyPart::MP_Wrist;
case ESM::PRT_LWrist: case PRT_LWrist:
return ESM::BodyPart::MP_Wrist; return BodyPart::MP_Wrist;
case ESM::PRT_RForearm: case PRT_RForearm:
return ESM::BodyPart::MP_Forearm; return BodyPart::MP_Forearm;
case ESM::PRT_LForearm: case PRT_LForearm:
return ESM::BodyPart::MP_Forearm; return BodyPart::MP_Forearm;
case ESM::PRT_RUpperarm: case PRT_RUpperarm:
return ESM::BodyPart::MP_Upperarm; return BodyPart::MP_Upperarm;
case ESM::PRT_LUpperarm: case PRT_LUpperarm:
return ESM::BodyPart::MP_Upperarm; return BodyPart::MP_Upperarm;
case ESM::PRT_RFoot: case PRT_RFoot:
return ESM::BodyPart::MP_Foot; return BodyPart::MP_Foot;
case ESM::PRT_LFoot: case PRT_LFoot:
return ESM::BodyPart::MP_Foot; return BodyPart::MP_Foot;
case ESM::PRT_RAnkle: case PRT_RAnkle:
return ESM::BodyPart::MP_Ankle; return BodyPart::MP_Ankle;
case ESM::PRT_LAnkle: case PRT_LAnkle:
return ESM::BodyPart::MP_Ankle; return BodyPart::MP_Ankle;
case ESM::PRT_RKnee: case PRT_RKnee:
return ESM::BodyPart::MP_Knee; return BodyPart::MP_Knee;
case ESM::PRT_LKnee: case PRT_LKnee:
return ESM::BodyPart::MP_Knee; return BodyPart::MP_Knee;
case ESM::PRT_RLeg: case PRT_RLeg:
return ESM::BodyPart::MP_Upperleg; return BodyPart::MP_Upperleg;
case ESM::PRT_LLeg: case PRT_LLeg:
return ESM::BodyPart::MP_Upperleg; return BodyPart::MP_Upperleg;
case ESM::PRT_Tail: case PRT_Tail:
return ESM::BodyPart::MP_Tail; return BodyPart::MP_Tail;
default: default:
throw std::runtime_error("PartReferenceType " + throw std::runtime_error("PartReferenceType " +
std::to_string(type) + " not associated with a mesh part"); std::to_string(type) + " not associated with a mesh part");
} }
} }
std::string getBoneName(ESM::PartReferenceType type) std::string getBoneName(PartReferenceType type)
{ {
switch(type) switch(type)
{ {
case ESM::PRT_Head: case PRT_Head:
return "head"; return "head";
case ESM::PRT_Hair: case PRT_Hair:
return "head"; // This is purposeful. return "head"; // This is purposeful.
case ESM::PRT_Neck: case PRT_Neck:
return "neck"; return "neck";
case ESM::PRT_Cuirass: case PRT_Cuirass:
return "chest"; return "chest";
case ESM::PRT_Groin: case PRT_Groin:
return "groin"; return "groin";
case ESM::PRT_Skirt: case PRT_Skirt:
return "groin"; return "groin";
case ESM::PRT_RHand: case PRT_RHand:
return "right hand"; return "right hand";
case ESM::PRT_LHand: case PRT_LHand:
return "left hand"; return "left hand";
case ESM::PRT_RWrist: case PRT_RWrist:
return "right wrist"; return "right wrist";
case ESM::PRT_LWrist: case PRT_LWrist:
return "left wrist"; return "left wrist";
case ESM::PRT_Shield: case PRT_Shield:
return "shield bone"; return "shield bone";
case ESM::PRT_RForearm: case PRT_RForearm:
return "right forearm"; return "right forearm";
case ESM::PRT_LForearm: case PRT_LForearm:
return "left forearm"; return "left forearm";
case ESM::PRT_RUpperarm: case PRT_RUpperarm:
return "right upper arm"; return "right upper arm";
case ESM::PRT_LUpperarm: case PRT_LUpperarm:
return "left upper arm"; return "left upper arm";
case ESM::PRT_RFoot: case PRT_RFoot:
return "right foot"; return "right foot";
case ESM::PRT_LFoot: case PRT_LFoot:
return "left foot"; return "left foot";
case ESM::PRT_RAnkle: case PRT_RAnkle:
return "right ankle"; return "right ankle";
case ESM::PRT_LAnkle: case PRT_LAnkle:
return "left ankle"; return "left ankle";
case ESM::PRT_RKnee: case PRT_RKnee:
return "right knee"; return "right knee";
case ESM::PRT_LKnee: case PRT_LKnee:
return "left knee"; return "left knee";
case ESM::PRT_RLeg: case PRT_RLeg:
return "right upper leg"; return "right upper leg";
case ESM::PRT_LLeg: case PRT_LLeg:
return "left upper leg"; return "left upper leg";
case ESM::PRT_RPauldron: case PRT_RPauldron:
return "right clavicle"; return "right clavicle";
case ESM::PRT_LPauldron: case PRT_LPauldron:
return "left clavicle"; return "left clavicle";
case ESM::PRT_Weapon: case PRT_Weapon:
return "weapon bone"; return "weapon bone";
case ESM::PRT_Tail: case PRT_Tail:
return "tail"; return "tail";
default: default:
throw std::runtime_error("unknown PartReferenceType"); throw std::runtime_error("unknown PartReferenceType");
} }
} }
std::string getMeshFilter(ESM::PartReferenceType type) std::string getMeshFilter(PartReferenceType type)
{ {
switch(type) switch(type)
{ {
case ESM::PRT_Hair: case PRT_Hair:
return "hair"; return "hair";
default: default:
return getBoneName(type); return getBoneName(type);

@ -8,9 +8,9 @@
namespace ESM namespace ESM
{ {
ESM::BodyPart::MeshPart getMeshPart(ESM::PartReferenceType type); BodyPart::MeshPart getMeshPart(PartReferenceType type);
std::string getBoneName(ESM::PartReferenceType type); std::string getBoneName(PartReferenceType type);
std::string getMeshFilter(ESM::PartReferenceType type); std::string getMeshFilter(PartReferenceType type);
} }
#endif #endif

@ -1,6 +1,9 @@
#include "npcstate.hpp" #include "npcstate.hpp"
void ESM::NpcState::load (ESMReader &esm) namespace ESM
{
void NpcState::load (ESMReader &esm)
{ {
ObjectState::load (esm); ObjectState::load (esm);
@ -14,7 +17,7 @@ void ESM::NpcState::load (ESMReader &esm)
} }
} }
void ESM::NpcState::save (ESMWriter &esm, bool inInventory) const void NpcState::save (ESMWriter &esm, bool inInventory) const
{ {
ObjectState::save (esm, inInventory); ObjectState::save (esm, inInventory);
@ -28,10 +31,12 @@ void ESM::NpcState::save (ESMWriter &esm, bool inInventory) const
} }
} }
void ESM::NpcState::blank() void NpcState::blank()
{ {
ObjectState::blank(); ObjectState::blank();
mNpcStats.blank(); mNpcStats.blank();
mCreatureStats.blank(); mCreatureStats.blank();
mHasCustomState = true; mHasCustomState = true;
} }
}

@ -5,9 +5,12 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
ESM::NpcStats::Faction::Faction() : mExpelled (false), mRank (-1), mReputation (0) {} namespace ESM
{
NpcStats::Faction::Faction() : mExpelled (false), mRank (-1), mReputation (0) {}
void ESM::NpcStats::load (ESMReader &esm) void NpcStats::load (ESMReader &esm)
{ {
while (esm.isNextSub ("FACT")) while (esm.isNextSub ("FACT"))
{ {
@ -41,17 +44,17 @@ void ESM::NpcStats::load (ESMReader &esm)
// we have deprecated werewolf skills, stored interleaved // we have deprecated werewolf skills, stored interleaved
// Load into one big vector, then remove every 2nd value // Load into one big vector, then remove every 2nd value
mWerewolfDeprecatedData = true; mWerewolfDeprecatedData = true;
std::vector<ESM::StatState<float> > skills(mSkills, mSkills + sizeof(mSkills)/sizeof(mSkills[0])); std::vector<StatState<float> > skills(mSkills, mSkills + sizeof(mSkills)/sizeof(mSkills[0]));
for (int i=0; i<27; ++i) for (int i=0; i<27; ++i)
{ {
ESM::StatState<float> skill; StatState<float> skill;
skill.load(esm, intFallback); skill.load(esm, intFallback);
skills.push_back(skill); skills.push_back(skill);
} }
int i=0; int i=0;
for (std::vector<ESM::StatState<float> >::iterator it = skills.begin(); it != skills.end(); ++i) for (std::vector<StatState<float> >::iterator it = skills.begin(); it != skills.end(); ++i)
{ {
if (i%2 == 1) if (i%2 == 1)
it = skills.erase(it); it = skills.erase(it);
@ -67,7 +70,7 @@ void ESM::NpcStats::load (ESMReader &esm)
esm.getHNOT (hasWerewolfAttributes, "HWAT"); esm.getHNOT (hasWerewolfAttributes, "HWAT");
if (hasWerewolfAttributes) if (hasWerewolfAttributes)
{ {
ESM::StatState<int> dummy; StatState<int> dummy;
for (int i=0; i<8; ++i) for (int i=0; i<8; ++i)
dummy.load(esm, intFallback); dummy.load(esm, intFallback);
mWerewolfDeprecatedData = true; mWerewolfDeprecatedData = true;
@ -122,7 +125,7 @@ void ESM::NpcStats::load (ESMReader &esm)
esm.getHNOT (mCrimeId, "CRID"); esm.getHNOT (mCrimeId, "CRID");
} }
void ESM::NpcStats::save (ESMWriter &esm) const void NpcStats::save (ESMWriter &esm) const
{ {
for (std::map<std::string, Faction>::const_iterator iter (mFactions.begin()); for (std::map<std::string, Faction>::const_iterator iter (mFactions.begin());
iter!=mFactions.end(); ++iter) iter!=mFactions.end(); ++iter)
@ -191,7 +194,7 @@ void ESM::NpcStats::save (ESMWriter &esm) const
esm.writeHNT ("CRID", mCrimeId); esm.writeHNT ("CRID", mCrimeId);
} }
void ESM::NpcStats::blank() void NpcStats::blank()
{ {
mWerewolfDeprecatedData = false; mWerewolfDeprecatedData = false;
mIsWerewolf = false; mIsWerewolf = false;
@ -207,3 +210,5 @@ void ESM::NpcStats::blank()
mTimeToStartDrowning = 20; mTimeToStartDrowning = 20;
mCrimeId = -1; mCrimeId = -1;
} }
}

@ -8,7 +8,10 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
void ESM::ObjectState::load (ESMReader &esm) namespace ESM
{
void ObjectState::load (ESMReader &esm)
{ {
mVersion = esm.getFormat(); mVersion = esm.getFormat();
@ -56,7 +59,7 @@ void ESM::ObjectState::load (ESMReader &esm)
esm.getHNOT (mHasCustomState, "HCUS"); esm.getHNOT (mHasCustomState, "HCUS");
} }
void ESM::ObjectState::save (ESMWriter &esm, bool inInventory) const void ObjectState::save (ESMWriter &esm, bool inInventory) const
{ {
mRef.save (esm, true, inInventory); mRef.save (esm, true, inInventory);
@ -91,7 +94,7 @@ void ESM::ObjectState::save (ESMWriter &esm, bool inInventory) const
esm.writeHNT ("HCUS", false); esm.writeHNT ("HCUS", false);
} }
void ESM::ObjectState::blank() void ObjectState::blank()
{ {
mRef.blank(); mRef.blank();
mHasLocals = 0; mHasLocals = 0;
@ -106,74 +109,76 @@ void ESM::ObjectState::blank()
mHasCustomState = true; mHasCustomState = true;
} }
const ESM::NpcState& ESM::ObjectState::asNpcState() const const NpcState& ObjectState::asNpcState() const
{ {
std::stringstream error; std::stringstream error;
error << "bad cast " << typeid(this).name() << " to NpcState"; error << "bad cast " << typeid(this).name() << " to NpcState";
throw std::logic_error(error.str()); throw std::logic_error(error.str());
} }
ESM::NpcState& ESM::ObjectState::asNpcState() NpcState& ObjectState::asNpcState()
{ {
std::stringstream error; std::stringstream error;
error << "bad cast " << typeid(this).name() << " to NpcState"; error << "bad cast " << typeid(this).name() << " to NpcState";
throw std::logic_error(error.str()); throw std::logic_error(error.str());
} }
const ESM::CreatureState& ESM::ObjectState::asCreatureState() const const CreatureState& ObjectState::asCreatureState() const
{ {
std::stringstream error; std::stringstream error;
error << "bad cast " << typeid(this).name() << " to CreatureState"; error << "bad cast " << typeid(this).name() << " to CreatureState";
throw std::logic_error(error.str()); throw std::logic_error(error.str());
} }
ESM::CreatureState& ESM::ObjectState::asCreatureState() CreatureState& ObjectState::asCreatureState()
{ {
std::stringstream error; std::stringstream error;
error << "bad cast " << typeid(this).name() << " to CreatureState"; error << "bad cast " << typeid(this).name() << " to CreatureState";
throw std::logic_error(error.str()); throw std::logic_error(error.str());
} }
const ESM::ContainerState& ESM::ObjectState::asContainerState() const const ContainerState& ObjectState::asContainerState() const
{ {
std::stringstream error; std::stringstream error;
error << "bad cast " << typeid(this).name() << " to ContainerState"; error << "bad cast " << typeid(this).name() << " to ContainerState";
throw std::logic_error(error.str()); throw std::logic_error(error.str());
} }
ESM::ContainerState& ESM::ObjectState::asContainerState() ContainerState& ObjectState::asContainerState()
{ {
std::stringstream error; std::stringstream error;
error << "bad cast " << typeid(this).name() << " to ContainerState"; error << "bad cast " << typeid(this).name() << " to ContainerState";
throw std::logic_error(error.str()); throw std::logic_error(error.str());
} }
const ESM::DoorState& ESM::ObjectState::asDoorState() const const DoorState& ObjectState::asDoorState() const
{ {
std::stringstream error; std::stringstream error;
error << "bad cast " << typeid(this).name() << " to DoorState"; error << "bad cast " << typeid(this).name() << " to DoorState";
throw std::logic_error(error.str()); throw std::logic_error(error.str());
} }
ESM::DoorState& ESM::ObjectState::asDoorState() DoorState& ObjectState::asDoorState()
{ {
std::stringstream error; std::stringstream error;
error << "bad cast " << typeid(this).name() << " to DoorState"; error << "bad cast " << typeid(this).name() << " to DoorState";
throw std::logic_error(error.str()); throw std::logic_error(error.str());
} }
const ESM::CreatureLevListState& ESM::ObjectState::asCreatureLevListState() const const CreatureLevListState& ObjectState::asCreatureLevListState() const
{ {
std::stringstream error; std::stringstream error;
error << "bad cast " << typeid(this).name() << " to CreatureLevListState"; error << "bad cast " << typeid(this).name() << " to CreatureLevListState";
throw std::logic_error(error.str()); throw std::logic_error(error.str());
} }
ESM::CreatureLevListState& ESM::ObjectState::asCreatureLevListState() CreatureLevListState& ObjectState::asCreatureLevListState()
{ {
std::stringstream error; std::stringstream error;
error << "bad cast " << typeid(this).name() << " to CreatureLevListState"; error << "bad cast " << typeid(this).name() << " to CreatureLevListState";
throw std::logic_error(error.str()); throw std::logic_error(error.str());
} }
ESM::ObjectState::~ObjectState() {} ObjectState::~ObjectState() {}
}

@ -31,7 +31,7 @@ namespace ESM
LuaScripts mLuaScripts; LuaScripts mLuaScripts;
unsigned char mEnabled; unsigned char mEnabled;
int mCount; int mCount;
ESM::Position mPosition; Position mPosition;
unsigned int mFlags; unsigned int mFlags;
// Is there any class-specific state following the ObjectState // Is there any class-specific state following the ObjectState
@ -39,7 +39,7 @@ namespace ESM
unsigned int mVersion; unsigned int mVersion;
ESM::AnimationState mAnimationState; AnimationState mAnimationState;
ObjectState() ObjectState()
: mHasLocals(0), mEnabled(0), mCount(0) : mHasLocals(0), mEnabled(0), mCount(0)

@ -3,7 +3,10 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
void ESM::Player::load (ESMReader &esm) namespace ESM
{
void Player::load (ESMReader &esm)
{ {
mObject.mRef.loadId(esm, true); mObject.mRef.loadId(esm, true);
mObject.load (esm); mObject.load (esm);
@ -50,7 +53,7 @@ void ESM::Player::load (ESMReader &esm)
bool clearModified = esm.getFormat() < 17 && !mObject.mNpcStats.mIsWerewolf; bool clearModified = esm.getFormat() < 17 && !mObject.mNpcStats.mIsWerewolf;
if (esm.hasMoreSubs()) if (esm.hasMoreSubs())
{ {
for (int i=0; i<ESM::Attribute::Length; ++i) for (int i=0; i<Attribute::Length; ++i)
{ {
StatState<float> attribute; StatState<float> attribute;
attribute.load(esm, intFallback); attribute.load(esm, intFallback);
@ -60,7 +63,7 @@ void ESM::Player::load (ESMReader &esm)
if (mObject.mNpcStats.mIsWerewolf) if (mObject.mNpcStats.mIsWerewolf)
mObject.mCreatureStats.mAttributes[i] = attribute; mObject.mCreatureStats.mAttributes[i] = attribute;
} }
for (int i=0; i<ESM::Skill::Length; ++i) for (int i=0; i<Skill::Length; ++i)
{ {
StatState<float> skill; StatState<float> skill;
skill.load(esm, intFallback); skill.load(esm, intFallback);
@ -69,7 +72,7 @@ void ESM::Player::load (ESMReader &esm)
mSaveSkills[i] = skill.mBase + skill.mMod - skill.mDamage; mSaveSkills[i] = skill.mBase + skill.mMod - skill.mDamage;
if (mObject.mNpcStats.mIsWerewolf) if (mObject.mNpcStats.mIsWerewolf)
{ {
if(i == ESM::Skill::Acrobatics) if(i == Skill::Acrobatics)
mSetWerewolfAcrobatics = mObject.mNpcStats.mSkills[i].mBase != skill.mBase; mSetWerewolfAcrobatics = mObject.mNpcStats.mSkills[i].mBase != skill.mBase;
mObject.mNpcStats.mSkills[i] = skill; mObject.mNpcStats.mSkills[i] = skill;
} }
@ -84,7 +87,7 @@ void ESM::Player::load (ESMReader &esm)
} }
} }
void ESM::Player::save (ESMWriter &esm) const void Player::save (ESMWriter &esm) const
{ {
mObject.save (esm); mObject.save (esm);
@ -112,3 +115,5 @@ void ESM::Player::save (ESMWriter &esm) const
esm.writeHNT("WWAT", mSaveAttributes); esm.writeHNT("WWAT", mSaveAttributes);
esm.writeHNT("WWSK", mSaveSkills); esm.writeHNT("WWSK", mSaveSkills);
} }
}

@ -24,15 +24,15 @@ namespace ESM
float mLastKnownExteriorPosition[3]; float mLastKnownExteriorPosition[3];
unsigned char mHasMark; unsigned char mHasMark;
bool mSetWerewolfAcrobatics; bool mSetWerewolfAcrobatics;
ESM::Position mMarkedPosition; Position mMarkedPosition;
CellId mMarkedCell; CellId mMarkedCell;
std::string mBirthsign; std::string mBirthsign;
int mCurrentCrimeId; int mCurrentCrimeId;
int mPaidCrimeId; int mPaidCrimeId;
float mSaveAttributes[ESM::Attribute::Length]; float mSaveAttributes[Attribute::Length];
float mSaveSkills[ESM::Skill::Length]; float mSaveSkills[Skill::Length];
typedef std::map<std::string, std::string> PreviousItems; // previous equipped items, needed for bound spells typedef std::map<std::string, std::string> PreviousItems; // previous equipped items, needed for bound spells
PreviousItems mPreviousItems; PreviousItems mPreviousItems;

@ -38,7 +38,7 @@ namespace ESM
mSpellId = esm.getHNString("SPEL"); mSpellId = esm.getHNString("SPEL");
if (esm.isNextSub("SRCN")) // for backwards compatibility if (esm.isNextSub("SRCN")) // for backwards compatibility
esm.skipHSub(); esm.skipHSub();
ESM::EffectList().load(esm); // for backwards compatibility EffectList().load(esm); // for backwards compatibility
esm.getHNT (mSpeed, "SPED"); esm.getHNT (mSpeed, "SPED");
if(esm.getFormat() < 17) if(esm.getFormat() < 17)
mSlot = 0; mSlot = 0;

@ -3,16 +3,21 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
void ESM::QuestState::load (ESMReader &esm) namespace ESM
{
void QuestState::load (ESMReader &esm)
{ {
mTopic = esm.getHNString ("YETO"); mTopic = esm.getHNString ("YETO");
esm.getHNOT (mState, "QSTA"); esm.getHNOT (mState, "QSTA");
esm.getHNOT (mFinished, "QFIN"); esm.getHNOT (mFinished, "QFIN");
} }
void ESM::QuestState::save (ESMWriter &esm) const void QuestState::save (ESMWriter &esm) const
{ {
esm.writeHNString ("YETO", mTopic); esm.writeHNString ("YETO", mTopic);
esm.writeHNT ("QSTA", mState); esm.writeHNT ("QSTA", mState);
esm.writeHNT ("QFIN", mFinished); esm.writeHNT ("QFIN", mFinished);
} }
}

@ -3,10 +3,13 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
unsigned int ESM::SavedGame::sRecordId = ESM::REC_SAVE; namespace ESM
int ESM::SavedGame::sCurrentFormat = 21; {
unsigned int SavedGame::sRecordId = REC_SAVE;
int SavedGame::sCurrentFormat = 21;
void ESM::SavedGame::load (ESMReader &esm) void SavedGame::load (ESMReader &esm)
{ {
mPlayerName = esm.getHNString("PLNA"); mPlayerName = esm.getHNString("PLNA");
esm.getHNOT (mPlayerLevel, "PLLE"); esm.getHNOT (mPlayerLevel, "PLLE");
@ -28,7 +31,7 @@ void ESM::SavedGame::load (ESMReader &esm)
esm.getExact(mScreenshot.data(), mScreenshot.size()); esm.getExact(mScreenshot.data(), mScreenshot.size());
} }
void ESM::SavedGame::save (ESMWriter &esm) const void SavedGame::save (ESMWriter &esm) const
{ {
esm.writeHNString ("PLNA", mPlayerName); esm.writeHNString ("PLNA", mPlayerName);
esm.writeHNT ("PLLE", mPlayerLevel); esm.writeHNT ("PLLE", mPlayerLevel);
@ -51,3 +54,5 @@ void ESM::SavedGame::save (ESMWriter &esm) const
esm.write(&mScreenshot[0], mScreenshot.size()); esm.write(&mScreenshot[0], mScreenshot.size());
esm.endRecord("SCRN"); esm.endRecord("SCRN");
} }
}

@ -3,7 +3,8 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
namespace ESM { namespace ESM
{
void SpellList::add(ESMReader &esm) void SpellList::add(ESMReader &esm)
{ {

@ -70,7 +70,7 @@ namespace ESM
if (mProgress) if (mProgress)
esm.writeHNT("STPR", mProgress); esm.writeHNT("STPR", mProgress);
} }
}
template struct ESM::StatState<int>; template struct StatState<int>;
template struct ESM::StatState<float>; template struct StatState<float>;
}

@ -15,8 +15,8 @@ namespace ESM
typedef std::map<std::string, std::map<std::pair<std::string, bool>, int> > StolenItemsMap; typedef std::map<std::string, std::map<std::pair<std::string, bool>, int> > StolenItemsMap;
StolenItemsMap mStolenItems; StolenItemsMap mStolenItems;
void load(ESM::ESMReader& esm); void load(ESMReader& esm);
void write(ESM::ESMWriter& esm) const; void write(ESMWriter& esm) const;
}; };
} }

@ -10,13 +10,13 @@ namespace ESM
void Transport::add(ESMReader &esm) void Transport::add(ESMReader &esm)
{ {
if (esm.retSubName().toInt() == ESM::fourCC("DODT")) if (esm.retSubName().toInt() == fourCC("DODT"))
{ {
Dest dodt; Dest dodt;
esm.getHExact(&dodt.mPos, 24); esm.getHExact(&dodt.mPos, 24);
mList.push_back(dodt); mList.push_back(dodt);
} }
else if (esm.retSubName().toInt() == ESM::fourCC("DNAM")) else if (esm.retSubName().toInt() == fourCC("DNAM"))
{ {
const std::string name = esm.getHString(); const std::string name = esm.getHString();
if (mList.empty()) if (mList.empty())

@ -8,12 +8,14 @@
#include "components/esm/defs.hpp" #include "components/esm/defs.hpp"
namespace ESM
{
namespace namespace
{ {
constexpr uint32_t STRV = ESM::fourCC("STRV"); constexpr uint32_t STRV = fourCC("STRV");
constexpr uint32_t INTV = ESM::fourCC("INTV"); constexpr uint32_t INTV = fourCC("INTV");
constexpr uint32_t FLTV = ESM::fourCC("FLTV"); constexpr uint32_t FLTV = fourCC("FLTV");
constexpr uint32_t STTV = ESM::fourCC("STTV"); constexpr uint32_t STTV = fourCC("STTV");
template <typename T, bool orDefault = false> template <typename T, bool orDefault = false>
struct GetValue struct GetValue
@ -48,22 +50,22 @@ namespace
}; };
} }
const std::string& ESM::Variant::getString() const const std::string& Variant::getString() const
{ {
return std::get<std::string>(mData); return std::get<std::string>(mData);
} }
int ESM::Variant::getInteger() const int Variant::getInteger() const
{ {
return std::visit(GetValue<int>{}, mData); return std::visit(GetValue<int>{}, mData);
} }
float ESM::Variant::getFloat() const float Variant::getFloat() const
{ {
return std::visit(GetValue<float>{}, mData); return std::visit(GetValue<float>{}, mData);
} }
void ESM::Variant::read (ESMReader& esm, Format format) void Variant::read (ESMReader& esm, Format format)
{ {
// type // type
VarType type = VT_Unknown; VarType type = VT_Unknown;
@ -152,7 +154,7 @@ void ESM::Variant::read (ESMReader& esm, Format format)
std::visit(ReadESMVariantValue {esm, format, mType}, mData); std::visit(ReadESMVariantValue {esm, format, mType}, mData);
} }
void ESM::Variant::write (ESMWriter& esm, Format format) const void Variant::write (ESMWriter& esm, Format format) const
{ {
if (mType==VT_Unknown) if (mType==VT_Unknown)
{ {
@ -175,7 +177,7 @@ void ESM::Variant::write (ESMWriter& esm, Format format) const
std::visit(WriteESMVariantValue {esm, format, mType}, mData); std::visit(WriteESMVariantValue {esm, format, mType}, mData);
} }
void ESM::Variant::write (std::ostream& stream) const void Variant::write (std::ostream& stream) const
{ {
switch (mType) switch (mType)
{ {
@ -216,7 +218,7 @@ void ESM::Variant::write (std::ostream& stream) const
} }
} }
void ESM::Variant::setType (VarType type) void Variant::setType (VarType type)
{ {
if (type!=mType) if (type!=mType)
{ {
@ -246,28 +248,30 @@ void ESM::Variant::setType (VarType type)
} }
} }
void ESM::Variant::setString (const std::string& value) void Variant::setString (const std::string& value)
{ {
std::get<std::string>(mData) = value; std::get<std::string>(mData) = value;
} }
void ESM::Variant::setString (std::string&& value) void Variant::setString (std::string&& value)
{ {
std::get<std::string>(mData) = std::move(value); std::get<std::string>(mData) = std::move(value);
} }
void ESM::Variant::setInteger (int value) void Variant::setInteger (int value)
{ {
std::visit(SetValue(value), mData); std::visit(SetValue(value), mData);
} }
void ESM::Variant::setFloat (float value) void Variant::setFloat (float value)
{ {
std::visit(SetValue(value), mData); std::visit(SetValue(value), mData);
} }
std::ostream& ESM::operator<< (std::ostream& stream, const Variant& value) std::ostream& operator<< (std::ostream& stream, const Variant& value)
{ {
value.write (stream); value.write (stream);
return stream; return stream;
} }
}

@ -7,7 +7,10 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
void ESM::readESMVariantValue(ESMReader& esm, Variant::Format format, VarType type, std::string& out) namespace ESM
{
void readESMVariantValue(ESMReader& esm, Variant::Format format, VarType type, std::string& out)
{ {
if (type!=VT_String) if (type!=VT_String)
throw std::logic_error ("not a string type"); throw std::logic_error ("not a string type");
@ -25,7 +28,7 @@ void ESM::readESMVariantValue(ESMReader& esm, Variant::Format format, VarType ty
out = esm.getHString(); out = esm.getHString();
} }
void ESM::writeESMVariantValue(ESMWriter& esm, Variant::Format format, VarType type, const std::string& in) void writeESMVariantValue(ESMWriter& esm, Variant::Format format, VarType type, const std::string& in)
{ {
if (type!=VT_String) if (type!=VT_String)
throw std::logic_error ("not a string type"); throw std::logic_error ("not a string type");
@ -43,7 +46,7 @@ void ESM::writeESMVariantValue(ESMWriter& esm, Variant::Format format, VarType t
esm.writeHNString("STRV", in); esm.writeHNString("STRV", in);
} }
void ESM::readESMVariantValue(ESMReader& esm, Variant::Format format, VarType type, int& out) void readESMVariantValue(ESMReader& esm, Variant::Format format, VarType type, int& out)
{ {
if (type!=VT_Short && type!=VT_Long && type!=VT_Int) if (type!=VT_Short && type!=VT_Long && type!=VT_Int)
throw std::logic_error ("not an integer type"); throw std::logic_error ("not an integer type");
@ -93,7 +96,7 @@ void ESM::readESMVariantValue(ESMReader& esm, Variant::Format format, VarType ty
} }
} }
void ESM::writeESMVariantValue(ESMWriter& esm, Variant::Format format, VarType type, int in) void writeESMVariantValue(ESMWriter& esm, Variant::Format format, VarType type, int in)
{ {
if (type!=VT_Short && type!=VT_Long && type!=VT_Int) if (type!=VT_Short && type!=VT_Long && type!=VT_Int)
throw std::logic_error ("not an integer type"); throw std::logic_error ("not an integer type");
@ -133,7 +136,7 @@ void ESM::writeESMVariantValue(ESMWriter& esm, Variant::Format format, VarType t
} }
} }
void ESM::readESMVariantValue(ESMReader& esm, Variant::Format format, VarType type, float& out) void readESMVariantValue(ESMReader& esm, Variant::Format format, VarType type, float& out)
{ {
if (type!=VT_Float) if (type!=VT_Float)
throw std::logic_error ("not a float type"); throw std::logic_error ("not a float type");
@ -148,7 +151,7 @@ void ESM::readESMVariantValue(ESMReader& esm, Variant::Format format, VarType ty
} }
} }
void ESM::writeESMVariantValue(ESMWriter& esm, Variant::Format format, VarType type, float in) void writeESMVariantValue(ESMWriter& esm, Variant::Format format, VarType type, float in)
{ {
if (type!=VT_Float) if (type!=VT_Float)
throw std::logic_error ("not a float type"); throw std::logic_error ("not a float type");
@ -163,3 +166,5 @@ void ESM::writeESMVariantValue(ESMWriter& esm, Variant::Format format, VarType t
esm.writeHNT("FLTV", in); esm.writeHNT("FLTV", in);
} }
} }
}

@ -3,19 +3,22 @@
#include "esmreader.hpp" #include "esmreader.hpp"
#include "esmwriter.hpp" #include "esmwriter.hpp"
namespace ESM
{
namespace namespace
{ {
constexpr ESM::NAME currentRegionRecord = "CREG"; constexpr NAME currentRegionRecord = "CREG";
constexpr ESM::NAME timePassedRecord = "TMPS"; constexpr NAME timePassedRecord = "TMPS";
constexpr ESM::NAME fastForwardRecord = "FAST"; constexpr NAME fastForwardRecord = "FAST";
constexpr ESM::NAME weatherUpdateTimeRecord = "WUPD"; constexpr NAME weatherUpdateTimeRecord = "WUPD";
constexpr ESM::NAME transitionFactorRecord = "TRFC"; constexpr NAME transitionFactorRecord = "TRFC";
constexpr ESM::NAME currentWeatherRecord = "CWTH"; constexpr NAME currentWeatherRecord = "CWTH";
constexpr ESM::NAME nextWeatherRecord = "NWTH"; constexpr NAME nextWeatherRecord = "NWTH";
constexpr ESM::NAME queuedWeatherRecord = "QWTH"; constexpr NAME queuedWeatherRecord = "QWTH";
constexpr ESM::NAME regionNameRecord = "RGNN"; constexpr NAME regionNameRecord = "RGNN";
constexpr ESM::NAME regionWeatherRecord = "RGNW"; constexpr NAME regionWeatherRecord = "RGNW";
constexpr ESM::NAME regionChanceRecord = "RGNC"; constexpr NAME regionChanceRecord = "RGNC";
}
} }
namespace ESM namespace ESM

Loading…
Cancel
Save