From f0a3ee0ef90b3fbd633c2f1c3dd8e69fca526f31 Mon Sep 17 00:00:00 2001 From: greye Date: Mon, 1 Oct 2012 17:15:16 +0400 Subject: [PATCH] gmst id should be lowercase, wipe RecIdListT --- components/esm/loadgmst.cpp | 32 ++++++++++-------- components/esm_store/reclists.hpp | 54 ------------------------------- components/esm_store/store.hpp | 2 +- 3 files changed, 19 insertions(+), 69 deletions(-) diff --git a/components/esm/loadgmst.cpp b/components/esm/loadgmst.cpp index dcc500125..14e29f4ae 100644 --- a/components/esm/loadgmst.cpp +++ b/components/esm/loadgmst.cpp @@ -2,6 +2,8 @@ #include +#include + #include "esmreader.hpp" #include "esmwriter.hpp" @@ -12,9 +14,9 @@ namespace ESM /// working properly in its current state and I doubt it can be fixed without breaking other stuff. // Some handy macros -#define cI(s,x) { if(mId == (s)) return (mI == (x)); } -#define cF(s,x) { if(mId == (s)) return (mF == (x)); } -#define cS(s,x) { if(mId == (s)) return (mStr == (x)); } +#define cI(s,x) { label = (s); boost::algorithm::to_lower(label); if (mId == label) return (mI == (x)); } +#define cF(s,x) { label = (s); boost::algorithm::to_lower(label); if (mId == label) return (mF == (x)); } +#define cS(s,x) { label = (s); boost::algorithm::to_lower(label); if (mId == label) return (mStr == (x)); } bool GameSetting::isDirtyTribunal() { @@ -28,6 +30,7 @@ bool GameSetting::isDirtyTribunal() from other mods. */ + std::string label; // Strings cS("sProfitValue", "Profit Value"); // 'Profit:' cS("sEditNote", "Edit Note"); // same @@ -51,13 +54,14 @@ bool GameSetting::isDirtyTribunal() // [The difference here is "Profit Value" -> "Profit"] // Strings that matches the mId - cS("sEffectSummonFabricant", mId);// 'Summon Fabricant' + cS("sEffectSummonFabricant", "sEffectSummonFabricant");// 'Summon Fabricant' return false; } // Bloodmoon variant bool GameSetting::isDirtyBloodmoon() { + std::string label; // Strings cS("sWerewolfPopup", "Werewolf"); // same cS("sWerewolfRestMessage", @@ -69,16 +73,16 @@ bool GameSetting::isDirtyBloodmoon() // 'You have been detected as a known werewolf.' // Strings that matches the mId - cS("sMagicCreature01ID", mId); // 'BM_wolf_grey_summon' - cS("sMagicCreature02ID", mId); // 'BM_bear_black_summon' - cS("sMagicCreature03ID", mId); // 'BM_wolf_bone_summon' - cS("sMagicCreature04ID", mId); // same - cS("sMagicCreature05ID", mId); // same - cS("sEffectSummonCreature01", mId); // 'Calf Wolf' - cS("sEffectSummonCreature02", mId); // 'Calf Bear' - cS("sEffectSummonCreature03", mId); // 'Summon Bonewolf' - cS("sEffectSummonCreature04", mId); // same - cS("sEffectSummonCreature05", mId); // same + cS("sMagicCreature01ID", "sMagicCreature01ID"); // 'BM_wolf_grey_summon' + cS("sMagicCreature02ID", "sMagicCreature02ID"); // 'BM_bear_black_summon' + cS("sMagicCreature03ID", "sMagicCreature03ID"); // 'BM_wolf_bone_summon' + cS("sMagicCreature04ID", "sMagicCreature04ID"); // same + cS("sMagicCreature05ID", "sMagicCreature05ID"); // same + cS("sEffectSummonCreature01", "sEffectSummonCreature01"); // 'Calf Wolf' + cS("sEffectSummonCreature02", "sEffectSummonCreature02"); // 'Calf Bear' + cS("sEffectSummonCreature03", "sEffectSummonCreature03"); // 'Summon Bonewolf' + cS("sEffectSummonCreature04", "sEffectSummonCreature04"); // same + cS("sEffectSummonCreature05", "sEffectSummonCreature05"); // same // Integers cI("iWereWolfBounty", 10000); // 1000 diff --git a/components/esm_store/reclists.hpp b/components/esm_store/reclists.hpp index 0b265a566..d9a764805 100644 --- a/components/esm_store/reclists.hpp +++ b/components/esm_store/reclists.hpp @@ -209,60 +209,6 @@ namespace ESMS } }; - // The only difference to the above is a slight change to the load() - // function. We might merge these together later, and store the id - // in all the structs. - template - struct RecIDListT : RecList - { - virtual ~RecIDListT() {} - - typedef std::map MapType; - - MapType list; - - void load(ESMReader &esm, const std::string &id) - { - std::string id2 = toLower (id); - X& ref = list[id2]; - - ref.mId = id; - ref.load(esm); - } - - // Find the given object ID, or return NULL if not found. - const X* search(const std::string &id) const - { - std::string id2 = toLower (id); - - typename MapType::const_iterator iter = list.find (id2); - - if (iter == list.end()) - return NULL; - - return &iter->second; - } - - // Find the given object ID (throws an exception if not found) - const X* find(const std::string &id) const - { - const X *object = search (id); - - if (!object) - throw std::runtime_error ("object " + id + " not found"); - - return object; - } - - int getSize() { return list.size(); } - - virtual void listIdentifier (std::vector& identifier) const - { - for (typename MapType::const_iterator iter (list.begin()); iter!=list.end(); ++iter) - identifier.push_back (iter->first); - } - }; - /* Land textures are indexed by an integer number */ struct LTexList : RecList diff --git a/components/esm_store/store.hpp b/components/esm_store/store.hpp index 7329386d4..db36afd33 100644 --- a/components/esm_store/store.hpp +++ b/components/esm_store/store.hpp @@ -68,7 +68,7 @@ namespace ESMS // Lists that need special rules CellList cells; - RecIDListT gameSettings; + RecListWithIDT gameSettings; LandList lands; LTexList landTexts; ScriptListT