1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-30 22:45:36 +00:00

Switch to a constexpr for FourCC constant

Add static asssert on wrong size
This commit is contained in:
duncanspumpkin 2022-03-07 16:05:24 +00:00
parent 8a182c130a
commit 3a117cac22
47 changed files with 323 additions and 323 deletions

View file

@ -263,14 +263,14 @@ namespace ESSImport
const ESM::Header& header = esm.getHeader(); const ESM::Header& header = esm.getHeader();
context.mPlayerCellName = header.mGameData.mCurrentCell.toString(); context.mPlayerCellName = header.mGameData.mCurrentCell.toString();
const unsigned int recREFR = ESM::FourCC<'R','E','F','R'>::value; const unsigned int recREFR = ESM::fourCC("REFR");
const unsigned int recPCDT = ESM::FourCC<'P','C','D','T'>::value; const unsigned int recPCDT = ESM::fourCC("PCDT");
const unsigned int recFMAP = ESM::FourCC<'F','M','A','P'>::value; const unsigned int recFMAP = ESM::fourCC("FMAP");
const unsigned int recKLST = ESM::FourCC<'K','L','S','T'>::value; const unsigned int recKLST = ESM::fourCC("KLST");
const unsigned int recSTLN = ESM::FourCC<'S','T','L','N'>::value; const unsigned int recSTLN = ESM::fourCC("STLN");
const unsigned int recGAME = ESM::FourCC<'G','A','M','E'>::value; const unsigned int recGAME = ESM::fourCC("GAME");
const unsigned int recJOUR = ESM::FourCC<'J','O','U','R'>::value; const unsigned int recJOUR = ESM::fourCC("JOUR");
const unsigned int recSPLM = ESM::FourCC<'S','P','L','M'>::value; const unsigned int recSPLM = ESM::fourCC("SPLM");
std::map<unsigned int, std::shared_ptr<Converter> > converters; std::map<unsigned int, std::shared_ptr<Converter> > converters;
converters[ESM::REC_GLOB] = std::shared_ptr<Converter>(new ConvertGlobal()); converters[ESM::REC_GLOB] = std::shared_ptr<Converter>(new ConvertGlobal());

View file

