#ifndef OPENMW_MWWORLD_STORE_H #define OPENMW_MWWORLD_STORE_H /* The ESM storage module. This is separate from the ESM loader module, located in esm/. It is also unaware of the cell loading and storage module. The advantage of this, as with all other modularizations, is that you can replace the storage method later without touching the loading code. Cutting down dependencies also help on the general maintainability. */ #include #include "reclists.hpp" namespace MWWorld { struct ESMStore { /* Lists all the list types. Mostly used for quick lookup on loading. The key is the record name (4 chars) parsed as a 32 bit int. See esm/records.hpp for the complete list. */ RecListList recLists; // Each individual list RecListT activators; RecListWithIDT potions; RecListT appas; RecListT armors; RecListT bodyParts; RecListWithIDT books; RecListT birthSigns; RecListT classes; RecListT clothes; RecListT contChange; RecListT containers; RecListWithIDT creatures; RecListT creaChange; RecListCaseT dialogs; RecListT doors; RecListT enchants; RecListT factions; RecListT globals; RecListWithIDT ingreds; RecListT creatureLists; RecListT itemLists; RecListT lights; RecListT lockpicks; RecListT miscItems; RecListWithIDT npcs; RecListT npcChange; RecListT probes; RecListT races; RecListT regions; RecListT repairs; RecListT soundGens; RecListT sounds; RecListT spells; RecListT startScripts; RecListT statics; RecListT weapons; // Lists that need special rules CellList cells; RecListWithIDT gameSettings; LandList lands; LTexList landTexts; ScriptListT scripts; IndexListT magicEffects; IndexListT skills; //RecListT pathgrids; PathgridList pathgrids; // Special entry which is hardcoded and not loaded from an ESM IndexListT attributes; // Lookup of all IDs. Makes looking up references faster. Just // maps the id name to the record type. typedef std::map AllMap; AllMap all; // Look up the given ID in 'all'. Returns 0 if not found. int find(const std::string &id) const { AllMap::const_iterator it = all.find(id); if(it == all.end()) return 0; return it->second; } ESMStore() { recLists[ESM::REC_ACTI] = &activators; recLists[ESM::REC_ALCH] = &potions; recLists[ESM::REC_APPA] = &appas; recLists[ESM::REC_ARMO] = &armors; recLists[ESM::REC_BODY] = &bodyParts; recLists[ESM::REC_BOOK] = &books; recLists[ESM::REC_BSGN] = &birthSigns; recLists[ESM::REC_CELL] = &cells; recLists[ESM::REC_CLAS] = &classes; recLists[ESM::REC_CLOT] = &clothes; recLists[ESM::REC_CNTC] = &contChange; recLists[ESM::REC_CONT] = &containers; recLists[ESM::REC_CREA] = &creatures; recLists[ESM::REC_CREC] = &creaChange; recLists[ESM::REC_DIAL] = &dialogs; recLists[ESM::REC_DOOR] = &doors; recLists[ESM::REC_ENCH] = &enchants; recLists[ESM::REC_FACT] = &factions; recLists[ESM::REC_GLOB] = &globals; recLists[ESM::REC_GMST] = &gameSettings; recLists[ESM::REC_INGR] = &ingreds; recLists[ESM::REC_LAND] = &lands; recLists[ESM::REC_LEVC] = &creatureLists; recLists[ESM::REC_LEVI] = &itemLists; recLists[ESM::REC_LIGH] = &lights; recLists[ESM::REC_LOCK] = &lockpicks; recLists[ESM::REC_LTEX] = &landTexts; recLists[ESM::REC_MISC] = &miscItems; recLists[ESM::REC_NPC_] = &npcs; recLists[ESM::REC_NPCC] = &npcChange; recLists[ESM::REC_PGRD] = &pathgrids; recLists[ESM::REC_PROB] = &probes; recLists[ESM::REC_RACE] = &races; recLists[ESM::REC_REGN] = ®ions; recLists[ESM::REC_REPA] = &repairs; recLists[ESM::REC_SCPT] = &scripts; recLists[ESM::REC_SNDG] = &soundGens; recLists[ESM::REC_SOUN] = &sounds; recLists[ESM::REC_SPEL] = &spells; recLists[ESM::REC_SSCR] = &startScripts; recLists[ESM::REC_STAT] = &statics; recLists[ESM::REC_WEAP] = &weapons; } void load(ESM::ESMReader &esm); }; } #endif