mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-03-14 01:19:59 +00:00
rename StoreBase =>DynamicStore, and create new class Storebase
all stores inherit from base class StoreBase.Storebase is just an empty interface class
This commit is contained in:
parent
0d84b32d46
commit
16482243fa
@ -215,8 +215,8 @@ namespace MWWorld
|
||||
Store<ESM::Skill> mSkills;
|
||||
Store<ESM::Attribute> mAttributes;
|
||||
|
||||
std::map<ESM::RecNameInts, StoreBase*> mRecNameToStore;
|
||||
std::unordered_map<const StoreBase*, ESM::RecNameInts> mStoreToRecName;
|
||||
std::map<ESM::RecNameInts, DynamicStore*> mRecNameToStore;
|
||||
std::unordered_map<const DynamicStore*, ESM::RecNameInts> mStoreToRecName;
|
||||
|
||||
// Lookup of all IDs. Makes looking up references faster. Just
|
||||
// maps the id name to the record type.
|
||||
@ -291,7 +291,7 @@ namespace MWWorld
|
||||
template<typename T>
|
||||
static void createStore(ESMStore& stores)
|
||||
{
|
||||
if constexpr (std::is_convertible<Store<T>*, StoreBase*>::value)
|
||||
if constexpr (std::is_convertible<Store<T>*, DynamicStore*>::value)
|
||||
{
|
||||
int storeIndex = SRecordType<T>::sStoreIndex;
|
||||
stores.mStores[storeIndex] = std::make_unique<Store<T>>();
|
||||
@ -307,7 +307,7 @@ namespace MWWorld
|
||||
{
|
||||
for (const auto& recordStorePair : mRecNameToStore)
|
||||
{
|
||||
const StoreBase* storePtr = recordStorePair.second;
|
||||
const DynamicStore* storePtr = recordStorePair.second;
|
||||
mStoreToRecName[storePtr] = recordStorePair.first;
|
||||
}
|
||||
}
|
||||
@ -481,7 +481,7 @@ void ESMStore::setUp()
|
||||
{
|
||||
mStoreImp->mIds.clear();
|
||||
|
||||
std::map<ESM::RecNameInts, StoreBase*>::iterator storeIt = mStoreImp->mRecNameToStore.begin();
|
||||
std::map<ESM::RecNameInts, DynamicStore*>::iterator storeIt = mStoreImp->mRecNameToStore.begin();
|
||||
for (; storeIt != mStoreImp->mRecNameToStore.end(); ++storeIt) {
|
||||
storeIt->second->setUp();
|
||||
|
||||
|
@ -38,7 +38,7 @@ namespace MWWorld
|
||||
|
||||
std::unordered_map<std::string, int> mRefCount;
|
||||
|
||||
std::vector<std::unique_ptr< StoreBase >> mStores;
|
||||
std::vector<std::unique_ptr< DynamicStore >> mStores;
|
||||
|
||||
unsigned int mDynamicCount;
|
||||
|
||||
@ -65,7 +65,7 @@ namespace MWWorld
|
||||
ESM::LuaScriptsCfg getLuaScriptsCfg() const;
|
||||
|
||||
/// \todo replace with SharedIterator<StoreBase>
|
||||
typedef std::vector<std::unique_ptr< StoreBase>>::const_iterator iterator;
|
||||
typedef std::vector<std::unique_ptr< DynamicStore>>::const_iterator iterator;
|
||||
|
||||
iterator begin() const {
|
||||
return mStores.begin();
|
||||
@ -130,7 +130,7 @@ namespace MWWorld
|
||||
std::pair<std::shared_ptr<MWMechanics::SpellList>, bool> getSpellList(const std::string& id) const;
|
||||
};
|
||||
|
||||
//Special cases these aren't StoreBase, but IndexedStore
|
||||
//Special cases these aren't DynamicStore, but IndexedStore
|
||||
template <> const Store<ESM::MagicEffect>& ESMStore::get<ESM::MagicEffect>() const;
|
||||
template <> Store<ESM::MagicEffect>& ESMStore::getWritable<ESM::MagicEffect>();
|
||||
|
||||
|
@ -43,10 +43,12 @@ namespace MWWorld
|
||||
RecordId(const std::string &id = {}, bool isDeleted = false);
|
||||
};
|
||||
|
||||
class StoreBase
|
||||
class StoreBase {}; //Empty interface to be parent of all store types
|
||||
|
||||
class DynamicStore : StoreBase
|
||||
{
|
||||
public:
|
||||
virtual ~StoreBase() {}
|
||||
virtual ~DynamicStore() {}
|
||||
|
||||
virtual void setUp() {}
|
||||
|
||||
@ -67,7 +69,7 @@ namespace MWWorld
|
||||
};
|
||||
|
||||
template <class T>
|
||||
class IndexedStore
|
||||
class IndexedStore : StoreBase
|
||||
{
|
||||
protected:
|
||||
typedef typename std::map<int, T> Static;
|
||||
@ -161,7 +163,7 @@ namespace MWWorld
|
||||
class ESMStore;
|
||||
|
||||
template <class T>
|
||||
class Store : public StoreBase
|
||||
class Store : public DynamicStore
|
||||
{
|
||||
typedef std::unordered_map<std::string, T, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual> Static;
|
||||
Static mStatic;
|
||||
@ -220,7 +222,7 @@ namespace MWWorld
|
||||
};
|
||||
|
||||
template <>
|
||||
class Store<ESM::LandTexture> : public StoreBase
|
||||
class Store<ESM::LandTexture> : public DynamicStore
|
||||
{
|
||||
// For multiple ESM/ESP files we need one list per file.
|
||||
typedef std::vector<ESM::LandTexture> LandTextureList;
|
||||
@ -248,7 +250,7 @@ namespace MWWorld
|
||||
};
|
||||
|
||||
template <>
|
||||
class Store<ESM::Land> : public StoreBase
|
||||
class Store<ESM::Land> : public DynamicStore
|
||||
{
|
||||
struct SpatialComparator
|
||||
{
|
||||
@ -291,7 +293,7 @@ namespace MWWorld
|
||||
};
|
||||
|
||||
template <>
|
||||
class Store<ESM::Cell> : public StoreBase
|
||||
class Store<ESM::Cell> : public DynamicStore
|
||||
{
|
||||
struct DynamicExtCmp
|
||||
{
|
||||
@ -366,7 +368,7 @@ namespace MWWorld
|
||||
};
|
||||
|
||||
template <>
|
||||
class Store<ESM::Pathgrid> : public StoreBase
|
||||
class Store<ESM::Pathgrid> : public DynamicStore
|
||||
{
|
||||
private:
|
||||
typedef std::unordered_map<std::string, ESM::Pathgrid, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual> Interior;
|
||||
@ -433,7 +435,7 @@ namespace MWWorld
|
||||
};
|
||||
|
||||
template <>
|
||||
class Store<ESM::WeaponType> : public StoreBase
|
||||
class Store<ESM::WeaponType> : public DynamicStore
|
||||
{
|
||||
std::map<int, ESM::WeaponType> mStatic;
|
||||
|
||||
@ -459,7 +461,7 @@ namespace MWWorld
|
||||
};
|
||||
|
||||
template <>
|
||||
class Store<ESM::Dialogue> : public StoreBase
|
||||
class Store<ESM::Dialogue> : public DynamicStore
|
||||
{
|
||||
typedef std::unordered_map<std::string, ESM::Dialogue, Misc::StringUtils::CiHash, Misc::StringUtils::CiEqual> Static;
|
||||
Static mStatic;
|
||||
|
Loading…
x
Reference in New Issue
Block a user