From c42e74dadf1160a908dff63a4a1c48763a766202 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Tue, 24 Sep 2013 13:17:28 +0200 Subject: [PATCH] make 4 byte record type accessable from record struct --- apps/opencs/model/doc/saving.cpp | 24 +++++++++++------------- apps/opencs/model/doc/savingstages.hpp | 12 ++++-------- components/esm/loadacti.cpp | 3 +++ components/esm/loadacti.hpp | 2 ++ components/esm/loadalch.cpp | 3 +++ components/esm/loadalch.hpp | 2 ++ components/esm/loadappa.cpp | 3 +++ components/esm/loadappa.hpp | 2 ++ components/esm/loadarmo.cpp | 3 +++ components/esm/loadarmo.hpp | 2 ++ components/esm/loadbody.cpp | 3 +++ components/esm/loadbody.hpp | 2 ++ components/esm/loadbook.cpp | 2 ++ components/esm/loadbook.hpp | 2 ++ components/esm/loadbsgn.cpp | 2 ++ components/esm/loadbsgn.hpp | 2 ++ components/esm/loadcell.cpp | 2 ++ components/esm/loadcell.hpp | 3 ++- components/esm/loadclas.cpp | 2 ++ components/esm/loadclas.hpp | 2 ++ components/esm/loadclot.cpp | 2 ++ components/esm/loadclot.hpp | 2 ++ components/esm/loadcont.cpp | 3 +++ components/esm/loadcont.hpp | 2 ++ components/esm/loadcrea.cpp | 3 +++ components/esm/loadcrea.hpp | 2 ++ components/esm/loadcrec.hpp | 2 ++ components/esm/loaddial.cpp | 2 ++ components/esm/loaddial.hpp | 2 ++ components/esm/loaddoor.cpp | 2 ++ components/esm/loaddoor.hpp | 2 ++ components/esm/loadench.cpp | 2 ++ components/esm/loadench.hpp | 2 ++ components/esm/loadfact.cpp | 3 +++ components/esm/loadfact.hpp | 2 ++ components/esm/loadglob.cpp | 4 ++++ components/esm/loadglob.hpp | 2 ++ components/esm/loadgmst.cpp | 4 ++++ components/esm/loadgmst.hpp | 2 ++ components/esm/loadinfo.cpp | 2 ++ components/esm/loadinfo.hpp | 2 ++ components/esm/loadingr.cpp | 2 ++ components/esm/loadingr.hpp | 2 ++ components/esm/loadland.cpp | 2 ++ components/esm/loadland.hpp | 2 ++ components/esm/loadlevlist.cpp | 5 +++++ components/esm/loadlevlist.hpp | 4 ++++ components/esm/loadligh.cpp | 2 ++ components/esm/loadligh.hpp | 2 ++ components/esm/loadlock.cpp | 2 ++ components/esm/loadlock.hpp | 2 ++ components/esm/loadltex.cpp | 2 ++ components/esm/loadltex.hpp | 2 ++ components/esm/loadmgef.cpp | 2 ++ components/esm/loadmgef.hpp | 2 ++ components/esm/loadmisc.cpp | 2 ++ components/esm/loadmisc.hpp | 2 ++ components/esm/loadnpc.cpp | 2 ++ components/esm/loadnpc.hpp | 2 ++ components/esm/loadnpcc.hpp | 2 ++ components/esm/loadpgrd.cpp | 2 ++ components/esm/loadpgrd.hpp | 2 ++ components/esm/loadprob.cpp | 2 ++ components/esm/loadprob.hpp | 2 ++ components/esm/loadrace.cpp | 3 +++ components/esm/loadrace.hpp | 2 ++ components/esm/loadregn.cpp | 2 ++ components/esm/loadregn.hpp | 2 ++ components/esm/loadrepa.cpp | 2 ++ components/esm/loadrepa.hpp | 2 ++ components/esm/loadscpt.cpp | 3 +++ components/esm/loadscpt.hpp | 2 ++ components/esm/loadskil.cpp | 3 +++ components/esm/loadskil.hpp | 2 ++ components/esm/loadsndg.cpp | 2 ++ components/esm/loadsndg.hpp | 2 ++ components/esm/loadsoun.cpp | 2 ++ components/esm/loadsoun.hpp | 2 ++ components/esm/loadspel.cpp | 2 ++ components/esm/loadspel.hpp | 2 ++ components/esm/loadsscr.cpp | 2 ++ components/esm/loadsscr.hpp | 2 ++ components/esm/loadstat.cpp | 2 ++ components/esm/loadstat.hpp | 2 ++ components/esm/loadtes3.cpp | 1 + components/esm/loadweap.cpp | 2 ++ components/esm/loadweap.hpp | 2 ++ 87 files changed, 204 insertions(+), 22 deletions(-) diff --git a/apps/opencs/model/doc/saving.cpp b/apps/opencs/model/doc/saving.cpp index 7e0b10d66..c9035cfd4 100644 --- a/apps/opencs/model/doc/saving.cpp +++ b/apps/opencs/model/doc/saving.cpp @@ -1,8 +1,6 @@ #include "saving.hpp" -#include - #include "../world/data.hpp" #include "../world/idcollection.hpp" @@ -18,37 +16,37 @@ CSMDoc::Saving::Saving (Document& document) appendStage (new WriteHeaderStage (mDocument, mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getGlobals(), mState, ESM::REC_GLOB)); + (mDocument.getData().getGlobals(), mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getGmsts(), mState, ESM::REC_GMST)); + (mDocument.getData().getGmsts(), mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getSkills(), mState, ESM::REC_SKIL)); + (mDocument.getData().getSkills(), mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getClasses(), mState, ESM::REC_CLAS)); + (mDocument.getData().getClasses(), mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getFactions(), mState, ESM::REC_FACT)); + (mDocument.getData().getFactions(), mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getRaces(), mState, ESM::REC_RACE)); + (mDocument.getData().getRaces(), mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getSounds(), mState, ESM::REC_SOUN)); + (mDocument.getData().getSounds(), mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getScripts(), mState, ESM::REC_SCPT)); + (mDocument.getData().getScripts(), mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getRegions(), mState, ESM::REC_REGN)); + (mDocument.getData().getRegions(), mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getBirthsigns(), mState, ESM::REC_BSGN)); + (mDocument.getData().getBirthsigns(), mState)); appendStage (new WriteCollectionStage > - (mDocument.getData().getSpells(), mState, ESM::REC_SPEL)); + (mDocument.getData().getSpells(), mState)); appendStage (new CloseSaveStage (mState)); diff --git a/apps/opencs/model/doc/savingstages.hpp b/apps/opencs/model/doc/savingstages.hpp index 96b1fe17f..d5c4a69af 100644 --- a/apps/opencs/model/doc/savingstages.hpp +++ b/apps/opencs/model/doc/savingstages.hpp @@ -1,8 +1,6 @@ #ifndef CSM_DOC_SAVINGSTAGES_H #define CSM_DOC_SAVINGSTAGES_H -#include - #include "stage.hpp" #include "savingstate.hpp" @@ -52,12 +50,10 @@ namespace CSMDoc { const CollectionT& mCollection; SavingState& mState; - ESM::RecNameInts mRecordType; public: - WriteCollectionStage (const CollectionT& collection, SavingState& state, - ESM::RecNameInts recordType); + WriteCollectionStage (const CollectionT& collection, SavingState& state); virtual int setup(); ///< \return number of steps @@ -68,8 +64,8 @@ namespace CSMDoc template WriteCollectionStage::WriteCollectionStage (const CollectionT& collection, - SavingState& state, ESM::RecNameInts recordType) - : mCollection (collection), mState (state), mRecordType (recordType) + SavingState& state) + : mCollection (collection), mState (state) {} template @@ -89,7 +85,7 @@ namespace CSMDoc std::string type; for (int i=0; i<4; ++i) /// \todo make endianess agnostic (change ESMWriter interface?) - type += reinterpret_cast (&mRecordType)[i]; + type += reinterpret_cast (&mCollection.getRecord (stage).mModified.sRecordId)[i]; mState.getWriter().startRecord (type); mState.getWriter().writeHNCString ("NAME", mCollection.getId (stage)); diff --git a/components/esm/loadacti.cpp b/components/esm/loadacti.cpp index dcae845d0..6ba0df0b3 100644 --- a/components/esm/loadacti.cpp +++ b/components/esm/loadacti.cpp @@ -2,9 +2,12 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Activator::sRecordId = REC_ACTI; + void Activator::load(ESMReader &esm) { mModel = esm.getHNString("MODL"); diff --git a/components/esm/loadacti.hpp b/components/esm/loadacti.hpp index 6b072ee11..88f27de27 100644 --- a/components/esm/loadacti.hpp +++ b/components/esm/loadacti.hpp @@ -11,6 +11,8 @@ class ESMWriter; struct Activator { + static unsigned int sRecordId; + std::string mId, mName, mScript, mModel; void load(ESMReader &esm); diff --git a/components/esm/loadalch.cpp b/components/esm/loadalch.cpp index 187069c2e..f6bfc6a11 100644 --- a/components/esm/loadalch.cpp +++ b/components/esm/loadalch.cpp @@ -2,9 +2,12 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Potion::sRecordId = REC_ALCH; + void Potion::load(ESMReader &esm) { mModel = esm.getHNString("MODL"); diff --git a/components/esm/loadalch.hpp b/components/esm/loadalch.hpp index 8f0435292..141765aa8 100644 --- a/components/esm/loadalch.hpp +++ b/components/esm/loadalch.hpp @@ -17,6 +17,8 @@ class ESMWriter; struct Potion { + static unsigned int sRecordId; + struct ALDTstruct { float mWeight; diff --git a/components/esm/loadappa.cpp b/components/esm/loadappa.cpp index 01233a055..29ea78acc 100644 --- a/components/esm/loadappa.cpp +++ b/components/esm/loadappa.cpp @@ -2,9 +2,12 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Apparatus::sRecordId = REC_APPA; + void Apparatus::load(ESMReader &esm) { // we will not treat duplicated subrecords as errors here diff --git a/components/esm/loadappa.hpp b/components/esm/loadappa.hpp index d47643c6c..adc8e071f 100644 --- a/components/esm/loadappa.hpp +++ b/components/esm/loadappa.hpp @@ -15,6 +15,8 @@ class ESMWriter; struct Apparatus { + static unsigned int sRecordId; + enum AppaType { MortarPestle = 0, diff --git a/components/esm/loadarmo.cpp b/components/esm/loadarmo.cpp index 4dbdf1314..ec8ff4f20 100644 --- a/components/esm/loadarmo.cpp +++ b/components/esm/loadarmo.cpp @@ -2,6 +2,7 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { @@ -28,6 +29,8 @@ void PartReferenceList::save(ESMWriter &esm) const } } +unsigned int Armor::sRecordId = REC_ARMO; + void Armor::load(ESMReader &esm) { mModel = esm.getHNString("MODL"); diff --git a/components/esm/loadarmo.hpp b/components/esm/loadarmo.hpp index 5a38605e3..991f4e185 100644 --- a/components/esm/loadarmo.hpp +++ b/components/esm/loadarmo.hpp @@ -61,6 +61,8 @@ struct PartReferenceList struct Armor { + static unsigned int sRecordId; + enum Type { Helmet = 0, diff --git a/components/esm/loadbody.cpp b/components/esm/loadbody.cpp index a5d986f65..4015e6c91 100644 --- a/components/esm/loadbody.cpp +++ b/components/esm/loadbody.cpp @@ -2,9 +2,12 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int BodyPart::sRecordId = REC_BODY; + void BodyPart::load(ESMReader &esm) { diff --git a/components/esm/loadbody.hpp b/components/esm/loadbody.hpp index a8fd36aef..9623caa31 100644 --- a/components/esm/loadbody.hpp +++ b/components/esm/loadbody.hpp @@ -11,6 +11,8 @@ class ESMWriter; struct BodyPart { + static unsigned int sRecordId; + enum MeshPart { MP_Head = 0, diff --git a/components/esm/loadbook.cpp b/components/esm/loadbook.cpp index d9db11889..c8b7e9478 100644 --- a/components/esm/loadbook.cpp +++ b/components/esm/loadbook.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Book::sRecordId = REC_BOOK; void Book::load(ESMReader &esm) { diff --git a/components/esm/loadbook.hpp b/components/esm/loadbook.hpp index 688e9dd75..f96fbd709 100644 --- a/components/esm/loadbook.hpp +++ b/components/esm/loadbook.hpp @@ -14,6 +14,8 @@ class ESMWriter; struct Book { + static unsigned int sRecordId; + struct BKDTstruct { float mWeight; diff --git a/components/esm/loadbsgn.cpp b/components/esm/loadbsgn.cpp index 9d19f02c7..55e1e7f65 100644 --- a/components/esm/loadbsgn.cpp +++ b/components/esm/loadbsgn.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int BirthSign::sRecordId = REC_BSGN; void BirthSign::load(ESMReader &esm) { diff --git a/components/esm/loadbsgn.hpp b/components/esm/loadbsgn.hpp index 1ecb5e418..9f9435c8f 100644 --- a/components/esm/loadbsgn.hpp +++ b/components/esm/loadbsgn.hpp @@ -13,6 +13,8 @@ class ESMWriter; struct BirthSign { + static unsigned int sRecordId; + std::string mId, mName, mDescription, mTexture; // List of powers and abilities that come with this birth sign. diff --git a/components/esm/loadcell.cpp b/components/esm/loadcell.cpp index 9b3aa09e8..c22c1b22b 100644 --- a/components/esm/loadcell.cpp +++ b/components/esm/loadcell.cpp @@ -7,9 +7,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Cell::sRecordId = REC_CELL; /// Some overloaded compare operators. bool operator==(const MovedCellRef& ref, int pRefnum) diff --git a/components/esm/loadcell.hpp b/components/esm/loadcell.hpp index c417fceab..61d586b9d 100644 --- a/components/esm/loadcell.hpp +++ b/components/esm/loadcell.hpp @@ -16,7 +16,6 @@ namespace MWWorld namespace ESM { - class ESMReader; class ESMWriter; @@ -55,6 +54,8 @@ typedef std::list CellRefTracker; */ struct Cell { + static unsigned int sRecordId; + enum Flags { Interior = 0x01, // Interior cell diff --git a/components/esm/loadclas.cpp b/components/esm/loadclas.cpp index ef07430c7..33489eec4 100644 --- a/components/esm/loadclas.cpp +++ b/components/esm/loadclas.cpp @@ -4,9 +4,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Class::sRecordId = REC_CLAS; const Class::Specialization Class::sSpecializationIds[3] = { Class::Combat, diff --git a/components/esm/loadclas.hpp b/components/esm/loadclas.hpp index f241dca8d..3e489bb58 100644 --- a/components/esm/loadclas.hpp +++ b/components/esm/loadclas.hpp @@ -17,6 +17,8 @@ class ESMWriter; // class struct Class { + static unsigned int sRecordId; + enum AutoCalc { Weapon = 0x00001, diff --git a/components/esm/loadclot.cpp b/components/esm/loadclot.cpp index c623155df..d64564d77 100644 --- a/components/esm/loadclot.cpp +++ b/components/esm/loadclot.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Clothing::sRecordId = REC_CLOT; void Clothing::load(ESMReader &esm) { diff --git a/components/esm/loadclot.hpp b/components/esm/loadclot.hpp index 13fae865b..50896622a 100644 --- a/components/esm/loadclot.hpp +++ b/components/esm/loadclot.hpp @@ -17,6 +17,8 @@ class ESMWriter; struct Clothing { + static unsigned int sRecordId; + enum Type { Pants = 0, diff --git a/components/esm/loadcont.cpp b/components/esm/loadcont.cpp index 0cbb4acd1..7bdf9f05b 100644 --- a/components/esm/loadcont.cpp +++ b/components/esm/loadcont.cpp @@ -2,6 +2,7 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { @@ -24,6 +25,8 @@ void InventoryList::save(ESMWriter &esm) const } } + unsigned int Container::sRecordId = REC_CONT; + void Container::load(ESMReader &esm) { mModel = esm.getHNString("MODL"); diff --git a/components/esm/loadcont.hpp b/components/esm/loadcont.hpp index c854b5290..2808b67b5 100644 --- a/components/esm/loadcont.hpp +++ b/components/esm/loadcont.hpp @@ -32,6 +32,8 @@ struct InventoryList struct Container { + static unsigned int sRecordId; + enum Flags { Organic = 1, // Objects cannot be placed in this container diff --git a/components/esm/loadcrea.cpp b/components/esm/loadcrea.cpp index 30b70b35b..650de0801 100644 --- a/components/esm/loadcrea.cpp +++ b/components/esm/loadcrea.cpp @@ -2,9 +2,12 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Creature::sRecordId = REC_CREA; + void Creature::load(ESMReader &esm) { mPersistent = esm.getRecordFlags() & 0x0400; diff --git a/components/esm/loadcrea.hpp b/components/esm/loadcrea.hpp index 80e0fbd1c..99c4f5225 100644 --- a/components/esm/loadcrea.hpp +++ b/components/esm/loadcrea.hpp @@ -20,6 +20,8 @@ class ESMWriter; struct Creature { + static unsigned int sRecordId; + // Default is 0x48? enum Flags { diff --git a/components/esm/loadcrec.hpp b/components/esm/loadcrec.hpp index 2b840ccf4..280739aca 100644 --- a/components/esm/loadcrec.hpp +++ b/components/esm/loadcrec.hpp @@ -17,6 +17,8 @@ class ESMWriter; /// Changes a creature struct LoadCREC { + static unsigned int sRecordId; + std::string mId; void load(ESMReader &esm) diff --git a/components/esm/loaddial.cpp b/components/esm/loaddial.cpp index e014ca37e..f64ecb5a0 100644 --- a/components/esm/loaddial.cpp +++ b/components/esm/loaddial.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Dialogue::sRecordId = REC_DIAL; void Dialogue::load(ESMReader &esm) { diff --git a/components/esm/loaddial.hpp b/components/esm/loaddial.hpp index 0fe5027dc..3997d7753 100644 --- a/components/esm/loaddial.hpp +++ b/components/esm/loaddial.hpp @@ -19,6 +19,8 @@ class ESMWriter; struct Dialogue { + static unsigned int sRecordId; + enum Type { Topic = 0, diff --git a/components/esm/loaddoor.cpp b/components/esm/loaddoor.cpp index f666ac67a..c56b06337 100644 --- a/components/esm/loaddoor.cpp +++ b/components/esm/loaddoor.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Door::sRecordId = REC_DOOR; void Door::load(ESMReader &esm) { diff --git a/components/esm/loaddoor.hpp b/components/esm/loaddoor.hpp index 2b927c56e..ee2b7f7ac 100644 --- a/components/esm/loaddoor.hpp +++ b/components/esm/loaddoor.hpp @@ -11,6 +11,8 @@ class ESMWriter; struct Door { + static unsigned int sRecordId; + std::string mId, mName, mModel, mScript, mOpenSound, mCloseSound; void load(ESMReader &esm); diff --git a/components/esm/loadench.cpp b/components/esm/loadench.cpp index 4b4c3a1ec..a1e885f23 100644 --- a/components/esm/loadench.cpp +++ b/components/esm/loadench.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Enchantment::sRecordId = REC_ENCH; void Enchantment::load(ESMReader &esm) { diff --git a/components/esm/loadench.hpp b/components/esm/loadench.hpp index 3cdc3a0bd..f6ba8c6ab 100644 --- a/components/esm/loadench.hpp +++ b/components/esm/loadench.hpp @@ -17,6 +17,8 @@ class ESMWriter; struct Enchantment { + static unsigned int sRecordId; + enum Type { CastOnce = 0, diff --git a/components/esm/loadfact.cpp b/components/esm/loadfact.cpp index c8be51802..61fa90263 100644 --- a/components/esm/loadfact.cpp +++ b/components/esm/loadfact.cpp @@ -4,9 +4,12 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Faction::sRecordId = REC_FACT; + int& Faction::FADTstruct::getSkill (int index, bool ignored) { if (index<0 || index>=6) diff --git a/components/esm/loadfact.hpp b/components/esm/loadfact.hpp index 11f65a87f..9c257e068 100644 --- a/components/esm/loadfact.hpp +++ b/components/esm/loadfact.hpp @@ -29,6 +29,8 @@ struct RankData struct Faction { + static unsigned int sRecordId; + std::string mId, mName; struct FADTstruct diff --git a/components/esm/loadglob.cpp b/components/esm/loadglob.cpp index e1c2d4408..a78ed1a1b 100644 --- a/components/esm/loadglob.cpp +++ b/components/esm/loadglob.cpp @@ -1,7 +1,11 @@ #include "loadglob.hpp" +#include "defs.hpp" + namespace ESM { + unsigned int Global::sRecordId = REC_GLOB; + void Global::load (ESMReader &esm) { mValue.read (esm, ESM::Variant::Format_Global); diff --git a/components/esm/loadglob.hpp b/components/esm/loadglob.hpp index 06ff97ef2..51b2e2dc9 100644 --- a/components/esm/loadglob.hpp +++ b/components/esm/loadglob.hpp @@ -17,6 +17,8 @@ class ESMWriter; struct Global { + static unsigned int sRecordId; + std::string mId; Variant mValue; diff --git a/components/esm/loadgmst.cpp b/components/esm/loadgmst.cpp index 3a7df4506..21d66339a 100644 --- a/components/esm/loadgmst.cpp +++ b/components/esm/loadgmst.cpp @@ -1,7 +1,11 @@ #include "loadgmst.hpp" +#include "defs.hpp" + namespace ESM { + unsigned int GameSetting::sRecordId = REC_GMST; + void GameSetting::load (ESMReader &esm) { mValue.read (esm, ESM::Variant::Format_Gmst); diff --git a/components/esm/loadgmst.hpp b/components/esm/loadgmst.hpp index 9c37c7da0..6b66ac832 100644 --- a/components/esm/loadgmst.hpp +++ b/components/esm/loadgmst.hpp @@ -18,6 +18,8 @@ class ESMWriter; struct GameSetting { + static unsigned int sRecordId; + std::string mId; Variant mValue; diff --git a/components/esm/loadinfo.cpp b/components/esm/loadinfo.cpp index 1985da2cd..4f248cc65 100644 --- a/components/esm/loadinfo.cpp +++ b/components/esm/loadinfo.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int DialInfo::sRecordId = REC_INFO; void DialInfo::load(ESMReader &esm) { diff --git a/components/esm/loadinfo.hpp b/components/esm/loadinfo.hpp index 351768e96..2589ea7b8 100644 --- a/components/esm/loadinfo.hpp +++ b/components/esm/loadinfo.hpp @@ -20,6 +20,8 @@ class ESMWriter; struct DialInfo { + static unsigned int sRecordId; + enum Gender { Male = 0, diff --git a/components/esm/loadingr.cpp b/components/esm/loadingr.cpp index 1bc9ae41c..0e0243362 100644 --- a/components/esm/loadingr.cpp +++ b/components/esm/loadingr.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Ingredient::sRecordId = REC_INGR; void Ingredient::load(ESMReader &esm) { diff --git a/components/esm/loadingr.hpp b/components/esm/loadingr.hpp index 03e67924c..85f2d5e7d 100644 --- a/components/esm/loadingr.hpp +++ b/components/esm/loadingr.hpp @@ -15,6 +15,8 @@ class ESMWriter; struct Ingredient { + static unsigned int sRecordId; + struct IRDTstruct { float mWeight; diff --git a/components/esm/loadland.cpp b/components/esm/loadland.cpp index 8e54bcc5c..ede200d79 100644 --- a/components/esm/loadland.cpp +++ b/components/esm/loadland.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Land::sRecordId = REC_LAND; void Land::LandData::save(ESMWriter &esm) { diff --git a/components/esm/loadland.hpp b/components/esm/loadland.hpp index 3d3bcd67b..5649f9980 100644 --- a/components/esm/loadland.hpp +++ b/components/esm/loadland.hpp @@ -17,6 +17,8 @@ class ESMWriter; struct Land { + static unsigned int sRecordId; + Land(); ~Land(); diff --git a/components/esm/loadlevlist.cpp b/components/esm/loadlevlist.cpp index ab3f5e9e6..6385b9a71 100644 --- a/components/esm/loadlevlist.cpp +++ b/components/esm/loadlevlist.cpp @@ -2,6 +2,7 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { @@ -52,4 +53,8 @@ void LeveledListBase::save(ESMWriter &esm) const mChanceNone = 0; mList.clear(); } + + unsigned int CreatureLevList::sRecordId = REC_LEVC; + + unsigned int ItemLevList::sRecordId = REC_LEVI; } diff --git a/components/esm/loadlevlist.hpp b/components/esm/loadlevlist.hpp index f5fb7fd5b..9dcc6177a 100644 --- a/components/esm/loadlevlist.hpp +++ b/components/esm/loadlevlist.hpp @@ -59,6 +59,8 @@ struct LeveledListBase struct CreatureLevList: LeveledListBase { + static unsigned int sRecordId; + CreatureLevList() { mRecName = "CNAM"; @@ -67,6 +69,8 @@ struct CreatureLevList: LeveledListBase struct ItemLevList: LeveledListBase { + static unsigned int sRecordId; + ItemLevList() { mRecName = "INAM"; diff --git a/components/esm/loadligh.cpp b/components/esm/loadligh.cpp index 3f279c7c8..c02bb46b6 100644 --- a/components/esm/loadligh.cpp +++ b/components/esm/loadligh.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Light::sRecordId = REC_LIGH; void Light::load(ESMReader &esm) { diff --git a/components/esm/loadligh.hpp b/components/esm/loadligh.hpp index 9a341f0de..74eb37197 100644 --- a/components/esm/loadligh.hpp +++ b/components/esm/loadligh.hpp @@ -16,6 +16,8 @@ class ESMWriter; struct Light { + static unsigned int sRecordId; + enum Flags { Dynamic = 0x001, diff --git a/components/esm/loadlock.cpp b/components/esm/loadlock.cpp index 318769ec0..9ffce78a7 100644 --- a/components/esm/loadlock.cpp +++ b/components/esm/loadlock.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Lockpick::sRecordId = REC_LOCK; void Lockpick::load(ESMReader &esm) { diff --git a/components/esm/loadlock.hpp b/components/esm/loadlock.hpp index aea5a4f31..c44e2b006 100644 --- a/components/esm/loadlock.hpp +++ b/components/esm/loadlock.hpp @@ -11,6 +11,8 @@ class ESMWriter; struct Lockpick { + static unsigned int sRecordId; + struct Data { float mWeight; diff --git a/components/esm/loadltex.cpp b/components/esm/loadltex.cpp index dc1bc164b..bd28c8488 100644 --- a/components/esm/loadltex.cpp +++ b/components/esm/loadltex.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int LandTexture::sRecordId = REC_LTEX; void LandTexture::load(ESMReader &esm) { diff --git a/components/esm/loadltex.hpp b/components/esm/loadltex.hpp index 3d0816948..5e84428b2 100644 --- a/components/esm/loadltex.hpp +++ b/components/esm/loadltex.hpp @@ -27,6 +27,8 @@ class ESMWriter; struct LandTexture { + static unsigned int sRecordId; + std::string mId, mTexture; int mIndex; diff --git a/components/esm/loadmgef.cpp b/components/esm/loadmgef.cpp index 9eaeff704..332c27786 100644 --- a/components/esm/loadmgef.cpp +++ b/components/esm/loadmgef.cpp @@ -6,6 +6,7 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace { @@ -34,6 +35,7 @@ namespace namespace ESM { + unsigned int MagicEffect::sRecordId = REC_MGEF; void MagicEffect::load(ESMReader &esm) { diff --git a/components/esm/loadmgef.hpp b/components/esm/loadmgef.hpp index 220b3bdf3..613cbd2d8 100644 --- a/components/esm/loadmgef.hpp +++ b/components/esm/loadmgef.hpp @@ -12,6 +12,8 @@ class ESMWriter; struct MagicEffect { + static unsigned int sRecordId; + enum Flags { TargetSkill = 0x1, // Affects a specific skill, which is specified elsewhere in the effect structure. diff --git a/components/esm/loadmisc.cpp b/components/esm/loadmisc.cpp index a183821b7..2ca09e8ae 100644 --- a/components/esm/loadmisc.cpp +++ b/components/esm/loadmisc.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Miscellaneous::sRecordId = REC_MISC; void Miscellaneous::load(ESMReader &esm) { diff --git a/components/esm/loadmisc.hpp b/components/esm/loadmisc.hpp index 452eea53e..576bd18c0 100644 --- a/components/esm/loadmisc.hpp +++ b/components/esm/loadmisc.hpp @@ -16,6 +16,8 @@ class ESMWriter; struct Miscellaneous { + static unsigned int sRecordId; + struct MCDTstruct { float mWeight; diff --git a/components/esm/loadnpc.cpp b/components/esm/loadnpc.cpp index 7c26cb549..9fff2d885 100644 --- a/components/esm/loadnpc.cpp +++ b/components/esm/loadnpc.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int NPC::sRecordId = REC_NPC_; void NPC::load(ESMReader &esm) { diff --git a/components/esm/loadnpc.hpp b/components/esm/loadnpc.hpp index 009548c59..d9e691669 100644 --- a/components/esm/loadnpc.hpp +++ b/components/esm/loadnpc.hpp @@ -20,6 +20,8 @@ class ESMWriter; struct NPC { + static unsigned int sRecordId; + // Services enum Services { diff --git a/components/esm/loadnpcc.hpp b/components/esm/loadnpcc.hpp index f023fd217..c87c2545f 100644 --- a/components/esm/loadnpcc.hpp +++ b/components/esm/loadnpcc.hpp @@ -78,6 +78,8 @@ class ESMWriter; struct LoadNPCC { + static unsigned int sRecordId; + std::string mId; void load(ESMReader &esm) diff --git a/components/esm/loadpgrd.cpp b/components/esm/loadpgrd.cpp index 65d1f8055..3b5330e9f 100644 --- a/components/esm/loadpgrd.cpp +++ b/components/esm/loadpgrd.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Pathgrid::sRecordId = REC_PGRD; void Pathgrid::load(ESMReader &esm) { diff --git a/components/esm/loadpgrd.hpp b/components/esm/loadpgrd.hpp index d14433a78..9ee49552d 100644 --- a/components/esm/loadpgrd.hpp +++ b/components/esm/loadpgrd.hpp @@ -15,6 +15,8 @@ class ESMWriter; */ struct Pathgrid { + static unsigned int sRecordId; + struct DATAstruct { int mX, mY; // Grid location, matches cell for exterior cells diff --git a/components/esm/loadprob.cpp b/components/esm/loadprob.cpp index 0fb4c9750..caa3d7e0e 100644 --- a/components/esm/loadprob.cpp +++ b/components/esm/loadprob.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Probe::sRecordId = REC_PROB; void Probe::load(ESMReader &esm) { diff --git a/components/esm/loadprob.hpp b/components/esm/loadprob.hpp index d0a8256ab..b89b2ddeb 100644 --- a/components/esm/loadprob.hpp +++ b/components/esm/loadprob.hpp @@ -11,6 +11,8 @@ class ESMWriter; struct Probe { + static unsigned int sRecordId; + struct Data { float mWeight; diff --git a/components/esm/loadrace.cpp b/components/esm/loadrace.cpp index e9e1d0d79..e50e43a74 100644 --- a/components/esm/loadrace.cpp +++ b/components/esm/loadrace.cpp @@ -2,9 +2,12 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Race::sRecordId = REC_RACE; + int Race::MaleFemale::getValue (bool male) const { return male ? mMale : mFemale; diff --git a/components/esm/loadrace.hpp b/components/esm/loadrace.hpp index a53a98070..7d5736d9b 100644 --- a/components/esm/loadrace.hpp +++ b/components/esm/loadrace.hpp @@ -17,6 +17,8 @@ class ESMWriter; struct Race { + static unsigned int sRecordId; + struct SkillBonus { int mSkill; // SkillEnum diff --git a/components/esm/loadregn.cpp b/components/esm/loadregn.cpp index fd42b9ee8..fa4271e26 100644 --- a/components/esm/loadregn.cpp +++ b/components/esm/loadregn.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Region::sRecordId = REC_REGN; void Region::load(ESMReader &esm) { diff --git a/components/esm/loadregn.hpp b/components/esm/loadregn.hpp index a6075d65a..1992c951b 100644 --- a/components/esm/loadregn.hpp +++ b/components/esm/loadregn.hpp @@ -18,6 +18,8 @@ class ESMWriter; struct Region { + static unsigned int sRecordId; + #pragma pack(push) #pragma pack(1) struct WEATstruct diff --git a/components/esm/loadrepa.cpp b/components/esm/loadrepa.cpp index 59bfa0169..a7132828d 100644 --- a/components/esm/loadrepa.cpp +++ b/components/esm/loadrepa.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Repair::sRecordId = REC_REPA; void Repair::load(ESMReader &esm) { diff --git a/components/esm/loadrepa.hpp b/components/esm/loadrepa.hpp index 771e7ead0..5b404b0e4 100644 --- a/components/esm/loadrepa.hpp +++ b/components/esm/loadrepa.hpp @@ -11,6 +11,8 @@ class ESMWriter; struct Repair { + static unsigned int sRecordId; + struct Data { float mWeight; diff --git a/components/esm/loadscpt.cpp b/components/esm/loadscpt.cpp index 8afb85602..30460c17a 100644 --- a/components/esm/loadscpt.cpp +++ b/components/esm/loadscpt.cpp @@ -2,6 +2,7 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { @@ -12,6 +13,8 @@ struct SCHD Script::SCHDstruct mData; }; + unsigned int Script::sRecordId = REC_SCPT; + void Script::load(ESMReader &esm) { SCHD data; diff --git a/components/esm/loadscpt.hpp b/components/esm/loadscpt.hpp index 450224faa..d5200d4c1 100644 --- a/components/esm/loadscpt.hpp +++ b/components/esm/loadscpt.hpp @@ -19,6 +19,8 @@ class ESMWriter; class Script { public: + static unsigned int sRecordId; + struct SCHDstruct { /* Script name. diff --git a/components/esm/loadskil.cpp b/components/esm/loadskil.cpp index f6a2c4950..b6724e938 100644 --- a/components/esm/loadskil.cpp +++ b/components/esm/loadskil.cpp @@ -6,6 +6,7 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { @@ -126,6 +127,8 @@ namespace ESM HandToHand }}; + unsigned int Skill::sRecordId = REC_SKIL; + void Skill::load(ESMReader &esm) { esm.getHNT(mIndex, "INDX"); diff --git a/components/esm/loadskil.hpp b/components/esm/loadskil.hpp index 2436173cb..1b9db5bcf 100644 --- a/components/esm/loadskil.hpp +++ b/components/esm/loadskil.hpp @@ -19,6 +19,8 @@ class ESMWriter; struct Skill { + static unsigned int sRecordId; + std::string mId; struct SKDTstruct diff --git a/components/esm/loadsndg.cpp b/components/esm/loadsndg.cpp index 9b992c960..1a8ca6335 100644 --- a/components/esm/loadsndg.cpp +++ b/components/esm/loadsndg.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int SoundGenerator::sRecordId = REC_SNDG; void SoundGenerator::load(ESMReader &esm) { diff --git a/components/esm/loadsndg.hpp b/components/esm/loadsndg.hpp index 2756676ef..5509661c1 100644 --- a/components/esm/loadsndg.hpp +++ b/components/esm/loadsndg.hpp @@ -15,6 +15,8 @@ class ESMWriter; struct SoundGenerator { + static unsigned int sRecordId; + enum Type { LeftFoot = 0, diff --git a/components/esm/loadsoun.cpp b/components/esm/loadsoun.cpp index 0f6b0f84a..49c9eb54e 100644 --- a/components/esm/loadsoun.cpp +++ b/components/esm/loadsoun.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Sound::sRecordId = REC_SOUN; void Sound::load(ESMReader &esm) { diff --git a/components/esm/loadsoun.hpp b/components/esm/loadsoun.hpp index 6c9bb1fed..04a0984fd 100644 --- a/components/esm/loadsoun.hpp +++ b/components/esm/loadsoun.hpp @@ -16,6 +16,8 @@ struct SOUNstruct struct Sound { + static unsigned int sRecordId; + SOUNstruct mData; std::string mId, mSound; diff --git a/components/esm/loadspel.cpp b/components/esm/loadspel.cpp index 5c0bd956f..2c98d796d 100644 --- a/components/esm/loadspel.cpp +++ b/components/esm/loadspel.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Spell::sRecordId = REC_SPEL; void Spell::load(ESMReader &esm) { diff --git a/components/esm/loadspel.hpp b/components/esm/loadspel.hpp index b34bd29f1..cbf5366c4 100644 --- a/components/esm/loadspel.hpp +++ b/components/esm/loadspel.hpp @@ -13,6 +13,8 @@ class ESMWriter; struct Spell { + static unsigned int sRecordId; + enum SpellType { ST_Spell = 0, // Normal spell, must be cast and costs mana diff --git a/components/esm/loadsscr.cpp b/components/esm/loadsscr.cpp index f51b7be47..69b04bb23 100644 --- a/components/esm/loadsscr.cpp +++ b/components/esm/loadsscr.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int StartScript::sRecordId = REC_SSCR; void StartScript::load(ESMReader &esm) { diff --git a/components/esm/loadsscr.hpp b/components/esm/loadsscr.hpp index 2326f00f4..d09ad883e 100644 --- a/components/esm/loadsscr.hpp +++ b/components/esm/loadsscr.hpp @@ -19,6 +19,8 @@ class ESMWriter; struct StartScript { + static unsigned int sRecordId; + std::string mData; std::string mId, mScript; diff --git a/components/esm/loadstat.cpp b/components/esm/loadstat.cpp index 38206422b..a71f22dc2 100644 --- a/components/esm/loadstat.cpp +++ b/components/esm/loadstat.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Static::sRecordId = REC_STAT; void Static::load(ESMReader &esm) { diff --git a/components/esm/loadstat.hpp b/components/esm/loadstat.hpp index df42c0c49..d912d1058 100644 --- a/components/esm/loadstat.hpp +++ b/components/esm/loadstat.hpp @@ -22,6 +22,8 @@ class ESMWriter; struct Static { + static unsigned int sRecordId; + std::string mId, mModel; void load(ESMReader &esm); diff --git a/components/esm/loadtes3.cpp b/components/esm/loadtes3.cpp index 74d578ba7..a86c9b6f4 100644 --- a/components/esm/loadtes3.cpp +++ b/components/esm/loadtes3.cpp @@ -4,6 +4,7 @@ #include "esmcommon.hpp" #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" void ESM::Header::blank() { diff --git a/components/esm/loadweap.cpp b/components/esm/loadweap.cpp index e21d8924a..1d0b149df 100644 --- a/components/esm/loadweap.cpp +++ b/components/esm/loadweap.cpp @@ -2,9 +2,11 @@ #include "esmreader.hpp" #include "esmwriter.hpp" +#include "defs.hpp" namespace ESM { + unsigned int Weapon::sRecordId = REC_WEAP; void Weapon::load(ESMReader &esm) { diff --git a/components/esm/loadweap.hpp b/components/esm/loadweap.hpp index 42810d3af..fde716b91 100644 --- a/components/esm/loadweap.hpp +++ b/components/esm/loadweap.hpp @@ -15,6 +15,8 @@ class ESMWriter; struct Weapon { + static unsigned int sRecordId; + enum Type { ShortBladeOneHand = 0,