mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-02-10 03:39:55 +00:00
The tuple types declaration is back in the header, but there is no need for implementation details to be known for any of the types
This commit is contained in:
parent
57df51b4a6
commit
4bb9a4166d
@ -135,54 +135,7 @@ namespace MWWorld
|
||||
|
||||
struct ESMStoreImp
|
||||
{
|
||||
std::tuple <
|
||||
Store<ESM::Activator>,
|
||||
Store<ESM::Potion>,
|
||||
Store<ESM::Apparatus>,
|
||||
Store<ESM::Armor>,
|
||||
Store<ESM::BodyPart>,
|
||||
Store<ESM::Book>,
|
||||
Store<ESM::BirthSign>,
|
||||
Store<ESM::Class>,
|
||||
Store<ESM::Clothing>,
|
||||
Store<ESM::Container>,
|
||||
Store<ESM::Creature>,
|
||||
Store<ESM::Dialogue>,
|
||||
Store<ESM::Door>,
|
||||
Store<ESM::Enchantment>,
|
||||
Store<ESM::Faction>,
|
||||
Store<ESM::Global>,
|
||||
Store<ESM::Ingredient>,
|
||||
Store<ESM::CreatureLevList>,
|
||||
Store<ESM::ItemLevList>,
|
||||
Store<ESM::Light>,
|
||||
Store<ESM::Lockpick>,
|
||||
Store<ESM::Miscellaneous>,
|
||||
Store<ESM::NPC>,
|
||||
Store<ESM::Probe>,
|
||||
Store<ESM::Race>,
|
||||
Store<ESM::Region>,
|
||||
Store<ESM::Repair>,
|
||||
Store<ESM::SoundGenerator>,
|
||||
Store<ESM::Sound>,
|
||||
Store<ESM::Spell>,
|
||||
Store<ESM::StartScript>,
|
||||
Store<ESM::Static>,
|
||||
Store<ESM::Weapon>,
|
||||
Store<ESM::GameSetting>,
|
||||
Store<ESM::Script>,
|
||||
|
||||
// Lists that need special rules
|
||||
Store<ESM::Cell>,
|
||||
Store<ESM::Land>,
|
||||
Store<ESM::LandTexture>,
|
||||
Store<ESM::Pathgrid>,
|
||||
|
||||
Store<ESM::MagicEffect>,
|
||||
Store<ESM::Skill>,
|
||||
|
||||
// Special entry which is hardcoded and not loaded from an ESM
|
||||
Store<ESM::Attribute >> mStores;
|
||||
ESMStore::StoreTuple mStores;
|
||||
|
||||
std::map<ESM::RecNameInts, DynamicStore*> mRecNameToStore;
|
||||
std::unordered_map<const DynamicStore*, ESM::RecNameInts> mStoreToRecName;
|
||||
|
@ -4,6 +4,7 @@
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <unordered_map>
|
||||
#include <tuple>
|
||||
|
||||
#include <components/esm/luascripts.hpp>
|
||||
#include <components/esm/records.hpp>
|
||||
@ -33,11 +34,69 @@ namespace MWWorld
|
||||
{
|
||||
friend struct ESMStoreImp; //This allows StoreImp to extend esmstore without beeing included everywhere
|
||||
|
||||
using StoreTuple = std::tuple <
|
||||
Store<ESM::Activator>,
|
||||
Store<ESM::Potion>,
|
||||
Store<ESM::Apparatus>,
|
||||
Store<ESM::Armor>,
|
||||
Store<ESM::BodyPart>,
|
||||
Store<ESM::Book>,
|
||||
Store<ESM::BirthSign>,
|
||||
Store<ESM::Class>,
|
||||
Store<ESM::Clothing>,
|
||||
Store<ESM::Container>,
|
||||
Store<ESM::Creature>,
|
||||
Store<ESM::Dialogue>,
|
||||
Store<ESM::Door>,
|
||||
Store<ESM::Enchantment>,
|
||||
Store<ESM::Faction>,
|
||||
Store<ESM::Global>,
|
||||
Store<ESM::Ingredient>,
|
||||
Store<ESM::CreatureLevList>,
|
||||
Store<ESM::ItemLevList>,
|
||||
Store<ESM::Light>,
|
||||
Store<ESM::Lockpick>,
|
||||
Store<ESM::Miscellaneous>,
|
||||
Store<ESM::NPC>,
|
||||
Store<ESM::Probe>,
|
||||
Store<ESM::Race>,
|
||||
Store<ESM::Region>,
|
||||
Store<ESM::Repair>,
|
||||
Store<ESM::SoundGenerator>,
|
||||
Store<ESM::Sound>,
|
||||
Store<ESM::Spell>,
|
||||
Store<ESM::StartScript>,
|
||||
Store<ESM::Static>,
|
||||
Store<ESM::Weapon>,
|
||||
Store<ESM::GameSetting>,
|
||||
Store<ESM::Script>,
|
||||
|
||||
// Lists that need special rules
|
||||
Store<ESM::Cell>,
|
||||
Store<ESM::Land>,
|
||||
Store<ESM::LandTexture>,
|
||||
Store<ESM::Pathgrid>,
|
||||
|
||||
Store<ESM::MagicEffect>,
|
||||
Store<ESM::Skill>,
|
||||
|
||||
// Special entry which is hardcoded and not loaded from an ESM
|
||||
Store<ESM::Attribute >>;
|
||||
|
||||
template <class T, class Tuple>
|
||||
struct HasMember;
|
||||
|
||||
template <class T, class ... Args>
|
||||
struct HasMember<T, std::tuple<Store<Args> ...>> {
|
||||
static constexpr bool value = (std::is_same_v<T, Args> || ...);
|
||||
};
|
||||
|
||||
static std::size_t &getTypeIndexCounter();
|
||||
|
||||
template<typename T>
|
||||
static std::size_t getTypeIndex()
|
||||
{
|
||||
static_assert(HasMember<T, StoreTuple>::value);
|
||||
static std::size_t sIndex = getTypeIndexCounter()++;
|
||||
return sIndex;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user