From 106d12906a9b6299f7878be17f3b280074407190 Mon Sep 17 00:00:00 2001 From: Marc Zinnschlag Date: Sun, 27 Jun 2010 14:17:04 +0200 Subject: [PATCH 01/40] special case handling for script records --- components/esm_store/reclists.hpp | 29 +++++++++++++++++++++++++++++ components/esm_store/store.hpp | 4 ++-- 2 files changed, 31 insertions(+), 2 deletions(-) diff --git a/components/esm_store/reclists.hpp b/components/esm_store/reclists.hpp index 196ce6063..75d4e67ae 100644 --- a/components/esm_store/reclists.hpp +++ b/components/esm_store/reclists.hpp @@ -131,6 +131,35 @@ namespace ESMS } } }; + + template + struct ScriptListT : RecList + { + typedef std::map MapType; + + MapType list; + + // Load one object of this type + void load(ESMReader &esm, const std::string &id) + { + X ref; + ref.load (esm); + + std::string realId = ref.data.name.toString(); + + std::swap (list[realId], ref); + } + + // Find the given object ID, or return NULL if not found. + const X* find(const std::string &id) const + { + if(list.find(id) == list.end()) + return NULL; + return &list.find(id)->second; + } + + int getSize() { return list.size(); } + }; /* We need special lists for: diff --git a/components/esm_store/store.hpp b/components/esm_store/store.hpp index 44bd87279..7c4971ac4 100644 --- a/components/esm_store/store.hpp +++ b/components/esm_store/store.hpp @@ -73,7 +73,7 @@ namespace ESMS //RecListT lands; //RecListT landTexts; //RecListT magicEffects; - //RecListT