@ -61,7 +61,7 @@ struct Position
friend inline bool operator<(const Position& l, const Position& r) friend inline bool operator<(const Position& l, const Position& r)
{ {
const auto tuple = [] (const Position& v) { return std::tuple(v.asVec3(), v.asRotationVec3()); }; const auto tuple = [](const Position& v) { return std::tuple(v.asVec3(), v.asRotationVec3()); };
return tuple(l) < tuple(r); return tuple(l) < tuple(r);
} }
}; };
@ -86,100 +86,100 @@ bool inline operator!= (const Position& left, const Position& right) noexcept
left.rot[2] != right.rot[2]; left.rot[2] != right.rot[2];
} }
template <int a, int b, int c, int d> template<std::size_t len>
struct FourCC constexpr unsigned int fourCC(const char(&name)[len]) {
{ static_assert(len == 5, "Constant must be 4 characters long. (Plus null terminator)");
static constexpr unsigned int value = (((((d << 8) | c) << 8) | b) << 8) | a; return static_cast<unsigned char>(name[0]) | (static_cast<unsigned char>(name[1]) << 8) | (static_cast<unsigned char>(name[2]) << 16) | (static_cast<unsigned char>(name[3]) << 24);
}; }
enum RecNameInts : unsigned int enum RecNameInts : unsigned int
{ {
// format 0 / legacy // format 0 / legacy
REC_ACTI = FourCC<'A','C','T','I'>::value, REC_ACTI = fourCC("ACTI"),
REC_ALCH = FourCC<'A','L','C','H'>::value, REC_ALCH = fourCC("ALCH"),
REC_APPA = FourCC<'A','P','P','A'>::value, REC_APPA = fourCC("APPA"),
REC_ARMO = FourCC<'A','R','M','O'>::value, REC_ARMO = fourCC("ARMO"),
REC_BODY = FourCC<'B','O','D','Y'>::value, REC_BODY = fourCC("BODY"),
REC_BOOK = FourCC<'B','O','O','K'>::value, REC_BOOK = fourCC("BOOK"),
REC_BSGN = FourCC<'B','S','G','N'>::value, REC_BSGN = fourCC("BSGN"),
REC_CELL = FourCC<'C','E','L','L'>::value, REC_CELL = fourCC("CELL"),
REC_CLAS = FourCC<'C','L','A','S'>::value, REC_CLAS = fourCC("CLAS"),
REC_CLOT = FourCC<'C','L','O','T'>::value, REC_CLOT = fourCC("CLOT"),
REC_CNTC = FourCC<'C','N','T','C'>::value, REC_CNTC = fourCC("CNTC"),
REC_CONT = FourCC<'C','O','N','T'>::value, REC_CONT = fourCC("CONT"),
REC_CREA = FourCC<'C','R','E','A'>::value, REC_CREA = fourCC("CREA"),
REC_CREC = FourCC<'C','R','E','C'>::value, REC_CREC = fourCC("CREC"),
REC_DIAL = FourCC<'D','I','A','L'>::value, REC_DIAL = fourCC("DIAL"),
REC_DOOR = FourCC<'D','O','O','R'>::value, REC_DOOR = fourCC("DOOR"),
REC_ENCH = FourCC<'E','N','C','H'>::value, REC_ENCH = fourCC("ENCH"),
REC_FACT = FourCC<'F','A','C','T'>::value, REC_FACT = fourCC("FACT"),
REC_GLOB = FourCC<'G','L','O','B'>::value, REC_GLOB = fourCC("GLOB"),
REC_GMST = FourCC<'G','M','S','T'>::value, REC_GMST = fourCC("GMST"),
REC_INFO = FourCC<'I','N','F','O'>::value, REC_INFO = fourCC("INFO"),
REC_INGR = FourCC<'I','N','G','R'>::value, REC_INGR = fourCC("INGR"),
REC_LAND = FourCC<'L','A','N','D'>::value, REC_LAND = fourCC("LAND"),
REC_LEVC = FourCC<'L','E','V','C'>::value, REC_LEVC = fourCC("LEVC"),
REC_LEVI = FourCC<'L','E','V','I'>::value, REC_LEVI = fourCC("LEVI"),
REC_LIGH = FourCC<'L','I','G','H'>::value, REC_LIGH = fourCC("LIGH"),
REC_LOCK = FourCC<'L','O','C','K'>::value, REC_LOCK = fourCC("LOCK"),
REC_LTEX = FourCC<'L','T','E','X'>::value, REC_LTEX = fourCC("LTEX"),
REC_MGEF = FourCC<'M','G','E','F'>::value, REC_MGEF = fourCC("MGEF"),
REC_MISC = FourCC<'M','I','S','C'>::value, REC_MISC = fourCC("MISC"),
REC_NPC_ = FourCC<'N','P','C','_'>::value, REC_NPC_ = fourCC("NPC_"),
REC_NPCC = FourCC<'N','P','C','C'>::value, REC_NPCC = fourCC("NPCC"),
REC_PGRD = FourCC<'P','G','R','D'>::value, REC_PGRD = fourCC("PGRD"),
REC_PROB = FourCC<'P','R','O','B'>::value, REC_PROB = fourCC("PROB"),
REC_RACE = FourCC<'R','A','C','E'>::value, REC_RACE = fourCC("RACE"),
REC_REGN = FourCC<'R','E','G','N'>::value, REC_REGN = fourCC("REGN"),
REC_REPA = FourCC<'R','E','P','A'>::value, REC_REPA = fourCC("REPA"),
REC_SCPT = FourCC<'S','C','P','T'>::value, REC_SCPT = fourCC("SCPT"),
REC_SKIL = FourCC<'S','K','I','L'>::value, REC_SKIL = fourCC("SKIL"),
REC_SNDG = FourCC<'S','N','D','G'>::value, REC_SNDG = fourCC("SNDG"),
REC_SOUN = FourCC<'S','O','U','N'>::value, REC_SOUN = fourCC("SOUN"),
REC_SPEL = FourCC<'S','P','E','L'>::value, REC_SPEL = fourCC("SPEL"),
REC_SSCR = FourCC<'S','S','C','R'>::value, REC_SSCR = fourCC("SSCR"),
REC_STAT = FourCC<'S','T','A','T'>::value, REC_STAT = fourCC("STAT"),
REC_WEAP = FourCC<'W','E','A','P'>::value, REC_WEAP = fourCC("WEAP"),
// format 0 - saved games // format 0 - saved games
REC_SAVE = FourCC<'S','A','V','E'>::value, REC_SAVE = fourCC("SAVE"),
REC_JOUR_LEGACY = FourCC<0xa4,'U','O','R'>::value, // "\xa4UOR", rather than "JOUR", little oversight when magic numbers were REC_JOUR_LEGACY = fourCC("\xa4UOR"), // "\xa4UOR", rather than "JOUR", little oversight when magic numbers were
// calculated by hand, needs to be supported for older files now // calculated by hand, needs to be supported for older files now
REC_JOUR = FourCC<'J','O','U','R'>::value, REC_JOUR = fourCC("JOUR"),
REC_QUES = FourCC<'Q','U','E','S'>::value, REC_QUES = fourCC("QUES"),
REC_GSCR = FourCC<'G','S','C','R'>::value, REC_GSCR = fourCC("GSCR"),
REC_PLAY = FourCC<'P','L','A','Y'>::value, REC_PLAY = fourCC("PLAY"),
REC_CSTA = FourCC<'C','S','T','A'>::value, REC_CSTA = fourCC("CSTA"),
REC_GMAP = FourCC<'G','M','A','P'>::value, REC_GMAP = fourCC("GMAP"),
REC_DIAS = FourCC<'D','I','A','S'>::value, REC_DIAS = fourCC("DIAS"),
REC_WTHR = FourCC<'W','T','H','R'>::value, REC_WTHR = fourCC("WTHR"),
REC_KEYS = FourCC<'K','E','Y','S'>::value, REC_KEYS = fourCC("KEYS"),
REC_DYNA = FourCC<'D','Y','N','A'>::value, REC_DYNA = fourCC("DYNA"),
REC_ASPL = FourCC<'A','S','P','L'>::value, REC_ASPL = fourCC("ASPL"),
REC_ACTC = FourCC<'A','C','T','C'>::value, REC_ACTC = fourCC("ACTC"),
REC_MPRJ = FourCC<'M','P','R','J'>::value, REC_MPRJ = fourCC("MPRJ"),
REC_PROJ = FourCC<'P','R','O','J'>::value, REC_PROJ = fourCC("PROJ"),
REC_DCOU = FourCC<'D','C','O','U'>::value, REC_DCOU = fourCC("DCOU"),
REC_MARK = FourCC<'M','A','R','K'>::value, REC_MARK = fourCC("MARK"),
REC_ENAB = FourCC<'E','N','A','B'>::value, REC_ENAB = fourCC("ENAB"),
REC_CAM_ = FourCC<'C','A','M','_'>::value, REC_CAM_ = fourCC("CAM_"),
REC_STLN = FourCC<'S','T','L','N'>::value, REC_STLN = fourCC("STLN"),
REC_INPU = FourCC<'I','N','P','U'>::value, REC_INPU = fourCC("INPU"),
// format 1 // format 1
REC_FILT = FourCC<'F','I','L','T'>::value, REC_FILT = fourCC("FILT"),
REC_DBGP = FourCC<'D','B','G','P'>::value, ///< only used in project files REC_DBGP = fourCC("DBGP"), ///< only used in project files
REC_LUAL = FourCC<'L','U','A','L'>::value, // LuaScriptsCfg REC_LUAL = fourCC("LUAL"), // LuaScriptsCfg
// format 16 - Lua scripts in saved games // format 16 - Lua scripts in saved games
REC_LUAM = FourCC<'L','U','A','M'>::value, // LuaManager data REC_LUAM = fourCC("LUAM"), // LuaManager data
}; };
/// Common subrecords /// Common subrecords
enum SubRecNameInts enum SubRecNameInts
{ {
SREC_DELE = ESM::FourCC<'D','E','L','E'>::value, SREC_DELE = ESM::fourCC("DELE"),
SREC_NAME = ESM::FourCC<'N','A','M','E'>::value SREC_NAME = ESM::fourCC("NAME")
}; };
} }

