1 #ifndef OPENMW_MWWORLD_ESMSTORE_H
2 #define OPENMW_MWWORLD_ESMSTORE_H
70 std::map<std::string, int>
mIds;
79 typedef std::map<int, StoreBase *>::const_iterator
iterator;
91 int find(
const std::string &
id)
const
93 std::map<std::string, int>::const_iterator it =
mIds.find(
id);
94 if (it ==
mIds.end()) {
148 for (std::map<int, StoreBase *>::iterator it =
mStores.begin(); it !=
mStores.end(); ++it)
149 it->second->clearDynamic();
165 throw std::runtime_error(
"Storage for this type not exist");
171 std::ostringstream id;
175 if (store.
search(
id.str()) != 0) {
176 std::ostringstream msg;
177 msg <<
"Try to override existing record '" <<
id.str() <<
"'";
178 throw std::runtime_error(msg.str());
182 record.mId =
id.str();
184 T *ptr = store.
insert(record);
186 if (it->second == &store) {
187 mIds[ptr->mId] = it->first;
200 if (it->second == &store) {
201 mIds[ptr->mId] = it->first;
209 std::ostringstream id;
213 if (store.
search(
id.str()) != 0) {
214 std::ostringstream msg;
215 msg <<
"Try to override existing record '" <<
id.str() <<
"'";
216 throw std::runtime_error(msg.str());
222 if (it->second == &store) {
223 mIds[ptr->mId] = it->first;
243 return mCells.insert(cell);
248 std::ostringstream id;
249 id <<
"$dynamic" << mDynamicCount++;
252 return mNpcs.insert(npc);
253 }
else if (mNpcs.search(
id.str()) != 0) {
254 std::ostringstream msg;
255 msg <<
"Try to override existing record '" <<
id.str() <<
"'";
256 throw std::runtime_error(msg.str());
260 record.
mId =
id.str();
262 ESM::NPC *ptr = mNpcs.insert(record);
354 return mCreatureLists;
419 return mStartScripts;
434 return mGameSettings;
454 return mLandTextures;
464 return mMagicEffects;
void clearDynamic()
Definition: esmstore.hpp:146
Definition: store.hpp:324
Store< ESM::Dialogue > mDialogs
Definition: esmstore.hpp:30
Definition: store.hpp:200
Store< ESM::StartScript > mStartScripts
Definition: esmstore.hpp:49
const T * find(const std::string &id) const
Definition: store.cpp:165
static bool ciEqual(const std::string &x, const std::string &y)
Definition: stringops.hpp:62
Store< ESM::Sound > mSounds
Definition: esmstore.hpp:47
Store< ESM::Door > mDoors
Definition: esmstore.hpp:31
unsigned int mDynamicCount
Definition: esmstore.hpp:75
Store< ESM::Repair > mRepairs
Definition: esmstore.hpp:45
Store< ESM::Pathgrid > mPathgrids
Definition: esmstore.hpp:60
ESM::NPC mPlayerTemplate
Definition: esmstore.hpp:73
std::map< int, StoreBase * > mStores
Definition: esmstore.hpp:71
iterator end() const
Definition: esmstore.hpp:85
Store< ESM::CreatureLevList > mCreatureLists
Definition: esmstore.hpp:36
Definition: esmreader.hpp:21
Store< ESM::NPC > mNpcs
Definition: esmstore.hpp:41
Store< ESM::MagicEffect > mMagicEffects
Definition: esmstore.hpp:62
Store< ESM::Land > mLands
Definition: esmstore.hpp:58
void load(ESM::ESMReader &esm, Loading::Listener *listener)
Definition: esmstore.cpp:30
Definition: store.hpp:355
int countSavedGameRecords() const
Definition: esmstore.cpp:146
Definition: store.hpp:253
const T * search(const std::string &id) const
Definition: store.cpp:131
Store< ESM::Creature > mCreatures
Definition: esmstore.hpp:29
Definition: store.hpp:230
Definition: loadinglistener.hpp:8
Store< ESM::BodyPart > mBodyParts
Definition: esmstore.hpp:23
Definition: esmwriter.hpp:17
Definition: store.hpp:362
T * insertStatic(const T &item)
Definition: store.cpp:255
void movePlayerRecord()
Definition: esmstore.hpp:154
Definition: esmstore.hpp:17
Store< ESM::Script > mScripts
Definition: esmstore.hpp:54
Store< ESM::Region > mRegions
Definition: esmstore.hpp:44
std::map< std::string, int > mIds
Definition: esmstore.hpp:70
Store< ESM::Weapon > mWeapons
Definition: esmstore.hpp:51
Definition: loadnpc.hpp:23
std::string mId
Definition: loadnpc.hpp:128
Store< ESM::Skill > mSkills
Definition: esmstore.hpp:63
Store< ESM::Ingredient > mIngreds
Definition: esmstore.hpp:35
Store< ESM::Apparatus > mAppas
Definition: esmstore.hpp:21
int find(const std::string &id) const
Definition: esmstore.hpp:91
Store< ESM::Cell > mCells
Definition: esmstore.hpp:57
bool eraseStatic(const std::string &id)
Definition: store.cpp:269
Store< ESM::SoundGenerator > mSoundGens
Definition: esmstore.hpp:46
Store< ESM::Enchantment > mEnchants
Definition: esmstore.hpp:32
Store< ESM::Lockpick > mLockpicks
Definition: esmstore.hpp:39
iterator begin() const
Definition: esmstore.hpp:81
Store< ESM::Spell > mSpells
Definition: esmstore.hpp:48
Store< ESM::BirthSign > mBirthSigns
Definition: esmstore.hpp:25
ESMStore()
Definition: esmstore.hpp:100
Definition: loadcell.hpp:64
bool readRecord(ESM::ESMReader &reader, uint32_t type)
Definition: esmstore.cpp:183
const T * overrideRecord(const T &x)
Insert a record with set ID, and allow it to override a pre-existing static record.
Definition: esmstore.hpp:195
Store< ESM::Race > mRaces
Definition: esmstore.hpp:43
Store< ESM::Light > mLights
Definition: esmstore.hpp:38
Store< ESM::Clothing > mClothes
Definition: esmstore.hpp:27
T * insert(const T &item)
Definition: store.cpp:241
Store< ESM::Miscellaneous > mMiscItems
Definition: esmstore.hpp:40
Store< ESM::Attribute > mAttributes
Definition: esmstore.hpp:66
void write(ESM::ESMWriter &writer, Loading::Listener &progress) const
Definition: esmstore.cpp:162
void setUp()
Definition: esmstore.cpp:123
Store< ESM::Static > mStatics
Definition: esmstore.hpp:50
Store< ESM::Armor > mArmors
Definition: esmstore.hpp:22
Store< ESM::Class > mClasses
Definition: esmstore.hpp:26
Store< ESM::Global > mGlobals
Definition: esmstore.hpp:34
void setCells(Store< ESM::Cell > &cells)
Definition: store.cpp:865
std::map< int, StoreBase * >::const_iterator iterator
Definition: esmstore.hpp:79
Store< ESM::Book > mBooks
Definition: esmstore.hpp:24
Store< ESM::Potion > mPotions
Definition: esmstore.hpp:20
const T * insertStatic(const T &x)
Definition: esmstore.hpp:208
Store< ESM::ItemLevList > mItemLists
Definition: esmstore.hpp:37
Store< ESM::LandTexture > mLandTextures
Definition: esmstore.hpp:59
Store< ESM::Container > mContainers
Definition: esmstore.hpp:28
Store< ESM::Faction > mFactions
Definition: esmstore.hpp:33
const T * insert(const T &x)
Insert a custom record (i.e. with a generated ID that will not clash will pre-existing records) ...
Definition: esmstore.hpp:170
Store< ESM::GameSetting > mGameSettings
Definition: esmstore.hpp:53
Store< ESM::Probe > mProbes
Definition: esmstore.hpp:42
Definition: store.hpp:369
Store< ESM::Activator > mActivators
Definition: esmstore.hpp:19