forked from mirror/openmw-tes3mp
special case handling for script records
This commit is contained in:
parent
91f5c9c01f
commit
106d12906a
2 changed files with 31 additions and 2 deletions
|
@ -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] = ®ions;
|
||||
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…
Reference in a new issue