View file

@ -22,13 +22,13 @@ namespace ESM
enum AiPackages enum AiPackages
{ {
Ai_Wander = ESM::FourCC<'W','A','N','D'>::value, Ai_Wander = ESM::fourCC("WAND"),
Ai_Travel = ESM::FourCC<'T','R','A','V'>::value, Ai_Travel = ESM::fourCC("TRAV"),
Ai_Escort = ESM::FourCC<'E','S','C','O'>::value, Ai_Escort = ESM::fourCC("ESCO"),
Ai_Follow = ESM::FourCC<'F','O','L','L'>::value, Ai_Follow = ESM::fourCC("FOLL"),
Ai_Activate = ESM::FourCC<'A','C','T','I'>::value, Ai_Activate = ESM::fourCC("ACTI"),
Ai_Combat = ESM::FourCC<'C','O','M','B'>::value, Ai_Combat = ESM::fourCC("COMB"),
Ai_Pursue = ESM::FourCC<'P','U','R','S'>::value Ai_Pursue = ESM::fourCC("PURS")
}; };

View file

@ -63,57 +63,57 @@ void ESM::CellRef::loadData(ESMReader &esm, bool &isDeleted)
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::FourCC<'U','N','A','M'>::value: case ESM::fourCC("UNAM"):
esm.getHT(mReferenceBlocked); esm.getHT(mReferenceBlocked);
break; break;
case ESM::FourCC<'X','S','C','L'>::value: case ESM::fourCC("XSCL"):
esm.getHT(mScale); esm.getHT(mScale);
mScale = std::clamp(mScale, 0.5f, 2.0f); mScale = std::clamp(mScale, 0.5f, 2.0f);
break; break;
case ESM::FourCC<'A','N','A','M'>::value: case ESM::fourCC("ANAM"):
mOwner = esm.getHString(); mOwner = esm.getHString();
break; break;
case ESM::FourCC<'B','N','A','M'>::value: case ESM::fourCC("BNAM"):
mGlobalVariable = esm.getHString(); mGlobalVariable = esm.getHString();
break; break;
case ESM::FourCC<'X','S','O','L'>::value: case ESM::fourCC("XSOL"):
mSoul = esm.getHString(); mSoul = esm.getHString();
break; break;
case ESM::FourCC<'C','N','A','M'>::value: case ESM::fourCC("CNAM"):
mFaction = esm.getHString(); mFaction = esm.getHString();
break; break;
case ESM::FourCC<'I','N','D','X'>::value: case ESM::fourCC("INDX"):
esm.getHT(mFactionRank); esm.getHT(mFactionRank);
break; break;
case ESM::FourCC<'X','C','H','G'>::value: case ESM::fourCC("XCHG"):
esm.getHT(mEnchantmentCharge); esm.getHT(mEnchantmentCharge);
break; break;
case ESM::FourCC<'I','N','T','V'>::value: case ESM::fourCC("INTV"):
esm.getHT(mChargeInt); esm.getHT(mChargeInt);
break; break;
case ESM::FourCC<'N','A','M','9'>::value: case ESM::fourCC("NAM9"):
esm.getHT(mGoldValue); esm.getHT(mGoldValue);
break; break;
case ESM::FourCC<'D','O','D','T'>::value: case ESM::fourCC("DODT"):
esm.getHT(mDoorDest); esm.getHT(mDoorDest);
mTeleport = true; mTeleport = true;
break; break;
case ESM::FourCC<'D','N','A','M'>::value: case ESM::fourCC("DNAM"):
mDestCell = esm.getHString(); mDestCell = esm.getHString();
break; break;
case ESM::FourCC<'F','L','T','V'>::value: case ESM::fourCC("FLTV"):
esm.getHT(mLockLevel); esm.getHT(mLockLevel);
break; break;
case ESM::FourCC<'K','N','A','M'>::value: case ESM::fourCC("KNAM"):
mKey = esm.getHString(); mKey = esm.getHString();
break; break;
case ESM::FourCC<'T','N','A','M'>::value: case ESM::fourCC("TNAM"):
mTrap = esm.getHString(); mTrap = esm.getHString();
break; break;
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
esm.getHT(mPos, 24); esm.getHT(mPos, 24);
break; break;
case ESM::FourCC<'N','A','M','0'>::value: case ESM::fourCC("NAM0"):
{ {
esm.skipHSub(); esm.skipHSub();
break; break;

View file

@ -19,13 +19,13 @@ void ESM::DebugProfile::load (ESMReader& esm, bool &isDeleted)
case ESM::SREC_NAME: case ESM::SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
break; break;
case ESM::FourCC<'D','E','S','C'>::value: case ESM::fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
case ESM::FourCC<'S','C','R','P'>::value: case ESM::fourCC("SCRP"):
mScriptText = esm.getHString(); mScriptText = esm.getHString();
break; break;
case ESM::FourCC<'F','L','A','G'>::value: case ESM::fourCC("FLAG"):
esm.getHT(mFlags); esm.getHT(mFlags);
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -20,10 +20,10 @@ void ESM::Filter::load (ESMReader& esm, bool &isDeleted)
case ESM::SREC_NAME: case ESM::SREC_NAME:
mId = esm.getHString(); mId = esm.getHString();
break; break;
case ESM::FourCC<'F','I','L','T'>::value: case ESM::fourCC("FILT"):
mFilter = esm.getHString(); mFilter = esm.getHString();
break; break;
case ESM::FourCC<'D','E','S','C'>::value: case ESM::fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -23,13 +23,13 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -26,23 +26,23 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'T','E','X','T'>::value: // not ITEX here for some reason case ESM::fourCC("TEXT"): // not ITEX here for some reason
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'A','L','D','T'>::value: case ESM::fourCC("ALDT"):
esm.getHT(mData, 12); esm.getHT(mData, 12);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'E','N','A','M'>::value: case ESM::fourCC("ENAM"):
mEffects.add(esm); mEffects.add(esm);
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -24,20 +24,20 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'A','A','D','T'>::value: case ESM::fourCC("AADT"):
esm.getHT(mData); esm.getHT(mData);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -56,26 +56,26 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'A','O','D','T'>::value: case ESM::fourCC("AODT"):
esm.getHT(mData, 24); esm.getHT(mData, 24);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::FourCC<'E','N','A','M'>::value: case ESM::fourCC("ENAM"):
mEnchant = esm.getHString(); mEnchant = esm.getHString();
break; break;
case ESM::FourCC<'I','N','D','X'>::value: case ESM::fourCC("INDX"):
mParts.add(esm); mParts.add(esm);
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -24,13 +24,13 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mRace = esm.getHString(); mRace = esm.getHString();
break; break;
case ESM::FourCC<'B','Y','D','T'>::value: case ESM::fourCC("BYDT"):
esm.getHT(mData, 4); esm.getHT(mData, 4);
hasData = true; hasData = true;
break; break;

View file

@ -24,26 +24,26 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'B','K','D','T'>::value: case ESM::fourCC("BKDT"):
esm.getHT(mData, 20); esm.getHT(mData, 20);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::FourCC<'E','N','A','M'>::value: case ESM::fourCC("ENAM"):
mEnchant = esm.getHString(); mEnchant = esm.getHString();
break; break;
case ESM::FourCC<'T','E','X','T'>::value: case ESM::fourCC("TEXT"):
mText = esm.getHString(); mText = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -25,16 +25,16 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'T','N','A','M'>::value: case ESM::fourCC("TNAM"):
mTexture = esm.getHString(); mTexture = esm.getHString();
break; break;
case ESM::FourCC<'D','E','S','C'>::value: case ESM::fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
case ESM::FourCC<'N','P','C','S'>::value: case ESM::fourCC("NPCS"):
mPowers.add(esm); mPowers.add(esm);
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -75,7 +75,7 @@ namespace ESM
case ESM::SREC_NAME: case ESM::SREC_NAME:
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
esm.getHT(mData, 12); esm.getHT(mData, 12);
hasData = true; hasData = true;
break; break;
@ -119,13 +119,13 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::FourCC<'I','N','T','V'>::value: case ESM::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<'W','H','G','T'>::value: case ESM::fourCC("WHGT"):
float waterLevel; float waterLevel;
esm.getHT(waterLevel); esm.getHT(waterLevel);
mWaterInt = false; mWaterInt = false;
@ -138,17 +138,17 @@ namespace ESM
else else
mWater = waterLevel; mWater = waterLevel;
break; break;
case ESM::FourCC<'A','M','B','I'>::value: case ESM::fourCC("AMBI"):
esm.getHT(mAmbi); esm.getHT(mAmbi);
mHasAmbi = true; mHasAmbi = true;
break; break;
case ESM::FourCC<'R','G','N','N'>::value: case ESM::fourCC("RGNN"):
mRegion = esm.getHString(); mRegion = esm.getHString();
break; break;
case ESM::FourCC<'N','A','M','5'>::value: case ESM::fourCC("NAM5"):
esm.getHT(mMapColor); esm.getHT(mMapColor);
break; break;
case ESM::FourCC<'N','A','M','0'>::value: case ESM::fourCC("NAM0"):
esm.getHT(mRefNumCounter); esm.getHT(mRefNumCounter);
break; break;
default: default:

View file

@ -54,16 +54,16 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'C','L','D','T'>::value: case ESM::fourCC("CLDT"):
esm.getHT(mData, 60); esm.getHT(mData, 60);
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<'D','E','S','C'>::value: case ESM::fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -26,26 +26,26 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'C','T','D','T'>::value: case ESM::fourCC("CTDT"):
esm.getHT(mData, 12); esm.getHT(mData, 12);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::FourCC<'E','N','A','M'>::value: case ESM::fourCC("ENAM"):
mEnchant = esm.getHString(); mEnchant = esm.getHString();
break; break;
case ESM::FourCC<'I','N','D','X'>::value: case ESM::fourCC("INDX"):
mParts.add(esm); mParts.add(esm);
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -48,17 +48,17 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'C','N','D','T'>::value: case ESM::fourCC("CNDT"):
esm.getHT(mWeight, 4); esm.getHT(mWeight, 4);
hasWeight = true; hasWeight = true;
break; break;
case ESM::FourCC<'F','L','A','G'>::value: case ESM::fourCC("FLAG"):
esm.getHT(mFlags, 4); esm.getHT(mFlags, 4);
if (mFlags & 0xf4) if (mFlags & 0xf4)
esm.fail("Unknown flags"); esm.fail("Unknown flags");
@ -66,10 +66,10 @@ namespace ESM
esm.fail("Flag 8 not set"); esm.fail("Flag 8 not set");
hasFlags = true; hasFlags = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'N','P','C','O'>::value: case ESM::fourCC("NPCO"):
mInventory.add(esm); mInventory.add(esm);
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -37,43 +37,43 @@ namespace ESM {
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'C','N','A','M'>::value: case ESM::fourCC("CNAM"):
mOriginal = esm.getHString(); mOriginal = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'N','P','D','T'>::value: case ESM::fourCC("NPDT"):
esm.getHT(mData, 96); esm.getHT(mData, 96);
hasNpdt = true; hasNpdt = true;
break; break;
case ESM::FourCC<'F','L','A','G'>::value: case ESM::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<'X','S','C','L'>::value: case ESM::fourCC("XSCL"):
esm.getHT(mScale); esm.getHT(mScale);
break; break;
case ESM::FourCC<'N','P','C','O'>::value: case ESM::fourCC("NPCO"):
mInventory.add(esm); mInventory.add(esm);
break; break;
case ESM::FourCC<'N','P','C','S'>::value: case ESM::fourCC("NPCS"):
mSpells.add(esm); mSpells.add(esm);
break; break;
case ESM::FourCC<'A','I','D','T'>::value: case ESM::fourCC("AIDT"):
esm.getHExact(&mAiData, sizeof(mAiData)); esm.getHExact(&mAiData, sizeof(mAiData));
break; break;
case ESM::FourCC<'D','O','D','T'>::value: case ESM::fourCC("DODT"):
case ESM::FourCC<'D','N','A','M'>::value: case ESM::fourCC("DNAM"):
mTransport.add(esm); mTransport.add(esm);
break; break;
case AI_Wander: case AI_Wander:
@ -88,7 +88,7 @@ namespace ESM {
esm.skipHSub(); esm.skipHSub();
isDeleted = true; isDeleted = true;
break; break;
case ESM::FourCC<'I','N','D','X'>::value: case ESM::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);

View file

@ -30,7 +30,7 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
{ {
esm.getSubHeader(); esm.getSubHeader();
int size = esm.getSubSize(); int size = esm.getSubSize();

View file

@ -23,19 +23,19 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'S','N','A','M'>::value: case ESM::fourCC("SNAM"):
mOpenSound = esm.getHString(); mOpenSound = esm.getHString();
break; break;
case ESM::FourCC<'A','N','A','M'>::value: case ESM::fourCC("ANAM"):
mCloseSound = esm.getHString(); mCloseSound = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -25,11 +25,11 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'E','N','D','T'>::value: case ESM::fourCC("ENDT"):
esm.getHT(mData, 16); esm.getHT(mData, 16);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'E','N','A','M'>::value: case ESM::fourCC("ENAM"):
mEffects.add(esm); mEffects.add(esm);
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -47,21 +47,21 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'R','N','A','M'>::value: case ESM::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<'F','A','D','T'>::value: case ESM::fourCC("FADT"):
esm.getHT(mData, 240); esm.getHT(mData, 240);
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<'A','N','A','M'>::value: case ESM::fourCC("ANAM"):
{ {
std::string faction = esm.getHString(); std::string faction = esm.getHString();
int reaction; int reaction;

View file

@ -25,19 +25,19 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
esm.getHT(mData, 12); esm.getHT(mData, 12);
break; break;
case ESM::FourCC<'O','N','A','M'>::value: case ESM::fourCC("ONAM"):
mActor = esm.getHString(); mActor = esm.getHString();
break; break;
case ESM::FourCC<'R','N','A','M'>::value: case ESM::fourCC("RNAM"):
mRace = esm.getHString(); mRace = esm.getHString();
break; break;
case ESM::FourCC<'C','N','A','M'>::value: case ESM::fourCC("CNAM"):
mClass = esm.getHString(); mClass = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::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<'A','N','A','M'>::value: case ESM::fourCC("ANAM"):
mCell = esm.getHString(); mCell = esm.getHString();
break; break;
case ESM::FourCC<'D','N','A','M'>::value: case ESM::fourCC("DNAM"):
mPcFaction = esm.getHString(); mPcFaction = esm.getHString();
break; break;
case ESM::FourCC<'S','N','A','M'>::value: case ESM::fourCC("SNAM"):
mSound = esm.getHString(); mSound = esm.getHString();
break; break;
case ESM::SREC_NAME: case ESM::SREC_NAME:
mResponse = esm.getHString(); mResponse = esm.getHString();
break; break;
case ESM::FourCC<'S','C','V','R'>::value: case ESM::fourCC("SCVR"):
{ {
SelectStruct ss; SelectStruct ss;
ss.mSelectRule = esm.getHString(); ss.mSelectRule = esm.getHString();
@ -66,18 +66,18 @@ namespace ESM
mSelects.push_back(ss); mSelects.push_back(ss);
break; break;
} }
case ESM::FourCC<'B','N','A','M'>::value: case ESM::fourCC("BNAM"):
mResultScript = esm.getHString(); mResultScript = esm.getHString();
break; break;
case ESM::FourCC<'Q','S','T','N'>::value: case ESM::fourCC("QSTN"):
mQuestStatus = QS_Name; mQuestStatus = QS_Name;
esm.skipRecord(); esm.skipRecord();
break; break;
case ESM::FourCC<'Q','S','T','F'>::value: case ESM::fourCC("QSTF"):
mQuestStatus = QS_Finished; mQuestStatus = QS_Finished;
esm.skipRecord(); esm.skipRecord();
break; break;
case ESM::FourCC<'Q','S','T','R'>::value: case ESM::fourCC("QSTR"):
mQuestStatus = QS_Restart; mQuestStatus = QS_Restart;
esm.skipRecord(); esm.skipRecord();
break; break;

View file

@ -24,20 +24,20 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'I','R','D','T'>::value: case ESM::fourCC("IRDT"):
esm.getHT(mData, 56); esm.getHT(mData, 56);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -46,7 +46,7 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::FourCC<'I','N','T','V'>::value: case ESM::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,7 +54,7 @@ namespace ESM
esm.getT<int>(mY); esm.getT<int>(mY);
hasLocation = true; hasLocation = true;
break; break;
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
esm.getHT(mFlags); esm.getHT(mFlags);
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:
@ -82,23 +82,23 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::FourCC<'V','N','M','L'>::value: case ESM::fourCC("VNML"):
esm.skipHSub(); esm.skipHSub();
mDataTypes |= DATA_VNML; mDataTypes |= DATA_VNML;
break; break;
case ESM::FourCC<'V','H','G','T'>::value: case ESM::fourCC("VHGT"):
esm.skipHSub(); esm.skipHSub();
mDataTypes |= DATA_VHGT; mDataTypes |= DATA_VHGT;
break; break;
case ESM::FourCC<'W','N','A','M'>::value: case ESM::fourCC("WNAM"):
esm.getHExact(mWnam, sizeof(mWnam)); esm.getHExact(mWnam, sizeof(mWnam));
mDataTypes |= DATA_WNAM; mDataTypes |= DATA_WNAM;
break; break;
case ESM::FourCC<'V','C','L','R'>::value: case ESM::fourCC("VCLR"):
esm.skipHSub(); esm.skipHSub();
mDataTypes |= DATA_VCLR; mDataTypes |= DATA_VCLR;
break; break;
case ESM::FourCC<'V','T','E','X'>::value: case ESM::fourCC("VTEX"):
esm.skipHSub(); esm.skipHSub();
mDataTypes |= DATA_VTEX; mDataTypes |= DATA_VTEX;
break; break;

View file

@ -22,13 +22,13 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
esm.getHT(mFlags); esm.getHT(mFlags);
break; break;
case ESM::FourCC<'N','N','A','M'>::value: case ESM::fourCC("NNAM"):
esm.getHT(mChanceNone); esm.getHT(mChanceNone);
break; break;
case ESM::FourCC<'I','N','D','X'>::value: case ESM::fourCC("INDX"):
{ {
int length = 0; int length = 0;
esm.getHT(length); esm.getHT(length);

View file

@ -24,23 +24,23 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::FourCC<'L','H','D','T'>::value: case ESM::fourCC("LHDT"):
esm.getHT(mData, 24); esm.getHT(mData, 24);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'S','N','A','M'>::value: case ESM::fourCC("SNAM"):
mSound = esm.getHString(); mSound = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -24,20 +24,20 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'L','K','D','T'>::value: case ESM::fourCC("LKDT"):
esm.getHT(mData, 16); esm.getHT(mData, 16);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -23,11 +23,11 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'I','N','T','V'>::value: case ESM::fourCC("INTV"):
esm.getHT(mIndex); esm.getHT(mIndex);
hasIndex = true; hasIndex = true;
break; break;
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
mTexture = esm.getHString(); mTexture = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -211,37 +211,37 @@ void MagicEffect::load(ESMReader &esm, bool &isDeleted)
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::FourCC<'P','T','E','X'>::value: case ESM::fourCC("PTEX"):
mParticle = esm.getHString(); mParticle = esm.getHString();
break; break;
case ESM::FourCC<'B','S','N','D'>::value: case ESM::fourCC("BSND"):
mBoltSound = esm.getHString(); mBoltSound = esm.getHString();
break; break;
case ESM::FourCC<'C','S','N','D'>::value: case ESM::fourCC("CSND"):
mCastSound = esm.getHString(); mCastSound = esm.getHString();
break; break;
case ESM::FourCC<'H','S','N','D'>::value: case ESM::fourCC("HSND"):
mHitSound = esm.getHString(); mHitSound = esm.getHString();
break; break;
case ESM::FourCC<'A','S','N','D'>::value: case ESM::fourCC("ASND"):
mAreaSound = esm.getHString(); mAreaSound = esm.getHString();
break; break;
case ESM::FourCC<'C','V','F','X'>::value: case ESM::fourCC("CVFX"):
mCasting = esm.getHString(); mCasting = esm.getHString();
break; break;
case ESM::FourCC<'B','V','F','X'>::value: case ESM::fourCC("BVFX"):
mBolt = esm.getHString(); mBolt = esm.getHString();
break; break;
case ESM::FourCC<'H','V','F','X'>::value: case ESM::fourCC("HVFX"):
mHit = esm.getHString(); mHit = esm.getHString();
break; break;
case ESM::FourCC<'A','V','F','X'>::value: case ESM::fourCC("AVFX"):
mArea = esm.getHString(); mArea = esm.getHString();
break; break;
case ESM::FourCC<'D','E','S','C'>::value: case ESM::fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
default: default:

View file

@ -24,20 +24,20 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'M','C','D','T'>::value: case ESM::fourCC("MCDT"):
esm.getHT(mData, 12); esm.getHT(mData, 12);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -32,31 +32,31 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'R','N','A','M'>::value: case ESM::fourCC("RNAM"):
mRace = esm.getHString(); mRace = esm.getHString();
break; break;
case ESM::FourCC<'C','N','A','M'>::value: case ESM::fourCC("CNAM"):
mClass = esm.getHString(); mClass = esm.getHString();
break; break;
case ESM::FourCC<'A','N','A','M'>::value: case ESM::fourCC("ANAM"):
mFaction = esm.getHString(); mFaction = esm.getHString();
break; break;
case ESM::FourCC<'B','N','A','M'>::value: case ESM::fourCC("BNAM"):
mHead = esm.getHString(); mHead = esm.getHString();
break; break;
case ESM::FourCC<'K','N','A','M'>::value: case ESM::fourCC("KNAM"):
mHair = esm.getHString(); mHair = esm.getHString();
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'N','P','D','T'>::value: case ESM::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<'F','L','A','G'>::value: case ESM::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<'N','P','C','S'>::value: case ESM::fourCC("NPCS"):
mSpells.add(esm); mSpells.add(esm);
break; break;
case ESM::FourCC<'N','P','C','O'>::value: case ESM::fourCC("NPCO"):
mInventory.add(esm); mInventory.add(esm);
break; break;
case ESM::FourCC<'A','I','D','T'>::value: case ESM::fourCC("AIDT"):
esm.getHExact(&mAiData, sizeof(mAiData)); esm.getHExact(&mAiData, sizeof(mAiData));
break; break;
case ESM::FourCC<'D','O','D','T'>::value: case ESM::fourCC("DODT"):
case ESM::FourCC<'D','N','A','M'>::value: case ESM::fourCC("DNAM"):
mTransport.add(esm); mTransport.add(esm);
break; break;
case AI_Wander: case AI_Wander:

View file

@ -51,11 +51,11 @@ namespace ESM
case ESM::SREC_NAME: case ESM::SREC_NAME:
mCell = esm.getHString(); mCell = esm.getHString();
break; break;
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
esm.getHT(mData, 12); esm.getHT(mData, 12);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'P','G','R','P'>::value: case ESM::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<'P','G','R','C'>::value: case ESM::fourCC("PGRC"):
{ {
esm.getSubHeader(); esm.getSubHeader();
int size = esm.getSubSize(); int size = esm.getSubSize();

View file

@ -24,20 +24,20 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'P','B','D','T'>::value: case ESM::fourCC("PBDT"):
esm.getHT(mData, 16); esm.getHT(mData, 16);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -36,17 +36,17 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'R','A','D','T'>::value: case ESM::fourCC("RADT"):
esm.getHT(mData, 140); esm.getHT(mData, 140);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'D','E','S','C'>::value: case ESM::fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
case ESM::FourCC<'N','P','C','S'>::value: case ESM::fourCC("NPCS"):
mPowers.add(esm); mPowers.add(esm);
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -23,10 +23,10 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'W','E','A','T'>::value: case ESM::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<'B','N','A','M'>::value: case ESM::fourCC("BNAM"):
mSleepList = esm.getHString(); mSleepList = esm.getHString();
break; break;
case ESM::FourCC<'C','N','A','M'>::value: case ESM::fourCC("CNAM"):
esm.getHT(mMapColor); esm.getHT(mMapColor);
break; break;
case ESM::FourCC<'S','N','A','M'>::value: case ESM::fourCC("SNAM"):
{ {
esm.getSubHeader(); esm.getSubHeader();
SoundRef sr; SoundRef sr;

View file

@ -24,20 +24,20 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'R','I','D','T'>::value: case ESM::fourCC("RIDT"):
esm.getHT(mData, 16); esm.getHT(mData, 16);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -93,7 +93,7 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::FourCC<'S','C','H','D'>::value: case ESM::fourCC("SCHD"):
{ {
esm.getSubHeader(); esm.getSubHeader();
mId = esm.getString(32); mId = esm.getString(32);
@ -102,11 +102,11 @@ namespace ESM
hasHeader = true; hasHeader = true;
break; break;
} }
case ESM::FourCC<'S','C','V','R'>::value: case ESM::fourCC("SCVR"):
// list of local variables // list of local variables
loadSCVR(esm); loadSCVR(esm);
break; break;
case ESM::FourCC<'S','C','D','T'>::value: case ESM::fourCC("SCDT"):
{ {
// compiled script // compiled script
esm.getSubHeader(); esm.getSubHeader();
@ -125,7 +125,7 @@ namespace ESM
esm.getExact(mScriptData.data(), mScriptData.size()); esm.getExact(mScriptData.data(), mScriptData.size());
break; break;
} }
case ESM::FourCC<'S','C','T','X'>::value: case ESM::fourCC("SCTX"):
mScriptText = esm.getHString(); mScriptText = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -139,15 +139,15 @@ namespace ESM
esm.getSubName(); esm.getSubName();
switch (esm.retSubName().toInt()) switch (esm.retSubName().toInt())
{ {
case ESM::FourCC<'I','N','D','X'>::value: case ESM::fourCC("INDX"):
esm.getHT(mIndex); esm.getHT(mIndex);
hasIndex = true; hasIndex = true;
break; break;
case ESM::FourCC<'S','K','D','T'>::value: case ESM::fourCC("SKDT"):
esm.getHT(mData, 24); esm.getHT(mData, 24);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'D','E','S','C'>::value: case ESM::fourCC("DESC"):
mDescription = esm.getHString(); mDescription = esm.getHString();
break; break;
default: default:

View file

@ -24,14 +24,14 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
esm.getHT(mType, 4); esm.getHT(mType, 4);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'C','N','A','M'>::value: case ESM::fourCC("CNAM"):
mCreature = esm.getHString(); mCreature = esm.getHString();
break; break;
case ESM::FourCC<'S','N','A','M'>::value: case ESM::fourCC("SNAM"):
mSound = esm.getHString(); mSound = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -24,10 +24,10 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mSound = esm.getHString(); mSound = esm.getHString();
break; break;
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
esm.getHT(mData, 3); esm.getHT(mData, 3);
hasData = true; hasData = true;
break; break;

View file

@ -26,14 +26,14 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'S','P','D','T'>::value: case ESM::fourCC("SPDT"):
esm.getHT(mData, 12); esm.getHT(mData, 12);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'E','N','A','M'>::value: case ESM::fourCC("ENAM"):
ENAMstruct s; ENAMstruct s;
esm.getHT(s, 24); esm.getHT(s, 24);
mEffects.mList.push_back(s); mEffects.mList.push_back(s);

View file

@ -24,7 +24,7 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'D','A','T','A'>::value: case ESM::fourCC("DATA"):
mData = esm.getHString(); mData = esm.getHString();
hasData = true; hasData = true;
break; break;

View file

@ -25,7 +25,7 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -24,23 +24,23 @@ namespace ESM
mId = esm.getHString(); mId = esm.getHString();
hasName = true; hasName = true;
break; break;
case ESM::FourCC<'M','O','D','L'>::value: case ESM::fourCC("MODL"):
mModel = esm.getHString(); mModel = esm.getHString();
break; break;
case ESM::FourCC<'F','N','A','M'>::value: case ESM::fourCC("FNAM"):
mName = esm.getHString(); mName = esm.getHString();
break; break;
case ESM::FourCC<'W','P','D','T'>::value: case ESM::fourCC("WPDT"):
esm.getHT(mData, 32); esm.getHT(mData, 32);
hasData = true; hasData = true;
break; break;
case ESM::FourCC<'S','C','R','I'>::value: case ESM::fourCC("SCRI"):
mScript = esm.getHString(); mScript = esm.getHString();
break; break;
case ESM::FourCC<'I','T','E','X'>::value: case ESM::fourCC("ITEX"):
mIcon = esm.getHString(); mIcon = esm.getHString();
break; break;
case ESM::FourCC<'E','N','A','M'>::value: case ESM::fourCC("ENAM"):
mEnchant = esm.getHString(); mEnchant = esm.getHString();
break; break;
case ESM::SREC_DELE: case ESM::SREC_DELE:

View file

@ -10,13 +10,13 @@ namespace ESM
void Transport::add(ESMReader &esm) void Transport::add(ESMReader &esm)
{ {
if (esm.retSubName().toInt() == ESM::FourCC<'D','O','D','T'>::value) if (esm.retSubName().toInt() == ESM::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<'D','N','A','M'>::value) else if (esm.retSubName().toInt() == ESM::fourCC("DNAM"))
{ {
const std::string name = esm.getHString(); const std::string name = esm.getHString();
if (mList.empty()) if (mList.empty())

View file

@ -10,10 +10,10 @@
namespace namespace
{ {
constexpr uint32_t STRV = ESM::FourCC<'S','T','R','V'>::value; constexpr uint32_t STRV = ESM::fourCC("STRV");
constexpr uint32_t INTV = ESM::FourCC<'I','N','T','V'>::value; constexpr uint32_t INTV = ESM::fourCC("INTV");
constexpr uint32_t FLTV = ESM::FourCC<'F','L','T','V'>::value; constexpr uint32_t FLTV = ESM::fourCC("FLTV");
constexpr uint32_t STTV = ESM::FourCC<'S','T','T','V'>::value; constexpr uint32_t STTV = ESM::fourCC("STTV");
template <typename T, bool orDefault = false> template <typename T, bool orDefault = false>
struct GetValue struct GetValue