special case handling for script records

pull/7/head
Marc Zinnschlag 15 years ago
parent 91f5c9c01f
commit 106d12906a

@ -131,6 +131,35 @@ namespace ESMS
}
}
};
template <typename X>
struct ScriptListT : RecList
{
typedef std::map<std::string,X> 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:

@ -73,7 +73,7 @@ namespace ESMS
//RecListT<Land> lands;
//RecListT<LandTexture> landTexts;
//RecListT<MagicEffect> magicEffects;
//RecListT<Script> scripts;
ScriptListT<Script> scripts;
//RecListT<Skill> skills;
//RecListT<PathGrid> pathgrids;
@ -130,7 +130,7 @@ namespace ESMS
recLists[REC_RACE] = &races;
recLists[REC_REGN] = &regions;
recLists[REC_REPA] = &repairs;
//recLists[REC_SCPT] = &scripts;
recLists[REC_SCPT] = &scripts;
//recLists[REC_SKIL] = &skills;
recLists[REC_SNDG] = &soundGens;
recLists[REC_SOUN] = &sounds;

Loading…
Cancel
Save