Merge branch 'simplify_world' into 'master'

Refactoring. Put ESMStore to Environment; remove `createRecord` from World.

See merge request OpenMW/openmw!2947
7344-support-launching-the-example-suite
psi29a 2 years ago
commit 675dfb9725

@ -776,6 +776,7 @@ void OMW::Engine::prepareEngine()
mEnvironment.setWorld(*mWorld);
mEnvironment.setWorldModel(mWorld->getWorldModel());
mEnvironment.setWorldScene(mWorld->getWorldScene());
mEnvironment.setESMStore(mWorld->getStore());
const MWWorld::Store<ESM::GameSetting>* gmst = &mWorld->getStore().get<ESM::GameSetting>();
mL10nManager->setGmstLoader(

@ -17,6 +17,7 @@ namespace l10n
namespace MWWorld
{
class ESMStore;
class WorldModel;
class Scene;
}
@ -45,6 +46,7 @@ namespace MWBase
World* mWorld = nullptr;
MWWorld::WorldModel* mWorldModel = nullptr;
MWWorld::Scene* mWorldScene = nullptr;
MWWorld::ESMStore* mESMStore = nullptr;
SoundManager* mSoundManager = nullptr;
ScriptManager* mScriptManager = nullptr;
WindowManager* mWindowManager = nullptr;
@ -71,6 +73,7 @@ namespace MWBase
void setWorld(World& value) { mWorld = &value; }
void setWorldModel(MWWorld::WorldModel& value) { mWorldModel = &value; }
void setWorldScene(MWWorld::Scene& value) { mWorldScene = &value; }
void setESMStore(MWWorld::ESMStore& value) { mESMStore = &value; }
void setSoundManager(SoundManager& value) { mSoundManager = &value; }
@ -97,6 +100,7 @@ namespace MWBase
Misc::NotNullPtr<World> getWorld() const { return mWorld; }
Misc::NotNullPtr<MWWorld::WorldModel> getWorldModel() const { return mWorldModel; }
Misc::NotNullPtr<MWWorld::Scene> getWorldScene() const { return mWorldScene; }
Misc::NotNullPtr<MWWorld::ESMStore> getESMStore() const { return mESMStore; }
Misc::NotNullPtr<SoundManager> getSoundManager() const { return mSoundManager; }

@ -147,7 +147,8 @@ namespace MWBase
virtual MWWorld::Ptr getPlayerPtr() = 0;
virtual MWWorld::ConstPtr getPlayerConstPtr() const = 0;
virtual const MWWorld::ESMStore& getStore() const = 0;
virtual MWWorld::ESMStore& getStore() = 0;
const MWWorld::ESMStore& getStore() const { return const_cast<MWBase::World*>(this)->getStore(); }
virtual const std::vector<int>& getESMVersions() const = 0;
@ -344,66 +345,6 @@ namespace MWBase
///< Toggle a render mode.
///< \return Resulting mode
virtual const ESM::Potion* createRecord(const ESM::Potion& record) = 0;
///< Create a new record (of type potion) in the ESM store.
/// \return pointer to created record
virtual const ESM::Spell* createRecord(const ESM::Spell& record) = 0;
///< Create a new record (of type spell) in the ESM store.
/// \return pointer to created record
virtual const ESM::Class* createRecord(const ESM::Class& record) = 0;
///< Create a new record (of type class) in the ESM store.
/// \return pointer to created record
virtual const ESM::Cell* createRecord(const ESM::Cell& record) = 0;
///< Create a new record (of type cell) in the ESM store.
/// \return pointer to created record
virtual const ESM::NPC* createRecord(const ESM::NPC& record) = 0;
///< Create a new record (of type npc) in the ESM store.
/// \return pointer to created record
virtual const ESM::Armor* createRecord(const ESM::Armor& record) = 0;
///< Create a new record (of type armor) in the ESM store.
/// \return pointer to created record
virtual const ESM::Weapon* createRecord(const ESM::Weapon& record) = 0;
///< Create a new record (of type weapon) in the ESM store.
/// \return pointer to created record
virtual const ESM::Clothing* createRecord(const ESM::Clothing& record) = 0;
///< Create a new record (of type clothing) in the ESM store.
/// \return pointer to created record
virtual const ESM::Enchantment* createRecord(const ESM::Enchantment& record) = 0;
///< Create a new record (of type enchantment) in the ESM store.
/// \return pointer to created record
virtual const ESM::Book* createRecord(const ESM::Book& record) = 0;
///< Create a new record (of type book) in the ESM store.
/// \return pointer to created record
virtual const ESM::CreatureLevList* createOverrideRecord(const ESM::CreatureLevList& record) = 0;
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
/// \return pointer to created record
virtual const ESM::ItemLevList* createOverrideRecord(const ESM::ItemLevList& record) = 0;
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
/// \return pointer to created record
virtual const ESM::Creature* createOverrideRecord(const ESM::Creature& record) = 0;
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
/// \return pointer to created record
virtual const ESM::NPC* createOverrideRecord(const ESM::NPC& record) = 0;
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
/// \return pointer to created record
virtual const ESM::Container* createOverrideRecord(const ESM::Container& record) = 0;
///< Write this record to the ESM store, allowing it to override a pre-existing record with the same ID.
/// \return pointer to created record
virtual MWWorld::Ptr placeObject(const MWWorld::ConstPtr& object, float cursorX, float cursorY, int amount) = 0;
///< copy and place an object into the gameworld at the specified cursor position
/// @param object

@ -120,7 +120,7 @@ namespace MWClass
{
if (actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
const ESM::Sound* sound = store.get<ESM::Sound>().searchRandom("WolfActivator", prng);
@ -144,7 +144,7 @@ namespace MWClass
{
const std::string model
= getModel(ptr); // Assume it's not empty, since we wouldn't have gotten the soundgen otherwise
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::RefId* creatureId = nullptr;
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();

@ -153,7 +153,7 @@ namespace MWClass
return -1;
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
float iWeight = floor(gmst.find(typeGmst)->mValue.getFloat());
@ -289,7 +289,7 @@ namespace MWClass
newItem.mName = newName;
newItem.mData.mEnchant = enchCharge;
newItem.mEnchant = enchId;
const ESM::Armor* record = MWBase::Environment::get().getWorld()->createRecord(newItem);
const ESM::Armor* record = MWBase::Environment::get().getESMStore()->insert(newItem);
return record->mId;
}
@ -300,8 +300,11 @@ namespace MWClass
int armorSkillType = getEquipmentSkill(ptr);
float armorSkill = actor.getClass().getSkill(actor, armorSkillType);
const MWBase::World* world = MWBase::Environment::get().getWorld();
int iBaseArmorSkill = world->getStore().get<ESM::GameSetting>().find("iBaseArmorSkill")->mValue.getInteger();
int iBaseArmorSkill = MWBase::Environment::get()
.getESMStore()
->get<ESM::GameSetting>()
.find("iBaseArmorSkill")
->mValue.getInteger();
if (ref->mBase->mData.mWeight == 0)
return ref->mBase->mData.mArmor;
@ -327,7 +330,7 @@ namespace MWClass
const ESM::RefId& npcRace = npc.get<ESM::NPC>()->mBase->mRace;
// Beast races cannot equip shoes / boots, or full helms (head part vs hair part)
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(npcRace);
if (race->mData.mFlags & ESM::Race::Beast)
{
std::vector<ESM::PartReference> parts = ptr.get<ESM::Armor>()->mBase->mParts.mParts;

@ -58,7 +58,7 @@ namespace MWClass
{
if (actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
const ESM::Sound* sound = store.get<ESM::Sound>().searchRandom("WolfItem", prng);
@ -151,7 +151,7 @@ namespace MWClass
newItem.mData.mIsScroll = 1;
newItem.mData.mEnchant = enchCharge;
newItem.mEnchant = enchId;
const ESM::Book* record = MWBase::Environment::get().getWorld()->createRecord(newItem);
const ESM::Book* record = MWBase::Environment::get().getESMStore()->insert(newItem);
return record->mId;
}

@ -196,7 +196,7 @@ namespace MWClass
newItem.mName = newName;
newItem.mData.mEnchant = enchCharge;
newItem.mEnchant = enchId;
const ESM::Clothing* record = MWBase::Environment::get().getWorld()->createRecord(newItem);
const ESM::Clothing* record = MWBase::Environment::get().getESMStore()->insert(newItem);
return record->mId;
}
@ -214,7 +214,7 @@ namespace MWClass
const ESM::RefId& npcRace = npc.get<ESM::NPC>()->mBase->mRace;
// Beast races cannot equip shoes / boots, or full helms (head part vs hair part)
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npcRace);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(npcRace);
if (race->mData.mFlags & ESM::Race::Beast)
{
std::vector<ESM::PartReference> parts = ptr.get<ESM::Clothing>()->mBase->mParts.mParts;

@ -141,7 +141,7 @@ namespace MWClass
if (actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
const ESM::Sound* sound = store.get<ESM::Sound>().searchRandom("WolfContainer", prng);

@ -91,8 +91,8 @@ namespace MWClass
static const GMST staticGmst = [] {
GMST gmst;
const MWBase::World* world = MWBase::Environment::get().getWorld();
const MWWorld::Store<ESM::GameSetting>& store = world->getStore().get<ESM::GameSetting>();
const MWWorld::Store<ESM::GameSetting>& store
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
gmst.fMinWalkSpeedCreature = store.find("fMinWalkSpeedCreature");
gmst.fMaxWalkSpeedCreature = store.find("fMaxWalkSpeedCreature");
@ -469,7 +469,7 @@ namespace MWClass
{
if (actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
const ESM::Sound* sound = store.get<ESM::Sound>().searchRandom("WolfCreature", prng);
@ -647,7 +647,7 @@ namespace MWClass
const ESM::RefId& ourId = (ref->mBase->mOriginal.empty()) ? ptr.getCellRef().getRefId() : ref->mBase->mOriginal;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
auto sound = store.get<ESM::SoundGenerator>().begin();
while (sound != store.get<ESM::SoundGenerator>().end())
{
@ -766,7 +766,7 @@ namespace MWClass
{
MWWorld::LiveCellRef<ESM::Creature>* ref = ptr.get<ESM::Creature>();
const ESM::Skill* skillRecord = MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>().find(skill);
const ESM::Skill* skillRecord = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().find(skill);
switch (skillRecord->mData.mSpecialization)
{
@ -862,7 +862,7 @@ namespace MWClass
return;
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fCorpseRespawnDelay = gmst.find("fCorpseRespawnDelay")->mValue.getFloat();
static const float fCorpseClearDelay = gmst.find("fCorpseClearDelay")->mValue.getFloat();

@ -86,7 +86,7 @@ namespace MWClass
else if (creatureStats.isDead())
{
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fCorpseRespawnDelay = gmst.find("fCorpseRespawnDelay")->mValue.getFloat();
static const float fCorpseClearDelay = gmst.find("fCorpseClearDelay")->mValue.getFloat();
@ -111,7 +111,7 @@ namespace MWClass
if (it->mLevel > player.getClass().getCreatureStats(player).getLevel())
continue;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
MWWorld::ManualRef ref(store, it->mId);
ref.getPtr().getClass().getModelsToPreload(ref.getPtr(), models);
}
@ -127,7 +127,7 @@ namespace MWClass
if (!customData.mSpawn)
return;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
const ESM::RefId& id = MWMechanics::getLevelledItem(
store.get<ESM::CreatureLevList>().find(ptr.getCellRef().getRefId()), true, prng);

@ -133,7 +133,7 @@ namespace MWClass
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr);
if (animation)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::MagicEffect* effect = store.get<ESM::MagicEffect>().find(ESM::MagicEffect::Telekinesis);
animation->addSpellCastGlow(

@ -126,9 +126,8 @@ namespace MWClass
float alchemySkill = player.getClass().getSkill(player, ESM::Skill::Alchemy);
static const float fWortChanceValue = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fWortChanceValue")
->mValue.getFloat();

@ -86,7 +86,7 @@ namespace MWClass
if (!ptr.getCellRef().getSoul().empty())
{
const ESM::Creature* creature
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().search(ref->mRef.getSoul());
= MWBase::Environment::get().getESMStore()->get<ESM::Creature>().search(ref->mRef.getSoul());
if (creature)
{
int soul = creature->mData.mSoul;
@ -177,7 +177,7 @@ namespace MWClass
{
MWWorld::Ptr newPtr;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
if (isGold(ptr))
{

@ -84,7 +84,7 @@ namespace
void autoCalculateAttributes(const ESM::NPC* npc, MWMechanics::CreatureStats& creatureStats)
{
// race bonus
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npc->mRace);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(npc->mRace);
bool male = (npc->mFlags & ESM::NPC::Female) == 0;
@ -96,8 +96,7 @@ namespace
}
// class bonus
const ESM::Class* class_
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(npc->mClass);
const ESM::Class* class_ = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
for (int i = 0; i < 2; ++i)
{
@ -115,7 +114,7 @@ namespace
for (int j = 0; j < ESM::Skill::Length; ++j)
{
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>().find(j);
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().find(j);
if (skill->mData.mAttribute != attribute)
continue;
@ -174,12 +173,11 @@ namespace
void autoCalculateSkills(
const ESM::NPC* npc, MWMechanics::NpcStats& npcStats, const MWWorld::Ptr& ptr, bool spellsInitialised)
{
const ESM::Class* class_
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(npc->mClass);
const ESM::Class* class_ = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
unsigned int level = npcStats.getLevel();
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(npc->mRace);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(npc->mRace);
for (int i = 0; i < 2; ++i)
{
@ -223,8 +221,7 @@ namespace
}
// is this skill in the same Specialization as the class?
const ESM::Skill* skill
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>().find(skillIndex);
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().find(skillIndex);
if (skill->mData.mSpecialization == class_->mData.mSpecialization)
{
specMultiplier = 0.5f;
@ -276,8 +273,8 @@ namespace MWClass
static const GMST staticGmst = [] {
GMST gmst;
const MWBase::World* world = MWBase::Environment::get().getWorld();
const MWWorld::Store<ESM::GameSetting>& store = world->getStore().get<ESM::GameSetting>();
const MWWorld::Store<ESM::GameSetting>& store
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
gmst.fMinWalkSpeed = store.find("fMinWalkSpeed");
gmst.fMaxWalkSpeed = store.find("fMaxWalkSpeed");
@ -367,22 +364,19 @@ namespace MWClass
data->mNpcStats.setDeathAnimationFinished(isPersistent(ptr));
// race powers
const ESM::Race* race
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(ref->mBase->mRace);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(ref->mBase->mRace);
data->mNpcStats.getSpells().addAllToInstance(race->mPowers.mList);
if (!ref->mBase->mFaction.empty())
{
static const int iAutoRepFacMod = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("iAutoRepFacMod")
->mValue.getInteger();
static const int iAutoRepLevMod = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("iAutoRepLevMod")
->mValue.getInteger();
int rank = ref->mBase->getFactionRank();
@ -435,8 +429,7 @@ namespace MWClass
const MWWorld::LiveCellRef<ESM::NPC>* ref = ptr.get<ESM::NPC>();
std::string model = Settings::Manager::getString("baseanim", "Models");
const ESM::Race* race
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(ref->mBase->mRace);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(ref->mBase->mRace);
if (race->mData.mFlags & ESM::Race::Beast)
model = Settings::Manager::getString("baseanimkna", "Models");
@ -446,8 +439,7 @@ namespace MWClass
void Npc::getModelsToPreload(const MWWorld::Ptr& ptr, std::vector<std::string>& models) const
{
const MWWorld::LiveCellRef<ESM::NPC>* npc = ptr.get<ESM::NPC>();
const ESM::Race* race
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().search(npc->mBase->mRace);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().search(npc->mBase->mRace);
if (race && race->mData.mFlags & ESM::Race::Beast)
models.emplace_back(Settings::Manager::getString("baseanimkna", "Models"));
@ -464,14 +456,14 @@ namespace MWClass
if (!npc->mBase->mHead.empty())
{
const ESM::BodyPart* head
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(npc->mBase->mHead);
= MWBase::Environment::get().getESMStore()->get<ESM::BodyPart>().search(npc->mBase->mHead);
if (head)
models.push_back(Misc::ResourceHelpers::correctMeshPath(head->mModel, vfs));
}
if (!npc->mBase->mHair.empty())
{
const ESM::BodyPart* hair
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(npc->mBase->mHair);
= MWBase::Environment::get().getESMStore()->get<ESM::BodyPart>().search(npc->mBase->mHair);
if (hair)
models.push_back(Misc::ResourceHelpers::correctMeshPath(hair->mModel, vfs));
}
@ -510,7 +502,7 @@ namespace MWClass
= (female && !it->mFemale.empty()) || (!female && it->mMale.empty()) ? it->mFemale : it->mMale;
const ESM::BodyPart* part
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>().search(partname);
= MWBase::Environment::get().getESMStore()->get<ESM::BodyPart>().search(partname);
if (part && !part->mModel.empty())
models.push_back(Misc::ResourceHelpers::correctMeshPath(part->mModel, vfs));
}
@ -536,8 +528,8 @@ namespace MWClass
if (ptr.getRefData().getCustomData()
&& ptr.getRefData().getCustomData()->asNpcCustomData().mNpcStats.isWerewolf())
{
const MWBase::World* world = MWBase::Environment::get().getWorld();
const MWWorld::Store<ESM::GameSetting>& store = world->getStore().get<ESM::GameSetting>();
const MWWorld::Store<ESM::GameSetting>& store
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
return store.find("sWerewolfPopup")->mValue.getString();
}
@ -784,7 +776,7 @@ namespace MWClass
// 'ptr' is losing health. Play a 'hit' voiced dialog entry if not already saying
// something, alert the character controller, scripts, etc.
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const GMST& gmst = getGmst();
int chance = store.get<ESM::GameSetting>().find("iVoiceHitOdds")->mValue.getInteger();
@ -932,7 +924,7 @@ namespace MWClass
// Werewolfs can't activate NPCs
if (actor.getClass().isNpc() && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
const ESM::Sound* sound = store.get<ESM::Sound>().searchRandom("WolfNPC", prng);
@ -1153,9 +1145,8 @@ namespace MWClass
{
const MWMechanics::CreatureStats& stats = getCreatureStats(ptr);
static const float fEncumbranceStrMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fEncumbranceStrMult")
->mValue.getFloat();
return stats.getAttribute(ESM::Attribute::Strength).getModified() * fEncumbranceStrMult;
@ -1187,16 +1178,15 @@ namespace MWClass
MWWorld::LiveCellRef<ESM::NPC>* ref = ptr.get<ESM::NPC>();
const ESM::Class* class_
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(ref->mBase->mClass);
const ESM::Class* class_ = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(ref->mBase->mClass);
stats.useSkill(skill, *class_, usageType, extraFactor);
}
float Npc::getArmorRating(const MWWorld::Ptr& ptr) const
{
const MWBase::World* world = MWBase::Environment::get().getWorld();
const MWWorld::Store<ESM::GameSetting>& store = world->getStore().get<ESM::GameSetting>();
const MWWorld::Store<ESM::GameSetting>& store
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
MWMechanics::NpcStats& stats = getNpcStats(ptr);
const MWWorld::InventoryStore& invStore = getInventoryStore(ptr);
@ -1249,8 +1239,7 @@ namespace MWClass
const MWWorld::LiveCellRef<ESM::NPC>* ref = ptr.get<ESM::NPC>();
const ESM::Race* race
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(ref->mBase->mRace);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(ref->mBase->mRace);
// Race weight should not affect 1st-person meshes, otherwise it will change hand proportions and can break
// aiming.
@ -1283,8 +1272,7 @@ namespace MWClass
const ESM::NPC* npc = actor.get<ESM::NPC>()->mBase;
if (npc->mFlags & ESM::NPC::Autocalc)
{
const ESM::Class* class_
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(npc->mClass);
const ESM::Class* class_ = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(npc->mClass);
return class_->mData.mServices;
}
return npc->mAiData.mServices;
@ -1470,7 +1458,7 @@ namespace MWClass
return;
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fCorpseRespawnDelay = gmst.find("fCorpseRespawnDelay")->mValue.getFloat();
static const float fCorpseClearDelay = gmst.find("fCorpseClearDelay")->mValue.getFloat();

@ -155,7 +155,7 @@ namespace MWClass
= MyGUI::TextIterator::toTagsString(MWGui::toUString(name)) + MWGui::ToolTips::getCountString(count);
info.icon = ref->mBase->mIcon;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
std::string text;
@ -269,7 +269,7 @@ namespace MWClass
newItem.mData.mEnchant = enchCharge;
newItem.mEnchant = enchId;
newItem.mData.mFlags |= ESM::Weapon::Magical;
const ESM::Weapon* record = MWBase::Environment::get().getWorld()->createRecord(newItem);
const ESM::Weapon* record = MWBase::Environment::get().getESMStore()->insert(newItem);
return record->mId;
}

@ -155,8 +155,7 @@ namespace MWDialogue
mActorKnownTopics.clear();
// greeting
const MWWorld::Store<ESM::Dialogue>& dialogs
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
const MWWorld::Store<ESM::Dialogue>& dialogs = MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>();
Filter filter(actor, mChoice, mTalkedTo);
@ -288,8 +287,7 @@ namespace MWDialogue
{
Filter filter(mActor, mChoice, mTalkedTo);
const MWWorld::Store<ESM::Dialogue>& dialogues
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
const MWWorld::Store<ESM::Dialogue>& dialogues = MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>();
const ESM::Dialogue& dialogue = *dialogues.find(topic);
@ -308,7 +306,7 @@ namespace MWDialogue
modifiedTopic.erase(std::remove(modifiedTopic.begin(), modifiedTopic.end(), ' '), modifiedTopic.end());
const MWWorld::Store<ESM::GameSetting>& gmsts
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
title = gmsts.find(modifiedTopic)->mValue.getString();
}
@ -343,7 +341,7 @@ namespace MWDialogue
const ESM::Dialogue* DialogueManager::searchDialogue(const ESM::RefId& id)
{
return MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().search(id);
return MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>().search(id);
}
void DialogueManager::updateGlobals()
@ -357,7 +355,7 @@ namespace MWDialogue
mActorKnownTopics.clear();
const auto& dialogs = MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
const auto& dialogs = MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>();
Filter filter(mActor, -1, mTalkedTo);
@ -607,8 +605,7 @@ namespace MWDialogue
{
Filter filter(mActor, service, mTalkedTo);
const MWWorld::Store<ESM::Dialogue>& dialogues
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
const MWWorld::Store<ESM::Dialogue>& dialogues = MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>();
const ESM::Dialogue& dialogue = *dialogues.find(ESM::RefId::stringRefId("Service Refusal"));
@ -620,7 +617,7 @@ namespace MWDialogue
addTopicsFromText(info->mResponse);
const MWWorld::Store<ESM::GameSetting>& gmsts
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
MWScript::InterpreterContext interpreterContext(&mActor.getRefData().getLocals(), mActor);
@ -654,7 +651,7 @@ namespace MWDialogue
return;
}
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Dialogue* dial = store.get<ESM::Dialogue>().find(topic);
const MWMechanics::CreatureStats& creatureStats = actor.getClass().getCreatureStats(actor);
@ -695,7 +692,7 @@ namespace MWDialogue
{
if (type == ESM::REC_DIAS)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
ESM::DialogueState state;
state.load(reader);
@ -712,8 +709,8 @@ namespace MWDialogue
void DialogueManager::modFactionReaction(const ESM::RefId& faction1, const ESM::RefId& faction2, int diff)
{
// Make sure the factions exist
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(faction1);
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(faction2);
MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(faction1);
MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(faction2);
int newValue = getFactionReaction(faction1, faction2) + diff;
@ -724,8 +721,8 @@ namespace MWDialogue
void DialogueManager::setFactionReaction(const ESM::RefId& faction1, const ESM::RefId& faction2, int absolute)
{
// Make sure the factions exist
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(faction1);
MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(faction2);
MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(faction1);
MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(faction2);
auto& map = mChangedFactionReaction[faction1];
map[faction2] = absolute;
@ -737,8 +734,7 @@ namespace MWDialogue
if (map != mChangedFactionReaction.end() && map->second.find(faction2) != map->second.end())
return map->second.at(faction2);
const ESM::Faction* faction
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(faction1);
const ESM::Faction* faction = MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(faction1);
auto it = faction->mReactions.begin();
for (; it != faction->mReactions.end(); ++it)

@ -650,8 +650,7 @@ bool MWDialogue::Filter::hasFactionRankSkillRequirements(
if (!actor.getClass().getNpcStats(actor).hasSkillsForRank(factionId, rank))
return false;
const ESM::Faction& faction
= *MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionId);
const ESM::Faction& faction = *MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(factionId);
MWMechanics::CreatureStats& stats = actor.getClass().getCreatureStats(actor);
@ -667,8 +666,7 @@ bool MWDialogue::Filter::hasFactionRankReputationRequirements(
MWMechanics::NpcStats& stats = actor.getClass().getNpcStats(actor);
const ESM::Faction& faction
= *MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionId);
const ESM::Faction& faction = *MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(factionId);
return stats.getFactionReputation(factionId) >= faction.mData.mRankData[rank].mFactReaction;
}
@ -724,8 +722,7 @@ std::vector<const ESM::DialInfo*> MWDialogue::Filter::list(
// No response is valid because of low NPC disposition,
// search a response in the topic "Info Refusal"
const MWWorld::Store<ESM::Dialogue>& dialogues
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>();
const MWWorld::Store<ESM::Dialogue>& dialogues = MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>();
const ESM::Dialogue& infoRefusalDialogue = *dialogues.find(ESM::RefId::stringRefId("Info Refusal"));

@ -48,7 +48,7 @@ namespace MWDialogue
void tokenizeKeywords(const std::string& text, std::vector<Token>& tokens)
{
const auto& keywordSearch
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().getDialogIdKeywordSearch();
= MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>().getDialogIdKeywordSearch();
std::vector<KeywordSearch<std::string, int /*unused*/>::Match> matches;
keywordSearch.highlightKeywords(text.begin(), text.end(), matches);

@ -19,8 +19,7 @@ namespace MWDialogue
Entry::Entry(const ESM::RefId& topic, const ESM::RefId& infoId, const MWWorld::Ptr& actor)
: mInfoId(infoId)
{
const ESM::Dialogue* dialogue
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find(topic);
const ESM::Dialogue* dialogue = MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>().find(topic);
for (ESM::Dialogue::InfoContainer::const_iterator iter(dialogue->mInfo.begin()); iter != dialogue->mInfo.end();
++iter)
@ -87,8 +86,7 @@ namespace MWDialogue
const ESM::RefId& JournalEntry::idFromIndex(const ESM::RefId& topic, int index)
{
const ESM::Dialogue* dialogue
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find(topic);
const ESM::Dialogue* dialogue = MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>().find(topic);
for (ESM::Dialogue::InfoContainer::const_iterator iter(dialogue->mInfo.begin()); iter != dialogue->mInfo.end();
++iter)

@ -49,7 +49,7 @@ namespace MWDialogue
bool Journal::isThere(const ESM::RefId& topicId, const ESM::RefId& infoId) const
{
if (const ESM::Dialogue* dialogue
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().search(topicId))
= MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>().search(topicId))
{
if (infoId.empty())
return true;

@ -34,8 +34,7 @@ namespace MWDialogue
std::string_view Quest::getName() const
{
const ESM::Dialogue* dialogue
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find(mTopic);
const ESM::Dialogue* dialogue = MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>().find(mTopic);
for (ESM::Dialogue::InfoContainer::const_iterator iter(dialogue->mInfo.begin()); iter != dialogue->mInfo.end();
++iter)
@ -69,7 +68,7 @@ namespace MWDialogue
bool Quest::addEntry(const JournalEntry& entry)
{
const ESM::Dialogue* dialogue
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find(entry.mTopic);
= MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>().find(entry.mTopic);
auto info = std::find_if(dialogue->mInfo.begin(), dialogue->mInfo.end(),
[&](const auto& info) { return info.mId == entry.mInfoId; });

@ -91,7 +91,7 @@ namespace MWDialogue
std::pair<int, int> compileAll(const Compiler::Extensions* extensions, int warningsMode)
{
int compiled = 0, total = 0;
const auto& store = MWBase::Environment::get().getWorld()->getStore();
const auto& store = *MWBase::Environment::get().getESMStore();
MWScript::CompilerContext compilerContext(MWScript::CompilerContext::Type_Dialogue);
compilerContext.setExtensions(extensions);

@ -11,8 +11,7 @@ namespace MWDialogue
Topic::Topic(const ESM::RefId& topic)
: mTopic(topic)
, mName(
MWBase::Environment::get().getWorld()->getStore().get<ESM::Dialogue>().find(topic)->mId.getRefIdString())
, mName(MWBase::Environment::get().getESMStore()->get<ESM::Dialogue>().find(topic)->mId.getRefIdString())
{
}

@ -356,7 +356,7 @@ namespace MWGui
Widgets::SpellEffectParams params;
params.mEffectID = effectKey.mId;
const ESM::MagicEffect* magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectKey.mId);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effectKey.mId);
if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetSkill)
params.mSkill = effectKey.mArg;
else if (magicEffect->mData.mFlags & ESM::MagicEffect::TargetAttribute)

@ -147,8 +147,7 @@ namespace MWGui
{
mBirthList->removeAllItems();
const MWWorld::Store<ESM::BirthSign>& signs
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>();
const MWWorld::Store<ESM::BirthSign>& signs = MWBase::Environment::get().getESMStore()->get<ESM::BirthSign>();
// sort by name
std::vector<std::pair<ESM::RefId, const ESM::BirthSign*>> birthSigns;
@ -192,7 +191,7 @@ namespace MWGui
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
MyGUI::IntCoord coord(0, 0, mSpellArea->getWidth(), lineHeight);
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::BirthSign* birth = store.get<ESM::BirthSign>().find(mCurrentBirthId);

@ -353,7 +353,7 @@ namespace MWGui
if (!classId.empty())
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(classId);
const ESM::Class* klass = MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(classId);
const ESM::Class* klass = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(classId);
if (klass)
{
mPlayerClass = *klass;
@ -686,8 +686,7 @@ namespace MWGui
MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass);
const ESM::Class* klass
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(mGenerateClass);
const ESM::Class* klass = MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(mGenerateClass);
mPlayerClass = *klass;
}

@ -65,7 +65,7 @@ namespace MWGui
setClassImage(mClassImage, mCurrentClassId);
mClassName->setCaption(
MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(mCurrentClassId)->mName);
MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(mCurrentClassId)->mName);
center();
}
@ -208,7 +208,7 @@ namespace MWGui
{
mClassList->removeAllItems();
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
std::vector<std::pair<ESM::RefId, std::string>> items; // class id, class name
for (const ESM::Class& classInfo : store.get<ESM::Class>())
@ -246,7 +246,7 @@ namespace MWGui
{
if (mCurrentClassId.empty())
return;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Class* klass = store.get<ESM::Class>().search(mCurrentClassId);
if (!klass)
return;

@ -107,7 +107,7 @@ namespace MWGui
scanner.listKeywords(mNames);
// identifier
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
std::vector<ESM::RefId> ids;
for (const auto* store : esmStore)
{

@ -390,7 +390,7 @@ namespace MWGui
return;
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
const std::string& sPersuasion = gmst.find("sPersuasion")->mValue.getString();
const std::string& sCompanionShare = gmst.find("sCompanionShare")->mValue.getString();
@ -492,9 +492,8 @@ namespace MWGui
{
MWMechanics::CreatureStats& sellerStats = mPtr.getClass().getCreatureStats(mPtr);
float delay = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fBarterGoldResetDelay")
->mValue.getFloat();
@ -545,7 +544,7 @@ namespace MWGui
&& !mPtr.get<ESM::Creature>()->mBase->getTransport().empty());
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
if (mPtr.getType() == ESM::NPC::sRecordId)
mTopicsList->addItem(gmst.find("sPersuasion")->mValue.getString());
@ -639,9 +638,8 @@ namespace MWGui
auto interactiveId = TypesetBook::InteractiveId(link.get());
mLinks.push_back(std::move(link));
const std::string& goodbye = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("sGoodbye")
->mValue.getString();
BookTypesetter::Style* questionStyle = typesetter->createHotStyle(

@ -342,9 +342,8 @@ namespace MWGui
item.getCellRef().getRefId(), mPtr))
{
std::string msg = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("sNotifyMessage49")
->mValue.getString();
msg = Misc::StringUtils::format(msg, item.getClass().getName(item));

@ -394,7 +394,7 @@ namespace MWGui
void HUD::setSelectedSpell(const ESM::RefId& spellId, int successChancePercent)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(spellId);
const std::string& spellName = spell->mName;
if (spellName != mSpellName && mSpellVisible)
@ -412,7 +412,7 @@ namespace MWGui
mSpellBox->setUserString("Spell", spellId.serialize());
// use the icon of the first effect
const ESM::MagicEffect* effect = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(
const ESM::MagicEffect* effect = MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(
spell->mEffects.mList.front().mEffectID);
std::string icon = effect->mIcon;
@ -617,9 +617,8 @@ namespace MWGui
mEnemyHealth->setProgressPosition(static_cast<size_t>(stats.getHealth().getRatio() * 100));
static const float fNPCHealthBarFade = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fNPCHealthBarFade")
->mValue.getFloat();
if (fNPCHealthBarFade > 0.f)
@ -630,9 +629,8 @@ namespace MWGui
{
mEnemyActorId = enemy.getClass().getCreatureStats(enemy).getActorId();
mEnemyHealthTimer = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fNPCHealthBarTime")
->mValue.getFloat();
if (!mEnemyHealth->getVisible())

@ -194,7 +194,7 @@ namespace MWGui
if (enchId.empty())
break;
const ESM::Enchantment* ench
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().search(enchId);
= MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>().search(enchId);
if (!ench)
break;

@ -103,7 +103,7 @@ namespace MWGui
}
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
std::string message;
if (mDays == 1)

@ -1315,8 +1315,8 @@ namespace MWGui
for (const ESM::GlobalMap::CellId& cellId : map.mMarkers)
{
const ESM::Cell* cell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Cell>().search(
cellId.first, cellId.second);
const ESM::Cell* cell
= MWBase::Environment::get().getESMStore()->get<ESM::Cell>().search(cellId.first, cellId.second);
if (cell && !cell->mName.empty())
addVisitedLocation(cell->mName, cellId.first, cellId.second);
}

@ -56,9 +56,8 @@ namespace MWGui
int basePrice = iter->getClass().getValue(*iter);
float fRepairMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fRepairMult")
->mValue.getFloat();
@ -73,12 +72,7 @@ namespace MWGui
std::string name{ iter->getClass().getName(*iter) };
name += " - " + MyGUI::utility::toString(price)
+ MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.find("sgp")
->mValue.getString();
+ MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>().find("sgp")->mValue.getString();
MyGUI::Button* button = mList->createWidget<MyGUI::Button>(price <= playerGold
? "SandTextButton"

@ -287,7 +287,7 @@ namespace MWGui
while (mSelected->button->getChildCount()) // Destroy number label
MyGUI::Gui::getInstance().destroyWidget(mSelected->button->getChildAt(0));
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
const ESM::Spell* spell = esmStore.get<ESM::Spell>().find(spellId);
mSelected->type = ESM::QuickKeys::Type::Magic;
@ -552,7 +552,7 @@ namespace MWGui
switch (quickKey.mType)
{
case ESM::QuickKeys::Type::Magic:
if (MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(quickKey.mId))
if (MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(quickKey.mId))
onAssignMagic(quickKey.mId);
break;
case ESM::QuickKeys::Type::Item:

@ -316,8 +316,7 @@ namespace MWGui
void RaceDialog::getBodyParts(int part, std::vector<ESM::RefId>& out)
{
out.clear();
const MWWorld::Store<ESM::BodyPart>& store
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BodyPart>();
const MWWorld::Store<ESM::BodyPart>& store = MWBase::Environment::get().getESMStore()->get<ESM::BodyPart>();
for (const ESM::BodyPart& bodypart : store)
{
@ -373,7 +372,7 @@ namespace MWGui
{
mRaceList->removeAllItems();
const MWWorld::Store<ESM::Race>& races = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>();
const MWWorld::Store<ESM::Race>& races = MWBase::Environment::get().getESMStore()->get<ESM::Race>();
std::vector<std::pair<ESM::RefId, std::string>> items; // ID, name
for (const ESM::Race& race : races)
@ -411,7 +410,7 @@ namespace MWGui
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
MyGUI::IntCoord coord1(0, 0, mSkillList->getWidth(), 18);
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Race* race = store.get<ESM::Race>().find(mCurrentRaceId);
int count = sizeof(race->mData.mBonus)
/ sizeof(race->mData.mBonus[0]); // TODO: Find a portable macro for this ARRAYSIZE?
@ -448,7 +447,7 @@ namespace MWGui
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
MyGUI::IntCoord coord(0, 0, mSpellPowerList->getWidth(), lineHeight);
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Race* race = store.get<ESM::Race>().find(mCurrentRaceId);
int i = 0;

@ -69,8 +69,7 @@ namespace MWGui
MWWorld::Ptr gem = *mGemIcon->getUserData<MWWorld::Ptr>();
const ESM::RefId& soul = gem.getCellRef().getSoul();
const ESM::Creature* creature
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(soul);
const ESM::Creature* creature = MWBase::Environment::get().getESMStore()->get<ESM::Creature>().find(soul);
mChargeLabel->setCaptionWithReplacing("#{sCharges} " + MyGUI::utility::toString(creature->mData.mSoul));

@ -128,7 +128,7 @@ namespace MWGui
{
mRaceId = raceId;
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().search(mRaceId);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().search(mRaceId);
if (race)
{
ToolTips::createRaceToolTip(mRaceWidget, race);
@ -150,7 +150,7 @@ namespace MWGui
mBirthSignId = signId;
const ESM::BirthSign* sign
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().search(mBirthSignId);
= MWBase::Environment::get().getESMStore()->get<ESM::BirthSign>().search(mBirthSignId);
if (sign)
{
mBirthSignWidget->setCaption(sign->mName);
@ -391,7 +391,7 @@ namespace MWGui
const ESM::Race* race = nullptr;
if (!mRaceId.empty())
race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(mRaceId);
race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(mRaceId);
int skills[ESM::Skill::Length];
for (int i = 0; i < ESM::Skill::Length; ++i)
@ -420,7 +420,7 @@ namespace MWGui
if (!mBirthSignId.empty())
{
const ESM::BirthSign* sign
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().find(mBirthSignId);
= MWBase::Environment::get().getESMStore()->get<ESM::BirthSign>().find(mBirthSignId);
for (const auto& spellId : sign->mPowers.mList)
{
if (std::find(spells.begin(), spells.end(), spellId) == spells.end())
@ -434,7 +434,7 @@ namespace MWGui
coord1, coord2);
for (auto& spellId : spells)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(spellId);
if (spell->mData.mType == ESM::Spell::ST_Ability)
addItem(spell, coord1, coord2);
}
@ -444,7 +444,7 @@ namespace MWGui
coord2);
for (auto& spellId : spells)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(spellId);
if (spell->mData.mType == ESM::Spell::ST_Power)
addItem(spell, coord1, coord2);
}
@ -454,7 +454,7 @@ namespace MWGui
coord2);
for (auto& spellId : spells)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(spellId);
if (spell->mData.mType == ESM::Spell::ST_Spell)
addItem(spell, coord1, coord2);
}

@ -189,8 +189,7 @@ namespace MWGui
{
// Find the localised name for this class from the store
const ESM::Class* class_
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().search(
signature.mPlayerClassId);
= MWBase::Environment::get().getESMStore()->get<ESM::Class>().search(signature.mPlayerClassId);
if (class_)
className = class_->mName;
else

@ -106,7 +106,7 @@ namespace
if (!leftNameEnch.empty())
{
const ESM::Enchantment* ench
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().search(leftNameEnch);
= MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>().search(leftNameEnch);
if (ench)
{
if (ench->mData.mType == ESM::Enchantment::ConstantEffect)
@ -120,7 +120,7 @@ namespace
if (!rightNameEnch.empty())
{
const ESM::Enchantment* ench
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().search(rightNameEnch);
= MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>().search(rightNameEnch);
if (ench)
{
if (ench->mData.mType == ESM::Enchantment::ConstantEffect)
@ -263,8 +263,7 @@ namespace MWGui
return false;
if ((mFilter & Filter_OnlyChargedSoulstones)
&& (base.getType() != ESM::Miscellaneous::sRecordId || base.getCellRef().getSoul().empty()
|| !MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().search(
base.getCellRef().getSoul())))
|| !MWBase::Environment::get().getESMStore()->get<ESM::Creature>().search(base.getCellRef().getSoul())))
return false;
if ((mFilter & Filter_OnlyRepairTools) && (base.getType() != ESM::Repair::sRecordId))
return false;
@ -297,7 +296,7 @@ namespace MWGui
const ESM::RefId& enchId = base.getClass().getEnchantment(base);
const ESM::Enchantment* ench
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().search(enchId);
= MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>().search(enchId);
if (!ench)
{
Log(Debug::Warning) << "Warning: Can't find enchantment '" << enchId << "' on item "

@ -40,7 +40,7 @@ namespace MWGui
void SpellBuyingWindow::addSpell(const ESM::Spell& spell)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
int price = std::max(1,
static_cast<int>(
@ -103,7 +103,7 @@ namespace MWGui
if (actor.getClass().isNpc())
{
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(
actor.get<ESM::NPC>()->mBase->mRace);
if (race->mPowers.exists(spell->mId))
continue;

@ -35,7 +35,7 @@ namespace
bool sortMagicEffects(short id1, short id2)
{
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
return gmst.find(ESM::MagicEffect::effectIdToString(id1))->mValue.getString()
< gmst.find(ESM::MagicEffect::effectIdToString(id2))->mValue.getString();
@ -161,7 +161,7 @@ namespace MWGui
void EditEffectDialog::editEffect(ESM::ENAMstruct effect)
{
const ESM::MagicEffect* magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effect.mEffectID);
setMagicEffect(magicEffect);
mOldEffect = effect;
@ -416,7 +416,7 @@ namespace MWGui
MWBase::Environment::get().getWindowManager()->playSound(ESM::RefId::stringRefId("Mysticism Hit"));
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->createRecord(mSpell);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->insert(mSpell);
MWMechanics::CreatureStats& stats = player.getClass().getCreatureStats(player);
MWMechanics::Spells& spells = stats.getSpells();
@ -457,7 +457,7 @@ namespace MWGui
float y = 0;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
for (const ESM::ENAMstruct& effect : mEffects)
{
@ -529,8 +529,7 @@ namespace MWGui
for (const ESM::ENAMstruct& effectInfo : spell->mEffects.mList)
{
const ESM::MagicEffect* effect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(
effectInfo.mEffectID);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effectInfo.mEffectID);
// skip effects that do not allow spellmaking/enchanting
int requiredFlags
@ -551,9 +550,8 @@ namespace MWGui
for (const short effectId : knownEffects)
{
mAvailableEffectsList->addItem(MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find(ESM::MagicEffect::effectIdToString(effectId))
->mValue.getString());
mButtonMapping[i] = effectId;
@ -565,9 +563,8 @@ namespace MWGui
for (const short effectId : knownEffects)
{
const std::string& name = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find(ESM::MagicEffect::effectIdToString(effectId))
->mValue.getString();
MyGUI::Widget* w = mAvailableEffectsList->getItemWidget(name);
@ -591,7 +588,7 @@ namespace MWGui
void EffectEditorBase::onSelectAttribute()
{
const ESM::MagicEffect* effect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(mSelectedKnownEffectId);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(mSelectedKnownEffectId);
mAddEffectDialog.newEffect(effect);
mAddEffectDialog.setAttribute(mSelectAttributeDialog->getAttributeId());
@ -601,7 +598,7 @@ namespace MWGui
void EffectEditorBase::onSelectSkill()
{
const ESM::MagicEffect* effect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(mSelectedKnownEffectId);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(mSelectedKnownEffectId);
mAddEffectDialog.newEffect(effect);
mAddEffectDialog.setSkill(mSelectSkillDialog->getSkillId());
@ -628,7 +625,7 @@ namespace MWGui
mSelectedKnownEffectId = mButtonMapping[buttonId];
const ESM::MagicEffect* effect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(mSelectedKnownEffectId);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(mSelectedKnownEffectId);
bool allowSelf = (effect->mData.mFlags & ESM::MagicEffect::CastSelf) != 0;
bool allowTouch = (effect->mData.mFlags & ESM::MagicEffect::CastTouch) && !mConstantEffect;
@ -761,7 +758,7 @@ namespace MWGui
{
if (it->mRange != ESM::RT_Self)
{
auto& store = MWBase::Environment::get().getWorld()->getStore();
auto& store = *MWBase::Environment::get().getESMStore();
auto magicEffect = store.get<ESM::MagicEffect>().find(it->mEffectID);
if ((magicEffect->mData.mFlags & ESM::MagicEffect::CastSelf) == 0)
{

@ -52,7 +52,7 @@ namespace MWGui
for (const auto& [effectId, effectInfos] : effects)
{
const ESM::MagicEffect* effect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectId);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effectId);
float remainingDuration = 0;
float totalDuration = 0;
@ -60,9 +60,8 @@ namespace MWGui
std::string sourcesDescription;
static const float fadeTime = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fMagicStartIconBlink")
->mValue.getFloat();

@ -45,7 +45,7 @@ namespace MWGui
bool SpellModel::matchingEffectExists(std::string filter, const ESM::EffectList& effects)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
for (const auto& effect : effects.mList)
{
@ -75,7 +75,7 @@ namespace MWGui
MWMechanics::CreatureStats& stats = mActor.getClass().getCreatureStats(mActor);
const MWMechanics::Spells& spells = stats.getSpells();
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
std::string filter = Utf8Stream::lowerCaseUtf8(mFilter);

@ -139,18 +139,17 @@ namespace MWGui
void SpellWindow::askDeleteSpell(const ESM::RefId& spellId)
{
// delete spell, if allowed
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(spellId);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(spellId);
MWWorld::Ptr player = MWMechanics::getPlayer();
const ESM::RefId& raceId = player.get<ESM::NPC>()->mBase->mRace;
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(raceId);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(raceId);
// can't delete racial spells, birthsign spells or powers
bool isInherent = race->mPowers.exists(spell->mId) || spell->mData.mType == ESM::Spell::ST_Power;
const ESM::RefId& signId = MWBase::Environment::get().getWorld()->getPlayer().getBirthSign();
if (!isInherent && !signId.empty())
{
const ESM::BirthSign* sign
= MWBase::Environment::get().getWorld()->getStore().get<ESM::BirthSign>().find(signId);
const ESM::BirthSign* sign = MWBase::Environment::get().getESMStore()->get<ESM::BirthSign>().find(signId);
isInherent = sign->mPowers.exists(spell->mId);
}

@ -67,9 +67,8 @@ namespace MWGui
if (timeToDrown != mWatchedTimeToStartDrowning)
{
static const float fHoldBreathTime = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fHoldBreathTime")
->mValue.getFloat();
@ -114,7 +113,7 @@ namespace MWGui
{
mWatchedRace = watchedRecord->mRace;
const ESM::Race* race
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(watchedRecord->mRace);
= MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(watchedRecord->mRace);
setValue("race", race->mName);
}
@ -122,7 +121,7 @@ namespace MWGui
{
mWatchedClass = watchedRecord->mClass;
const ESM::Class* cls
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Class>().find(watchedRecord->mClass);
= MWBase::Environment::get().getESMStore()->get<ESM::Class>().find(watchedRecord->mClass);
setValue("class", cls->mName);
MWBase::WindowManager::SkillList majorSkills(5);

@ -57,7 +57,7 @@ namespace MWGui
{ "Attrib6", "sAttributeEndurance" }, { "Attrib7", "sAttributePersonality" },
{ "Attrib8", "sAttributeLuck" }, { 0, 0 } };
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
for (int i = 0; names[i][0]; ++i)
{
setText(names[i][0], store.get<ESM::GameSetting>().find(names[i][1])->mValue.getString());
@ -240,7 +240,7 @@ namespace MWGui
void setSkillProgress(MyGUI::Widget* w, float progress, int skillId)
{
MWWorld::Ptr player = MWMechanics::getPlayer();
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
float progressRequirement = player.getClass().getNpcStats(player).getSkillProgressRequirement(
skillId, *esmStore.get<ESM::Class>().find(player.get<ESM::NPC>()->mBase->mClass));
@ -358,9 +358,8 @@ namespace MWGui
for (int i = 0; i < 2; ++i)
{
int max = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("iLevelUpTotal")
->mValue.getInteger();
getWidget(levelWidget, i == 0 ? "Level_str" : "LevelText");
@ -510,7 +509,7 @@ namespace MWGui
continue;
const std::string& skillNameId = ESM::Skill::sSkillNameIds[skillId];
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
const ESM::Skill* skill = esmStore.get<ESM::Skill>().find(skillId);

@ -226,7 +226,7 @@ namespace MWGui
{
ToolTipInfo info;
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(
ESM::RefId::deserialize(focus->getUserString("Spell")));
info.caption = spell->mName;
Widgets::SpellEffectList effects;
@ -420,7 +420,7 @@ namespace MWGui
text.erase(0, 1);
const ESM::Enchantment* enchant = nullptr;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
if (!info.enchant.empty())
{
enchant = store.get<ESM::Enchantment>().search(info.enchant);
@ -681,7 +681,7 @@ namespace MWGui
const ESM::RefId& soul = cellref.getSoul();
if (soul.empty())
return {};
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Creature* creature = store.get<ESM::Creature>().search(soul);
if (!creature)
return {};
@ -697,7 +697,7 @@ namespace MWGui
const ESM::RefId& factionId = cellref.getFaction();
if (!factionId.empty())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Faction* fact = store.get<ESM::Faction>().search(factionId);
if (fact != nullptr)
{
@ -809,7 +809,7 @@ namespace MWGui
if (skillId == -1)
return;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const std::string& skillNameId = ESM::Skill::sSkillNameIds[skillId];
const ESM::Skill* skill = store.get<ESM::Skill>().find(skillId);
@ -848,7 +848,7 @@ namespace MWGui
widget->setUserString("Caption_Caption", name);
std::string specText;
// get all skills of this specialisation
const MWWorld::Store<ESM::Skill>& skills = MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>();
const MWWorld::Store<ESM::Skill>& skills = MWBase::Environment::get().getESMStore()->get<ESM::Skill>();
bool isFirst = true;
for (auto& skillPair : skills)
@ -870,7 +870,7 @@ namespace MWGui
void ToolTips::createBirthsignToolTip(MyGUI::Widget* widget, const ESM::RefId& birthsignId)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::BirthSign* sign = store.get<ESM::BirthSign>().find(birthsignId);
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
@ -953,8 +953,7 @@ namespace MWGui
void ToolTips::createMagicEffectToolTip(MyGUI::Widget* widget, short id)
{
const ESM::MagicEffect* effect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(id);
const ESM::MagicEffect* effect = MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(id);
const std::string& name = ESM::MagicEffect::effectIdToString(id);
std::string icon = effect->mIcon;

@ -273,7 +273,7 @@ namespace MWGui
= MWBase::Environment::get().getWindowManager()->getInventoryWindow()->getTradeModel();
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
if (mTotalBalance->getValue() == 0)
mCurrentBalance = 0;

@ -98,7 +98,7 @@ namespace MWGui
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats(player);
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
const int lineHeight = MWBase::Environment::get().getWindowManager()->getFontHeight() + 2;
@ -146,7 +146,7 @@ namespace MWGui
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
MWMechanics::NpcStats& pcStats = player.getClass().getNpcStats(player);
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
int price = pcStats.getSkill(skillId).getBase()
* store.get<ESM::GameSetting>().find("iTrainingMod")->mValue.getInteger();
@ -162,7 +162,7 @@ namespace MWGui
}
// You can not train a skill above its governing attribute
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>().find(skillId);
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().find(skillId);
if (pcStats.getSkill(skillId).getBase() >= pcStats.getAttribute(skill->mData.mAttribute).getBase())
{
MWBase::Environment::get().getWindowManager()->messageBox("#{sNotifyMessage17}");

@ -49,7 +49,7 @@ namespace MWGui
int price;
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
MWWorld::Ptr player = MWBase::Environment::get().getWorld()->getPlayerPtr();
int playerGold = player.getClass().getContainerStore(player).count(MWWorld::ContainerStore::sGoldId);
@ -182,9 +182,8 @@ namespace MWGui
= (osg::Vec3f(pos.pos[0], pos.pos[1], 0) - osg::Vec3f(playerPos.pos[0], playerPos.pos[1], 0)).length();
int hours = static_cast<int>(d
/ MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fTravelTimeMult")
->mValue.getFloat());
MWBase::Environment::get().getMechanicsManager()->rest(hours, true);

@ -279,7 +279,7 @@ namespace MWGui
// trigger levelup if possible
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
if (mSleeping && pcstats.getLevelProgress() >= gmst.find("iLevelUpTotal")->mValue.getInteger())
{
MWBase::Environment::get().getWindowManager()->pushGuiMode(GM_Levelup);

@ -214,7 +214,7 @@ namespace MWGui::Widgets
void MWSpell::createEffectWidgets(
std::vector<MyGUI::Widget*>& effects, MyGUI::Widget* creator, MyGUI::IntCoord& coord, int flags)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Spell* spell = store.get<ESM::Spell>().search(mId);
MYGUI_ASSERT(spell, "spell with id '" << mId << "' not found");
@ -245,7 +245,7 @@ namespace MWGui::Widgets
{
if (mSpellNameWidget && MWBase::Environment::get().getWindowManager())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Spell* spell = store.get<ESM::Spell>().search(mId);
if (spell)
@ -375,7 +375,7 @@ namespace MWGui::Widgets
return;
}
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::MagicEffect* magicEffect = store.get<ESM::MagicEffect>().search(mEffectParams.mEffectID);

@ -71,7 +71,7 @@ namespace MWLua
api["magic"] = initCoreMagicBindings(context);
api["l10n"] = LuaUtil::initL10nLoader(lua->sol(), MWBase::Environment::get().getL10nManager());
const MWWorld::Store<ESM::GameSetting>* gmst
= &MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= &MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
api["getGMST"] = [lua = context.mLua, gmst](const std::string& setting) -> sol::object {
const ESM::Variant& value = gmst->find(setting)->mValue;
if (value.getType() == ESM::VT_String)
@ -110,8 +110,7 @@ namespace MWLua
// Doesn't matter which cell to use because the new object will be in disabled state.
MWWorld::CellStore* cell = MWBase::Environment::get().getWorldScene()->getCurrentCell();
MWWorld::ManualRef mref(
MWBase::Environment::get().getWorld()->getStore(), ESM::RefId::deserializeText(recordId));
MWWorld::ManualRef mref(*MWBase::Environment::get().getESMStore(), ESM::RefId::deserializeText(recordId));
const MWWorld::Ptr& ptr = mref.getPtr();
ptr.getRefData().disable();
MWWorld::Ptr newPtr = ptr.getClass().copyToCell(ptr, *cell, count.value_or(1));
@ -120,7 +119,7 @@ namespace MWLua
// Creates a new record in the world database.
api["createRecord"] = sol::overload([](const ESM::Potion& potion) -> const ESM::Potion* {
return MWBase::Environment::get().getWorld()->createRecord(potion);
return MWBase::Environment::get().getESMStore()->insert(potion);
}
// TODO: add here overloads for other records
);

@ -67,7 +67,7 @@ namespace MWLua
void LuaManager::initConfiguration()
{
mConfiguration.init(MWBase::Environment::get().getWorld()->getStore().getLuaScriptsCfg());
mConfiguration.init(MWBase::Environment::get().getESMStore()->getLuaScriptsCfg());
Log(Debug::Verbose) << "Lua scripts configuration (" << mConfiguration.size() << " scripts):";
for (size_t i = 0; i < mConfiguration.size(); ++i)
Log(Debug::Verbose) << "#" << i << " " << LuaUtil::scriptCfgToString(mConfiguration[i]);

@ -261,7 +261,7 @@ namespace MWLua
static float getMaxProgress(const MWWorld::Ptr& ptr, int index, const MWMechanics::SkillValue& stat)
{
const auto& store = MWBase::Environment::get().getWorld()->getStore();
const auto& store = *MWBase::Environment::get().getESMStore();
const auto cl = store.get<ESM::Class>().find(ptr.get<ESM::NPC>()->mBase->mClass);
return ptr.getClass().getNpcStats(ptr).getSkillProgressRequirement(index, *cl);
}

@ -28,7 +28,7 @@ namespace MWLua
miscellaneous["setSoul"] = [](const GObject& object, std::string_view soulId) {
ESM::RefId creature = ESM::RefId::deserializeText(soulId);
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
if (!store.get<ESM::Creature>().search(creature))
{

@ -69,7 +69,7 @@ namespace MWLua
void addRecordFunctionBinding(
sol::table table, const Context& context, const std::string& recordName = std::string(T::getRecordType()))
{
const MWWorld::Store<T>& store = MWBase::Environment::get().getWorld()->getStore().get<T>();
const MWWorld::Store<T>& store = MWBase::Environment::get().getESMStore()->get<T>();
table["record"] = sol::overload([](const Object& obj) -> const T* { return obj.ptr().get<T>()->mBase; },
[&store](std::string_view id) -> const T* { return store.find(ESM::RefId::deserializeText(id)); });

@ -323,8 +323,7 @@ namespace MWMechanics
}
if (reflected)
{
const ESM::Static* reflectStatic
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find(
const ESM::Static* reflectStatic = MWBase::Environment::get().getESMStore()->get<ESM::Static>().find(
ESM::RefId::stringRefId("VFX_Reflect"));
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(ptr);
if (animation && !reflectStatic->mModel.empty())

@ -102,7 +102,7 @@ namespace
{
const MWMechanics::CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
const MWWorld::Store<ESM::GameSetting>& settings
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
const float endurance = stats.getAttribute(ESM::Attribute::Endurance).getModified();
const float health = 0.1f * endurance;
@ -262,15 +262,13 @@ namespace MWMechanics
return;
static const float fMaxHeadTrackDistance = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fMaxHeadTrackDistance")
->mValue.getFloat();
static const float fInteriorHeadTrackMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fInteriorHeadTrackMult")
->mValue.getFloat();
float maxDistance = fMaxHeadTrackDistance;
@ -493,9 +491,8 @@ namespace MWMechanics
// Play a random voice greeting if the player gets too close
static const int iGreetDistanceMultiplier = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("iGreetDistanceMultiplier")
->mValue.getInteger();
@ -820,7 +817,7 @@ namespace MWMechanics
return;
const MWWorld::Store<ESM::GameSetting>& settings
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
if (sleep)
{
@ -898,7 +895,7 @@ namespace MWMechanics
// Restore fatigue
const float endurance = stats.getAttribute(ESM::Attribute::Endurance).getModified();
const MWWorld::Store<ESM::GameSetting>& settings
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fFatigueReturnBase = settings.find("fFatigueReturnBase")->mValue.getFloat();
static const float fFatigueReturnMult = settings.find("fFatigueReturnMult")->mValue.getFloat();
@ -939,9 +936,8 @@ namespace MWMechanics
// When npc stats are just initialized, mTimeToStartDrowning == -1 and we should get value from GMST
static const float fHoldBreathTime = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fHoldBreathTime")
->mValue.getFloat();
if (stats.getTimeToStartDrowning() == -1.f)
@ -1848,7 +1844,7 @@ namespace MWMechanics
{
MWBase::Environment::get().getWorld()->deleteObject(ptr);
const ESM::Static* fx = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().search(
const ESM::Static* fx = MWBase::Environment::get().getESMStore()->get<ESM::Static>().search(
ESM::RefId::stringRefId("VFX_Summon_End"));
if (fx)
{
@ -2301,7 +2297,7 @@ namespace MWMechanics
ESM::RefId id = reader.getRefId();
int count;
reader.getHNT(count, "COUN");
if (MWBase::Environment::get().getWorld()->getStore().find(id))
if (MWBase::Environment::get().getESMStore()->find(id))
mDeathCount[id] = count;
}
}

@ -14,12 +14,8 @@
bool MWMechanics::AiBreathe::execute(
const MWWorld::Ptr& actor, CharacterController& characterController, AiState& state, float duration)
{
static const float fHoldBreathTime = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.find("fHoldBreathTime")
->mValue.getFloat();
static const float fHoldBreathTime
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>().find("fHoldBreathTime")->mValue.getFloat();
const MWWorld::Class& actorClass = actor.getClass();
if (actorClass.isNpc())

@ -362,7 +362,7 @@ namespace MWMechanics
if (storage.mLOS && (triggerDist >= 1000 || getDistanceMinusHalfExtents(actor, target) <= triggerDist))
{
const ESM::Pathgrid* pathgrid
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*cellVariant);
= MWBase::Environment::get().getESMStore()->get<ESM::Pathgrid>().search(*cellVariant);
bool runFallback = true;
@ -429,9 +429,8 @@ namespace MWMechanics
case AiCombatStorage::FleeState_RunToDestination:
{
static const float fFleeDistance = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fFleeDistance")
->mValue.getFloat();
@ -649,7 +648,7 @@ namespace MWMechanics
auto& prng = MWBase::Environment::get().getWorld()->getPrng();
mStrength = Misc::Rng::rollClosedProbability(prng);
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
float baseDelay = store.get<ESM::GameSetting>().find("fCombatDelayCreature")->mValue.getFloat();
if (actor.getClass().isNpc())
@ -741,7 +740,7 @@ namespace
{
float projSpeed;
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
// get projectile speed (depending on weapon type)
if (MWMechanics::getWeaponType(weapType)->mWeaponClass == ESM::WeaponType::Thrown)

@ -25,15 +25,13 @@ namespace MWMechanics
float suggestCombatRange(int rangeTypes)
{
static const float fCombatDistance = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fCombatDistance")
->mValue.getFloat();
static float fHandToHandReach = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fHandToHandReach")
->mValue.getFloat();
@ -58,13 +56,13 @@ namespace MWMechanics
inv.setSelectedEnchantItem(inv.end());
}
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(mSpellId);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(mSpellId);
MWBase::Environment::get().getWorld()->preloadEffects(&spell->mEffects);
}
float ActionSpell::getCombatRange(bool& isRanged) const
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(mSpellId);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(mSpellId);
int types = getRangeTypes(spell->mEffects);
isRanged = (types & RangeTypes::Target) | (types & RangeTypes::Self);
@ -80,8 +78,7 @@ namespace MWMechanics
float ActionEnchantedItem::getCombatRange(bool& isRanged) const
{
const ESM::Enchantment* enchantment
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(
const ESM::Enchantment* enchantment = MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>().find(
mItem->getClass().getEnchantment(*mItem));
int types = getRangeTypes(enchantment->mEffects);
@ -127,24 +124,21 @@ namespace MWMechanics
isRanged = false;
static const float fCombatDistance = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fCombatDistance")
->mValue.getFloat();
static const float fProjectileMaxSpeed = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fProjectileMaxSpeed")
->mValue.getFloat();
if (mWeapon.isEmpty())
{
static float fHandToHandReach = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fHandToHandReach")
->mValue.getFloat();
return fHandToHandReach * fCombatDistance;
@ -322,7 +316,7 @@ namespace MWMechanics
{
const CreatureStats& stats = actor.getClass().getCreatureStats(actor);
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
const ESM::RefId& selectedSpellId = stats.getSpells().getSelectedSpell();
MWWorld::Ptr selectedEnchItem;
@ -356,14 +350,14 @@ namespace MWMechanics
if (!selectedSpellId.empty())
{
const ESM::Spell* spell
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(selectedSpellId);
= MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(selectedSpellId);
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt = spell->mEffects.mList.begin();
effectIt != spell->mEffects.mList.end(); ++effectIt)
{
if (effectIt->mRange == ESM::RT_Target)
{
const ESM::MagicEffect* effect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(
effectIt->mEffectID);
dist = effect->mData.mSpeed;
break;
@ -376,14 +370,14 @@ namespace MWMechanics
if (!enchId.empty())
{
const ESM::Enchantment* ench
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(enchId);
= MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>().find(enchId);
for (std::vector<ESM::ENAMstruct>::const_iterator effectIt = ench->mEffects.mList.begin();
effectIt != ench->mEffects.mList.end(); ++effectIt)
{
if (effectIt->mRange == ESM::RT_Target)
{
const ESM::MagicEffect* effect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(
effectIt->mEffectID);
dist = effect->mData.mSpeed;
break;
@ -507,7 +501,7 @@ namespace MWMechanics
{
const CreatureStats& stats = actor.getClass().getCreatureStats(actor);
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
const int flee = stats.getAiSetting(AiSetting::Flee).getModified();
if (flee >= 100)

@ -211,8 +211,7 @@ namespace MWMechanics
if (!mPathFinder.isPathConstructed() && mHasDestination)
{
const ESM::Pathgrid* pathgrid
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(
*actor.getCell()->getCell());
= MWBase::Environment::get().getESMStore()->get<ESM::Pathgrid>().search(*actor.getCell()->getCell());
if (mUsePathgrid)
{
mPathFinder.buildPathByPathgrid(
@ -805,7 +804,7 @@ namespace MWMechanics
ESM::Pathgrid::Point dest, const MWWorld::CellStore* currentCell, ESM::Pathgrid::PointList& points)
{
const ESM::Pathgrid* pathgrid
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*currentCell->getCell());
= MWBase::Environment::get().getESMStore()->get<ESM::Pathgrid>().search(*currentCell->getCell());
if (pathgrid == nullptr || pathgrid->mPoints.empty())
return;
@ -820,7 +819,7 @@ namespace MWMechanics
// infrequently used, therefore no benefit in caching it as a member
const MWWorld::CellStore* cellStore = actor.getCell();
const ESM::Pathgrid* pathgrid
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Pathgrid>().search(*cellStore->getCell());
= MWBase::Environment::get().getESMStore()->get<ESM::Pathgrid>().search(*cellStore->getCell());
storage.mAllowedNodes.clear();

@ -139,26 +139,20 @@ void MWMechanics::Alchemy::updateEffects()
x *= mTools[ESM::Apparatus::MortarPestle].get<ESM::Apparatus>()->mBase->mData.mQuality;
x *= MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fPotionStrengthMult")
->mValue.getFloat();
// value
mValue = static_cast<int>(x
* MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.find("iAlchemyMod")
->mValue.getFloat());
mValue = static_cast<int>(
x * MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>().find("iAlchemyMod")->mValue.getFloat());
// build quantified effect list
for (std::set<EffectKey>::const_iterator iter(effects.begin()); iter != effects.end(); ++iter)
{
const ESM::MagicEffect* magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(iter->mId);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(iter->mId);
if (magicEffect->mData.mBaseCost <= 0)
{
@ -167,9 +161,8 @@ void MWMechanics::Alchemy::updateEffects()
}
float fPotionT1MagMul = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fPotionT1MagMult")
->mValue.getFloat();
@ -177,9 +170,8 @@ void MWMechanics::Alchemy::updateEffects()
throw std::runtime_error("invalid gmst: fPotionT1MagMul");
float fPotionT1DurMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fPotionT1DurMult")
->mValue.getFloat();
@ -228,7 +220,7 @@ void MWMechanics::Alchemy::updateEffects()
const ESM::Potion* MWMechanics::Alchemy::getRecord(const ESM::Potion& toFind) const
{
const MWWorld::Store<ESM::Potion>& potions = MWBase::Environment::get().getWorld()->getStore().get<ESM::Potion>();
const MWWorld::Store<ESM::Potion>& potions = MWBase::Environment::get().getESMStore()->get<ESM::Potion>();
MWWorld::Store<ESM::Potion>::iterator iter = potions.begin();
for (; iter != potions.end(); ++iter)
@ -315,7 +307,7 @@ void MWMechanics::Alchemy::addPotion(const std::string& name)
const ESM::Potion* record = getRecord(newRecord);
if (!record)
record = MWBase::Environment::get().getWorld()->createRecord(newRecord);
record = MWBase::Environment::get().getESMStore()->insert(newRecord);
mAlchemist.getClass().getContainerStore(mAlchemist).add(record->mId, 1);
}
@ -480,12 +472,8 @@ MWMechanics::Alchemy::TEffectsIterator MWMechanics::Alchemy::endEffects() const
bool MWMechanics::Alchemy::knownEffect(unsigned int potionEffectIndex, const MWWorld::Ptr& npc)
{
float alchemySkill = npc.getClass().getSkill(npc, ESM::Skill::Alchemy);
static const float fWortChanceValue = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.find("fWortChanceValue")
->mValue.getFloat();
static const float fWortChanceValue
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>().find("fWortChanceValue")->mValue.getFloat();
return (potionEffectIndex <= 1 && alchemySkill >= fWortChanceValue)
|| (potionEffectIndex <= 3 && alchemySkill >= fWortChanceValue * 2)
|| (potionEffectIndex <= 5 && alchemySkill >= fWortChanceValue * 3)
@ -573,8 +561,8 @@ std::vector<std::string> MWMechanics::Alchemy::effectsDescription(const MWWorld:
std::vector<std::string> effects;
const auto& item = ptr.get<ESM::Ingredient>()->mBase;
const auto& gmst = MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
const auto& mgef = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>();
const auto& gmst = MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
const auto& mgef = MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>();
const static auto fWortChanceValue = gmst.find("fWortChanceValue")->mValue.getFloat();
const auto& data = item->mData;

@ -30,7 +30,7 @@ namespace MWMechanics
std::vector<ESM::RefId> autoCalcNpcSpells(const int* actorSkills, const int* actorAttributes, const ESM::Race* race)
{
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fNPCbaseMagickaMult = gmst.find("fNPCbaseMagickaMult")->mValue.getFloat();
float baseMagicka = fNPCbaseMagickaMult * actorAttributes[ESM::Attribute::Intelligence];
@ -62,7 +62,7 @@ namespace MWMechanics
std::vector<ESM::RefId> selectedSpells;
const MWWorld::Store<ESM::Spell>& spells = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>();
const MWWorld::Store<ESM::Spell>& spells = MWBase::Environment::get().getESMStore()->get<ESM::Spell>();
// Note: the algorithm heavily depends on the traversal order of the spells. For vanilla-compatible results the
// Store must preserve the record ordering as it was in the content files.
@ -150,7 +150,7 @@ namespace MWMechanics
std::vector<ESM::RefId> autoCalcPlayerSpells(
const int* actorSkills, const int* actorAttributes, const ESM::Race* race)
{
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
static const float fPCbaseMagickaMult
= esmStore.get<ESM::GameSetting>().find("fPCbaseMagickaMult")->mValue.getFloat();
@ -231,11 +231,10 @@ namespace MWMechanics
for (const auto& spellEffect : spell->mEffects.mList)
{
const ESM::MagicEffect* magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(spellEffect.mEffectID);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(spellEffect.mEffectID);
static const int iAutoSpellAttSkillMin = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("iAutoSpellAttSkillMin")
->mValue.getInteger();
@ -264,7 +263,7 @@ namespace MWMechanics
for (const ESM::ENAMstruct& effect : spell->mEffects.mList)
{
const ESM::MagicEffect* magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effect.mEffectID);
int minMagn = 1;
int maxMagn = 1;
@ -281,9 +280,8 @@ namespace MWMechanics
duration = std::max(1, duration);
static const float fEffectCostMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fEffectCostMult")
->mValue.getFloat();

@ -50,7 +50,7 @@ namespace MWMechanics
if (!enchantmentName.empty())
{
const ESM::Enchantment* enchantment
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(enchantmentName);
= MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>().find(enchantmentName);
if (enchantment->mData.mType == ESM::Enchantment::WhenStrikes)
{
MWMechanics::CastSpell cast(attacker, victim, fromProjectile);
@ -93,7 +93,7 @@ namespace MWMechanics
blocker.getRefData().getBaseNode()->getAttitude() * osg::Vec3f(0, 1, 0), osg::Vec3f(0, 0, 1)));
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fCombatBlockLeftAngle = gmst.find("fCombatBlockLeftAngle")->mValue.getFloat();
if (angleDegrees < fCombatBlockLeftAngle)
return false;
@ -205,7 +205,7 @@ namespace MWMechanics
if (isSilver && actor.getClass().getNpcStats(actor).isWerewolf())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
damage *= store.get<ESM::GameSetting>().find("fWereWolfSilverWeaponDamageMult")->mValue.getFloat();
}
}
@ -371,9 +371,8 @@ namespace MWMechanics
x = std::min(100.f, x + elementResistance);
static const float fElementalShieldMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fElementalShieldMult")
->mValue.getFloat();
x = fElementalShieldMult * magnitude * (1.f - 0.01f * x);
@ -410,9 +409,8 @@ namespace MWMechanics
if (!godmode)
{
const float fWeaponDamageMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fWeaponDamageMult")
->mValue.getFloat();
float x = std::max(1.f, fWeaponDamageMult * damage);
@ -439,15 +437,13 @@ namespace MWMechanics
}
static const float fDamageStrengthBase = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fDamageStrengthBase")
->mValue.getFloat();
static const float fDamageStrengthMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fDamageStrengthMult")
->mValue.getFloat();
damage *= fDamageStrengthBase
@ -458,7 +454,7 @@ namespace MWMechanics
void getHandToHandDamage(
const MWWorld::Ptr& attacker, const MWWorld::Ptr& victim, float& damage, bool& healthdmg, float attackStrength)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
static const float minstrike = store.get<ESM::GameSetting>().find("fMinHandToHandMult")->mValue.getFloat();
static const float maxstrike = store.get<ESM::GameSetting>().find("fMaxHandToHandMult")->mValue.getFloat();
damage = static_cast<float>(attacker.getClass().getSkill(attacker, ESM::Skill::HandToHand));
@ -509,7 +505,7 @@ namespace MWMechanics
{
// somewhat of a guess, but using the weapon weight makes sense
const MWWorld::Store<ESM::GameSetting>& store
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fFatigueAttackBase = store.find("fFatigueAttackBase")->mValue.getFloat();
static const float fFatigueAttackMult = store.find("fFatigueAttackMult")->mValue.getFloat();
static const float fWeaponFatigueMult = store.find("fWeaponFatigueMult")->mValue.getFloat();
@ -537,15 +533,13 @@ namespace MWMechanics
float d = getAggroDistance(actor1, pos1, pos2);
static const int iFightDistanceBase = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("iFightDistanceBase")
->mValue.getInteger();
static const float fFightDistanceMultiplier = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fFightDistanceMultiplier")
->mValue.getFloat();

@ -66,7 +66,7 @@ namespace MWMechanics
float normalised = std::floor(max) == 0 ? 1 : std::max(0.0f, current / max);
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fFatigueBase = gmst.find("fFatigueBase")->mValue.getFloat();
static const float fFatigueMult = gmst.find("fFatigueMult")->mValue.getFloat();

@ -15,12 +15,8 @@ float scaleDamage(float damage, const MWWorld::Ptr& attacker, const MWWorld::Ptr
// [-500, 500]
const int difficultySetting = std::clamp(Settings::Manager::getInt("difficulty", "Game"), -500, 500);
static const float fDifficultyMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.find("fDifficultyMult")
->mValue.getFloat();
static const float fDifficultyMult
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>().find("fDifficultyMult")->mValue.getFloat();
float difficultyTerm = 0.01f * difficultySetting;

@ -29,9 +29,8 @@ namespace MWMechanics
return;
float fDiseaseXferChance = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fDiseaseXferChance")
->mValue.getFloat();
@ -71,9 +70,8 @@ namespace MWMechanics
MWBase::Environment::get().getWorld()->applyLoopingParticles(actor);
std::string msg = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("sMagicContractDisease")
->mValue.getString();
msg = Misc::StringUtils::format(msg, spell->mName);

@ -98,7 +98,7 @@ namespace MWMechanics
// Try to find a dynamic enchantment with the same stats, create a new one if not found.
const ESM::Enchantment* enchantmentPtr = getRecord(enchantment);
if (enchantmentPtr == nullptr)
enchantmentPtr = MWBase::Environment::get().getWorld()->createRecord(enchantment);
enchantmentPtr = MWBase::Environment::get().getESMStore()->insert(enchantment);
// Apply the enchantment
const ESM::RefId& newItemId
@ -120,9 +120,8 @@ namespace MWMechanics
return;
const bool powerfulSoul = getGemCharge() >= MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("iSoulAmountForConstantEffect")
->mValue.getInteger();
if ((mObjectType == ESM::Armor::sRecordId) || (mObjectType == ESM::Clothing::sRecordId))
@ -190,7 +189,7 @@ namespace MWMechanics
// No effects added, cost = 0
return 0;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const float fEffectCostMult = store.get<ESM::GameSetting>().find("fEffectCostMult")->mValue.getFloat();
const float fEnchantmentConstantDurationMult
= store.get<ESM::GameSetting>().find("fEnchantmentConstantDurationMult")->mValue.getFloat();
@ -223,7 +222,7 @@ namespace MWMechanics
const ESM::Enchantment* Enchanting::getRecord(const ESM::Enchantment& toFind) const
{
const MWWorld::Store<ESM::Enchantment>& enchantments
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>();
= MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>();
MWWorld::Store<ESM::Enchantment>::iterator iter(enchantments.begin());
iter += (enchantments.getSize() - enchantments.getDynamicSize());
for (; iter != enchantments.end(); ++iter)
@ -284,9 +283,8 @@ namespace MWMechanics
return 0;
float priceMultipler = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fEnchantmentValueMult")
->mValue.getFloat();
int price = MWBase::Environment::get().getMechanicsManager()->getBarterOffer(
@ -297,7 +295,7 @@ namespace MWMechanics
int Enchanting::getGemCharge() const
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
if (soulEmpty())
return 0;
if (mSoulGemPtr.getCellRef().getSoul().empty())
@ -314,7 +312,7 @@ namespace MWMechanics
if (itemEmpty())
return 0;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
return static_cast<int>(mOldItemPtr.getClass().getEnchantmentPoints(mOldItemPtr)
* store.get<ESM::GameSetting>().find("fEnchantmentMult")->mValue.getFloat());
@ -345,7 +343,7 @@ namespace MWMechanics
{
const CreatureStats& stats = mEnchanter.getClass().getCreatureStats(mEnchanter);
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
const float a = static_cast<float>(mEnchanter.getClass().getSkill(mEnchanter, ESM::Skill::Enchant));
const float b = static_cast<float>(stats.getAttribute(ESM::Attribute::Intelligence).getModified());
const float c = static_cast<float>(stats.getAttribute(ESM::Attribute::Luck).getModified());

@ -17,14 +17,14 @@ namespace MWMechanics
template <class T>
void modifyBaseInventory(const ESM::RefId& actorId, const ESM::RefId& itemId, int amount)
{
T copy = *MWBase::Environment::get().getWorld()->getStore().get<T>().find(actorId);
T copy = *MWBase::Environment::get().getESMStore()->get<T>().find(actorId);
for (auto& it : copy.mInventory.mList)
{
if (it.mItem == itemId)
{
const int sign = it.mCount < 1 ? -1 : 1;
it.mCount = sign * std::max(it.mCount * sign + amount, 0);
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
MWBase::Environment::get().getESMStore()->overrideRecord(copy);
return;
}
}
@ -34,7 +34,7 @@ namespace MWMechanics
cont.mItem = itemId;
cont.mCount = amount;
copy.mInventory.mList.push_back(cont);
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
MWBase::Environment::get().getESMStore()->overrideRecord(copy);
}
}
}

@ -49,7 +49,7 @@ namespace MWMechanics
const ESM::RefId& item = *candidates[Misc::Rng::rollDice(candidates.size(), prng)];
// Vanilla doesn't fail on nonexistent items in levelled lists
if (!MWBase::Environment::get().getWorld()->getStore().find(item))
if (!MWBase::Environment::get().getESMStore()->find(item))
{
Log(Debug::Warning) << "Warning: ignoring nonexistent item " << item << " in levelled list "
<< levItem->mId;
@ -57,7 +57,7 @@ namespace MWMechanics
}
// Is this another levelled item or a real item?
MWWorld::ManualRef ref(MWBase::Environment::get().getWorld()->getStore(), item, 1);
MWWorld::ManualRef ref(*MWBase::Environment::get().getESMStore(), item, 1);
if (ref.getPtr().getType() != ESM::ItemLevList::sRecordId
&& ref.getPtr().getType() != ESM::CreatureLevList::sRecordId)
{

@ -52,7 +52,7 @@ namespace MWMechanics
std::string EffectKey::toString() const
{
const ESM::MagicEffect* magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().search(mId);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().search(mId);
return getMagicEffectString(*magicEffect, mArg, mArg);
}

@ -41,9 +41,8 @@ namespace
float getFightDispositionBias(float disposition)
{
static const float fFightDispMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fFightDispMult")
->mValue.getFloat();
return ((50.f - disposition) * fFightDispMult);
@ -53,7 +52,7 @@ namespace
const MWMechanics::NpcStats& stats, float& rating1, float& rating2, float& rating3, bool player)
{
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
float persTerm = stats.getAttribute(ESM::Attribute::Personality).getModified()
/ gmst.find("fPersonalityMod")->mValue.getFloat();
@ -140,7 +139,7 @@ namespace MWMechanics
creatureStats.setAttribute(ESM::Attribute::Endurance, player->mNpdt.mEndurance);
creatureStats.setAttribute(ESM::Attribute::Personality, player->mNpdt.mPersonality);
creatureStats.setAttribute(ESM::Attribute::Luck, player->mNpdt.mLuck);
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
// race
if (mRaceSelected)
@ -440,7 +439,7 @@ namespace MWMechanics
ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
player.mName = name;
world->createRecord(player);
world->getStore().insert(player);
mUpdatePlayer = true;
}
@ -457,7 +456,7 @@ namespace MWMechanics
player.mHair = hair;
player.setIsMale(male);
world->createRecord(player);
world->getStore().insert(player);
mRaceSelected = true;
buildPlayer();
@ -478,7 +477,7 @@ namespace MWMechanics
ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
player.mClass = id;
world->createRecord(player);
world->getStore().insert(player);
mClassSelected = true;
buildPlayer();
@ -489,12 +488,12 @@ namespace MWMechanics
{
MWBase::World* world = MWBase::Environment::get().getWorld();
const ESM::Class* ptr = world->createRecord(cls);
const ESM::Class* ptr = world->getStore().insert(cls);
ESM::NPC player = *world->getPlayerPtr().get<ESM::NPC>()->mBase;
player.mClass = ptr->mId;
world->createRecord(player);
world->getStore().insert(player);
mClassSelected = true;
buildPlayer();
@ -512,7 +511,7 @@ namespace MWMechanics
const MWMechanics::NpcStats& playerStats = playerPtr.getClass().getNpcStats(playerPtr);
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fDispRaceMod = gmst.find("fDispRaceMod")->mValue.getFloat();
if (npc->mBase->mRace == player->mBase->mRace)
x += fDispRaceMod;
@ -623,7 +622,7 @@ namespace MWMechanics
const MWWorld::Ptr& npc, PersuasionType type, bool& success, int& tempChange, int& permChange)
{
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
MWMechanics::NpcStats& npcStats = npc.getClass().getNpcStats(npc);
@ -851,7 +850,7 @@ namespace MWMechanics
{
// Build a list of known bound item ID's
const MWWorld::Store<ESM::GameSetting>& gameSettings
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
for (const ESM::GameSetting& currentSetting : gameSettings)
{
@ -1145,7 +1144,7 @@ namespace MWMechanics
std::vector<MWWorld::Ptr> neighbors;
osg::Vec3f from(player.getRefData().getPosition().asVec3());
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
float radius = esmStore.get<ESM::GameSetting>().find("fAlarmRadius")->mValue.getFloat();
mActors.getObjectsInRange(from, radius, neighbors);
@ -1223,7 +1222,7 @@ namespace MWMechanics
const MWWorld::Ptr& player, const MWWorld::Ptr& victim, OffenseType type, const ESM::RefId& factionId, int arg)
{
const MWWorld::Store<ESM::GameSetting>& store
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
if (type == OT_Murder && !victim.isEmpty())
victim.getClass().getCreatureStats(victim).notifyMurder();
@ -1261,7 +1260,7 @@ namespace MWMechanics
// Make surrounding actors within alarm distance respond to the crime
std::vector<MWWorld::Ptr> neighbors;
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
osg::Vec3f from(player.getRefData().getPosition().asVec3());
float radius = esmStore.get<ESM::GameSetting>().find("fAlarmRadius")->mValue.getFloat();
@ -1534,7 +1533,7 @@ namespace MWMechanics
return false;
const MWWorld::Store<ESM::GameSetting>& store
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
CreatureStats& stats = ptr.getClass().getCreatureStats(ptr);
@ -1788,8 +1787,7 @@ namespace MWMechanics
&& MWBase::Environment::get().getWorld()->getGlobalInt(MWWorld::Globals::sPCKnownWerewolf)))
{
const ESM::GameSetting* iWerewolfFightMod
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>().find(
"iWerewolfFightMod");
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>().find("iWerewolfFightMod");
fight += iWerewolfFightMod->mValue.getInteger();
}
}
@ -1887,7 +1885,7 @@ namespace MWMechanics
// Witnesses of the player's transformation will make them a globally known werewolf
std::vector<MWWorld::Ptr> neighbors;
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
getActorsInRange(
actor.getRefData().getPosition().asVec3(), gmst.find("fAlarmRadius")->mValue.getFloat(), neighbors);
@ -1928,7 +1926,7 @@ namespace MWMechanics
void MechanicsManager::applyWerewolfAcrobatics(const MWWorld::Ptr& actor)
{
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
MWMechanics::NpcStats& stats = actor.getClass().getNpcStats(actor);
auto& skill = stats.getSkill(ESM::Skill::Acrobatics);
skill.setModifier(gmst.find("fWerewolfAcrobatics")->mValue.getFloat() - skill.getModified());

@ -84,8 +84,7 @@ void MWMechanics::NpcStats::raiseRank(const ESM::RefId& faction)
if (it != mFactionRank.end())
{
// Does the next rank exist?
const ESM::Faction* factionPtr
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(faction);
const ESM::Faction* factionPtr = MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(faction);
if (it->second + 1 < 10 && !factionPtr->mRanks[it->second + 1].empty())
it->second += 1;
}
@ -122,7 +121,7 @@ void MWMechanics::NpcStats::expell(const ESM::RefId& factionID)
if (mExpelled.find(factionID) == mExpelled.end())
{
std::string message = "#{sExpelledMessage}";
message += MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionID)->mName;
message += MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(factionID)->mName;
MWBase::Environment::get().getWindowManager()->messageBox(message);
mExpelled.insert(factionID);
}
@ -157,8 +156,7 @@ float MWMechanics::NpcStats::getSkillProgressRequirement(int skillIndex, const E
{
float progressRequirement = static_cast<float>(1 + getSkill(skillIndex).getBase());
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
const MWWorld::Store<ESM::GameSetting>& gmst = MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
float typeFactor = gmst.find("fMiscSkillBonus")->mValue.getFloat();
@ -183,7 +181,7 @@ float MWMechanics::NpcStats::getSkillProgressRequirement(int skillIndex, const E
float specialisationFactor = 1;
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>().find(skillIndex);
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().find(skillIndex);
if (skill->mData.mSpecialization == class_.mData.mSpecialization)
{
specialisationFactor = gmst.find("fSpecialSkillBonus")->mValue.getFloat();
@ -198,7 +196,7 @@ float MWMechanics::NpcStats::getSkillProgressRequirement(int skillIndex, const E
void MWMechanics::NpcStats::useSkill(int skillIndex, const ESM::Class& class_, int usageType, float extraFactor)
{
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>().find(skillIndex);
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().find(skillIndex);
float skillGain = 1;
if (usageType >= 4)
throw std::runtime_error("skill usage type out of range");
@ -231,8 +229,7 @@ void MWMechanics::NpcStats::increaseSkill(
base += 1;
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
const MWWorld::Store<ESM::GameSetting>& gmst = MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
// is this a minor or major skill?
int increase = gmst.find("iLevelupMiscMultAttriubte")->mValue.getInteger(); // Note: GMST has a typo
@ -252,7 +249,7 @@ void MWMechanics::NpcStats::increaseSkill(
}
}
const ESM::Skill* skill = MWBase::Environment::get().getWorld()->getStore().get<ESM::Skill>().find(skillIndex);
const ESM::Skill* skill = MWBase::Environment::get().getESMStore()->get<ESM::Skill>().find(skillIndex);
mSkillIncreases[skill->mData.mAttribute] += increase;
mSpecIncreases[skill->mData.mSpecialization] += gmst.find("iLevelupSpecialization")->mValue.getInteger();
@ -288,8 +285,7 @@ int MWMechanics::NpcStats::getLevelProgress() const
void MWMechanics::NpcStats::levelUp()
{
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
const MWWorld::Store<ESM::GameSetting>& gmst = MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
mLevelProgress -= gmst.find("iLevelUpTotal")->mValue.getInteger();
mLevelProgress = std::max(0, mLevelProgress); // might be necessary when levelup was invoked via console
@ -333,12 +329,7 @@ int MWMechanics::NpcStats::getLevelupAttributeMultiplier(int attribute) const
std::stringstream gmst;
gmst << "iLevelUp" << std::setfill('0') << std::setw(2) << num << "Mult";
return MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.find(gmst.str())
->mValue.getInteger();
return MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>().find(gmst.str())->mValue.getInteger();
}
int MWMechanics::NpcStats::getSkillIncreasesForSpecialization(int spec) const
@ -392,8 +383,7 @@ bool MWMechanics::NpcStats::hasSkillsForRank(const ESM::RefId& factionId, int ra
if (rank < 0 || rank >= 10)
throw std::runtime_error("rank index out of range");
const ESM::Faction& faction
= *MWBase::Environment::get().getWorld()->getStore().get<ESM::Faction>().find(factionId);
const ESM::Faction& faction = *MWBase::Environment::get().getESMStore()->get<ESM::Faction>().find(factionId);
std::vector<int> skills;
@ -517,7 +507,7 @@ void MWMechanics::NpcStats::readState(const ESM::CreatureStats& state)
void MWMechanics::NpcStats::readState(const ESM::NpcStats& state)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
for (auto iter(state.mFactions.begin()); iter != state.mFactions.end(); ++iter)
if (store.get<ESM::Faction>().search(iter->first))

@ -37,15 +37,13 @@ namespace MWMechanics
float pcSneak = static_cast<float>(mThief.getClass().getSkill(mThief, ESM::Skill::Sneak));
int iPickMinChance = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("iPickMinChance")
->mValue.getInteger();
int iPickMaxChance = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("iPickMaxChance")
->mValue.getInteger();
@ -66,9 +64,8 @@ namespace MWMechanics
{
float stackValue = static_cast<float>(item.getClass().getValue(item) * count);
float fPickPocketMod = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fPickPocketMod")
->mValue.getFloat();
float valueTerm = 10 * fPickPocketMod * stackValue;

@ -26,9 +26,8 @@ namespace MWMechanics
return false;
static const float fMagicItemRechargePerSecond = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fMagicItemRechargePerSecond")
->mValue.getFloat();
@ -62,13 +61,12 @@ namespace MWMechanics
if (roll < x)
{
const ESM::RefId& soul = gem.getCellRef().getSoul();
const ESM::Creature* creature
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Creature>().find(soul);
const ESM::Creature* creature = MWBase::Environment::get().getESMStore()->get<ESM::Creature>().find(soul);
float restored = creature->mData.mSoul * (roll / x);
const ESM::Enchantment* enchantment
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(
= MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>().find(
item.getClass().getEnchantment(item));
item.getCellRef().setEnchantmentCharge(std::min(
item.getCellRef().getEnchantmentCharge() + restored, static_cast<float>(enchantment->mData.mCharge)));
@ -88,9 +86,8 @@ namespace MWMechanics
if (gem.getRefData().getCount() == 0)
{
std::string message = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("sNotifyMessage51")
->mValue.getString();
message = Misc::StringUtils::format(message, gem.getClass().getName(gem));

@ -38,9 +38,8 @@ namespace MWMechanics
float armorerSkill = player.getClass().getSkill(player, ESM::Skill::Armorer);
float fRepairAmountMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fRepairAmountMult")
->mValue.getFloat();
@ -88,9 +87,8 @@ namespace MWMechanics
store.remove(mTool, 1);
std::string message = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("sNotifyMessage51")
->mValue.getString();
message = Misc::StringUtils::format(message, mTool.getClass().getName(mTool));

@ -41,9 +41,8 @@ namespace MWMechanics
float pickQuality = lockpick.get<ESM::Lockpick>()->mBase->mData.mQuality;
float fPickLockMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fPickLockMult")
->mValue.getFloat();
@ -88,13 +87,12 @@ namespace MWMechanics
float probeQuality = probe.get<ESM::Probe>()->mBase->mData.mQuality;
const ESM::Spell* trapSpell
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(trap.getCellRef().getTrap());
= MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(trap.getCellRef().getTrap());
int trapSpellPoints = trapSpell->mData.mCost;
float fTrapCostMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fTrapCostMult")
->mValue.getFloat();

@ -15,7 +15,7 @@ namespace MWMechanics
template <class T>
void setBaseAISetting(const ESM::RefId& id, MWMechanics::AiSetting setting, int value)
{
T copy = *MWBase::Environment::get().getWorld()->getStore().get<T>().find(id);
T copy = *MWBase::Environment::get().getESMStore()->get<T>().find(id);
switch (setting)
{
case MWMechanics::AiSetting::Hello:
@ -33,7 +33,7 @@ namespace MWMechanics
default:
assert(false);
}
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
MWBase::Environment::get().getESMStore()->overrideRecord(copy);
}
}

@ -167,7 +167,7 @@ namespace MWMechanics
bool containsRecastable = false;
std::vector<const ESM::MagicEffect*> magicEffects;
magicEffects.reserve(effects.mList.size());
const auto& store = MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>();
const auto& store = MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>();
for (const ESM::ENAMstruct& effect : effects.mList)
{
if (effect.mRange == range)
@ -278,7 +278,7 @@ namespace MWMechanics
bool CastSpell::cast(const ESM::RefId& id)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
if (const auto spell = store.get<ESM::Spell>().search(id))
return cast(spell);
@ -301,7 +301,7 @@ namespace MWMechanics
mId = item.getCellRef().getRefId();
const ESM::Enchantment* enchantment
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(enchantmentName);
= MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>().find(enchantmentName);
mSlot = slot;
@ -336,7 +336,7 @@ namespace MWMechanics
{
short effectId = enchantment->mEffects.mList.front().mEffectID;
const ESM::MagicEffect* magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectId);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effectId);
school = magicEffect->mData.mSchool;
}
@ -472,7 +472,7 @@ namespace MWMechanics
effect.mRange = ESM::RT_Self;
effect.mArea = 0;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const auto magicEffect = store.get<ESM::MagicEffect>().find(effect.mEffectID);
const MWMechanics::CreatureStats& creatureStats = mCaster.getClass().getCreatureStats(mCaster);
@ -533,7 +533,7 @@ namespace MWMechanics
void CastSpell::playSpellCastingEffects(const std::vector<ESM::ENAMstruct>& effects) const
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
std::vector<std::string> addedEffects;
const VFS::Manager* const vfs = MWBase::Environment::get().getResourceSystem()->getVFS();
@ -626,9 +626,9 @@ namespace MWMechanics
// Add VFX
const ESM::Static* castStatic;
if (!magicEffect.mHit.empty())
castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find(magicEffect.mHit);
castStatic = MWBase::Environment::get().getESMStore()->get<ESM::Static>().find(magicEffect.mHit);
else
castStatic = MWBase::Environment::get().getWorld()->getStore().get<ESM::Static>().find(
castStatic = MWBase::Environment::get().getESMStore()->get<ESM::Static>().find(
ESM::RefId::stringRefId("VFX_DefaultHit"));
bool loop = (magicEffect.mData.mFlags & ESM::MagicEffect::ContinuousVfx) != 0;

@ -267,7 +267,7 @@ namespace
if (effect.mFlags & ESM::ActiveEffect::Flag_Applied && effect.mEffectId != ESM::MagicEffect::Corprus)
{
const auto* magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectId);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effect.mEffectId);
if (magicEffect->mData.mFlags & ESM::MagicEffect::Flags::AppliedOnce
&& (!harmfulOnly || magicEffect->mData.mFlags & ESM::MagicEffect::Flags::Harmful))
return true;
@ -277,7 +277,7 @@ namespace
void absorbSpell(const ESM::RefId& spellId, const MWWorld::Ptr& caster, const MWWorld::Ptr& target)
{
const auto& esmStore = MWBase::Environment::get().getWorld()->getStore();
const auto& esmStore = *MWBase::Environment::get().getESMStore();
const ESM::Static* absorbStatic = esmStore.get<ESM::Static>().find(ESM::RefId::stringRefId("VFX_Absorb"));
MWRender::Animation* animation = MWBase::Environment::get().getWorld()->getAnimation(target);
if (animation && !absorbStatic->mModel.empty())
@ -359,7 +359,7 @@ namespace
{
const ESM::Spell* spell = nullptr;
if (spellParams.getType() == ESM::ActiveSpells::Type_Temporary)
spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(spellParams.getId());
spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(spellParams.getId());
float magnitudeMult
= MWMechanics::getEffectMultiplier(effect.mEffectId, target, caster, spell, &magnitudes);
if (magnitudeMult == 0)
@ -431,8 +431,7 @@ namespace MWMechanics
if (params.getType() == ESM::ActiveSpells::Type_Temporary)
{
const ESM::Spell* spell
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(
params.getId());
= MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(params.getId());
if (spell && spell->mData.mType == ESM::Spell::ST_Spell)
{
auto& prng = MWBase::Environment::get().getWorld()->getPrng();

@ -18,16 +18,16 @@ namespace
template <class T>
const std::vector<ESM::RefId> getSpellList(const ESM::RefId& id)
{
return MWBase::Environment::get().getWorld()->getStore().get<T>().find(id)->mSpells.mList;
return MWBase::Environment::get().getESMStore()->get<T>().find(id)->mSpells.mList;
}
template <class T>
bool withBaseRecord(const ESM::RefId& id, const std::function<bool(std::vector<ESM::RefId>&)>& function)
{
T copy = *MWBase::Environment::get().getWorld()->getStore().get<T>().find(id);
T copy = *MWBase::Environment::get().getESMStore()->get<T>().find(id);
bool changed = function(copy.mSpells.mList);
if (changed)
MWBase::Environment::get().getWorld()->createOverrideRecord(copy);
MWBase::Environment::get().getESMStore()->overrideRecord(copy);
return changed;
}
}
@ -68,7 +68,7 @@ namespace MWMechanics
const ESM::Spell* SpellList::getSpell(const ESM::RefId& id)
{
return MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().find(id);
return MWBase::Environment::get().getESMStore()->get<ESM::Spell>().find(id);
}
void SpellList::add(const ESM::Spell* spell)

@ -32,7 +32,7 @@ namespace
if (effectFilter == -1)
{
const ESM::Spell* spell
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(it->getId());
= MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(it->getId());
if (!spell || spell->mData.mType != ESM::Spell::ST_Spell)
continue;
}
@ -44,7 +44,7 @@ namespace
if (effectFilter != -1 && effectId != effectFilter)
continue;
const ESM::MagicEffect* magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectId);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effectId);
if (effect.mDuration <= 3) // Don't attempt to dispel if effect runs out shortly anyway
continue;
@ -127,7 +127,7 @@ namespace MWMechanics
if (actor.getClass().isNpc())
{
const ESM::RefId& raceid = actor.get<ESM::NPC>()->mBase->mRace;
const ESM::Race* race = MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(raceid);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(raceid);
if (race->mPowers.exists(spell->mId))
return 0.f;
}
@ -147,8 +147,7 @@ namespace MWMechanics
if (ptr.getClass().getEnchantment(ptr).empty())
return 0.f;
const ESM::Enchantment* enchantment
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Enchantment>().find(
const ESM::Enchantment* enchantment = MWBase::Environment::get().getESMStore()->get<ESM::Enchantment>().find(
ptr.getClass().getEnchantment(ptr));
// Spells don't stack, so early out if the spell is still active on the target
@ -372,8 +371,7 @@ namespace MWMechanics
{
// Beast races can't wear helmets or boots
const ESM::RefId& raceid = actor.get<ESM::NPC>()->mBase->mRace;
const ESM::Race* race
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Race>().find(raceid);
const ESM::Race* race = MWBase::Environment::get().getESMStore()->get<ESM::Race>().find(raceid);
if (race->mData.mFlags & ESM::Race::Beast)
return 0.f;
}
@ -640,7 +638,7 @@ namespace MWMechanics
}
const ESM::MagicEffect* magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effect.mEffectID);
if (magicEffect->mData.mFlags & ESM::MagicEffect::Harmful)
{
rating *= -1.f;
@ -694,7 +692,7 @@ namespace MWMechanics
float rating = 0.f;
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fAIMagicSpellMult = gmst.find("fAIMagicSpellMult")->mValue.getFloat();
static const float fAIRangeMagicSpellMult = gmst.find("fAIRangeMagicSpellMult")->mValue.getFloat();
@ -716,7 +714,7 @@ namespace MWMechanics
float vanillaRateSpell(const ESM::Spell* spell, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy)
{
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fAIMagicSpellMult = gmst.find("fAIMagicSpellMult")->mValue.getFloat();
static const float fAIRangeMagicSpellMult = gmst.find("fAIRangeMagicSpellMult")->mValue.getFloat();

@ -33,8 +33,7 @@ namespace MWMechanics
if (ESM::MagicEffect::getResistanceEffect(effectId) == -1)
return 0.f;
const auto magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effectId);
const auto magicEffect = MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effectId);
const MWMechanics::CreatureStats& stats = actor.getClass().getCreatureStats(actor);
const MWMechanics::MagicEffects* magicEffects = &stats.getMagicEffects();

@ -208,7 +208,7 @@ namespace MWMechanics
for (const ESM::RefId& id : state.mSpells)
{
// Discard spells that are no longer available due to changed content files
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(id);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(id);
if (spell)
{
addSpell(spell);
@ -220,15 +220,14 @@ namespace MWMechanics
// Add spells from the base record
for (const ESM::RefId& id : baseSpells)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(id);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(id);
if (spell)
addSpell(spell);
}
for (auto it = state.mUsedPowers.begin(); it != state.mUsedPowers.end(); ++it)
{
const ESM::Spell* spell
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(it->first);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(it->first);
if (!spell)
continue;
mUsedPowers.emplace_back(spell, MWWorld::TimeStamp(it->second));
@ -238,8 +237,7 @@ namespace MWMechanics
// only in old saves. Convert data to the new approach.
for (auto it = state.mPermanentSpellEffects.begin(); it != state.mPermanentSpellEffects.end(); ++it)
{
const ESM::Spell* spell
= MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(it->first);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(it->first);
if (!spell)
continue;
@ -293,7 +291,7 @@ namespace MWMechanics
bool Spells::setSpells(const ESM::RefId& actorId)
{
bool result;
std::tie(mSpellList, result) = MWBase::Environment::get().getWorld()->getStore().getSpellList(actorId);
std::tie(mSpellList, result) = MWBase::Environment::get().getESMStore()->getSpellList(actorId);
mSpellList->addListener(this);
addAllToInstance(mSpellList->getSpells());
return result;
@ -303,7 +301,7 @@ namespace MWMechanics
{
for (const ESM::RefId& id : spells)
{
const ESM::Spell* spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(id);
const ESM::Spell* spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(id);
if (spell)
addSpell(spell);
else

@ -31,7 +31,7 @@ namespace MWMechanics
float calcEffectCost(
const ESM::ENAMstruct& effect, const ESM::MagicEffect* magicEffect, const EffectCostMethod method)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
if (!magicEffect)
magicEffect = store.get<ESM::MagicEffect>().find(effect.mEffectID);
bool hasMagnitude = !(magicEffect->mData.mFlags & ESM::MagicEffect::NoMagnitude);
@ -104,7 +104,7 @@ namespace MWMechanics
{
float x = static_cast<float>(effect.mDuration);
const auto magicEffect
= MWBase::Environment::get().getWorld()->getStore().get<ESM::MagicEffect>().find(effect.mEffectID);
= MWBase::Environment::get().getESMStore()->get<ESM::MagicEffect>().find(effect.mEffectID);
if (!(magicEffect->mData.mFlags & ESM::MagicEffect::AppliedOnce))
x = std::max(1.f, x);
@ -115,9 +115,8 @@ namespace MWMechanics
if (effect.mRange == ESM::RT_Target)
x *= 1.5f;
static const float fEffectCostMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fEffectCostMult")
->mValue.getFloat();
x *= fEffectCostMult;
@ -183,7 +182,7 @@ namespace MWMechanics
float getSpellSuccessChance(
const ESM::RefId& spellId, const MWWorld::Ptr& actor, int* effectiveSchool, bool cap, bool checkMagicka)
{
if (const auto spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(spellId))
if (const auto spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(spellId))
return getSpellSuccessChance(spell, actor, effectiveSchool, cap, checkMagicka);
return 0.f;
}
@ -209,7 +208,7 @@ namespace MWMechanics
bool spellIncreasesSkill(const ESM::RefId& spellId)
{
const auto spell = MWBase::Environment::get().getWorld()->getStore().get<ESM::Spell>().search(spellId);
const auto spell = MWBase::Environment::get().getESMStore()->get<ESM::Spell>().search(spellId);
return spell && spellIncreasesSkill(spell);
}
}

@ -63,12 +63,8 @@ namespace MWMechanics
for (const auto& it : summonMapToGameSetting)
{
summonMap[it.first] = ESM::RefId::stringRefId(MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.find(it.second)
->mValue.getString());
summonMap[it.first] = ESM::RefId::stringRefId(
MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>().find(it.second)->mValue.getString());
}
return summonMap;
}

@ -30,7 +30,7 @@ namespace MWMechanics
}
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
// Is the player buying?
bool buying = (merchantOffer < 0);

@ -170,7 +170,7 @@ namespace MWMechanics
const MWWorld::Ptr& weapon, const MWWorld::Ptr& ammo, const MWWorld::Ptr& actor, const MWWorld::Ptr& enemy)
{
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
static const float fAIMeleeWeaponMult = gmst.find("fAIMeleeWeaponMult")->mValue.getFloat();
static const float fAIMeleeArmorMult = gmst.find("fAIMeleeArmorMult")->mValue.getFloat();

@ -177,9 +177,8 @@ namespace MWPhysics
float angleDegrees = osg::RadiansToDegrees(
std::acos(stormDirection * velocity / (stormDirection.length() * velocity.length())));
static const float fStromWalkMult = MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fStromWalkMult")
->mValue.getFloat();
velocity *= 1.f - (fStromWalkMult * (angleDegrees / 180.f));

@ -77,7 +77,7 @@ namespace
if (!isPlayer || !MWBase::Environment::get().getWorld()->getGodModeState())
{
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
const float fFatigueJumpBase = gmst.find("fFatigueJumpBase")->mValue.getFloat();
const float fFatigueJumpMult = gmst.find("fFatigueJumpMult")->mValue.getFloat();
const float normalizedEncumbrance = std::min(1.f, ptr.getClass().getNormalizedEncumbrance(ptr));
@ -209,7 +209,7 @@ namespace MWPhysics
// Use cone shape as fallback
const MWWorld::Store<ESM::GameSetting>& store
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
btConeShape shape(osg::DegreesToRadians(store.find("fCombatAngleXY")->mValue.getFloat() / 2.0f), queryDistance);
shape.setLocalScaling(btVector3(
@ -988,9 +988,8 @@ namespace MWPhysics
, mSwimLevel(waterlevel
- (actor.getRenderingHalfExtents().z() * 2
* MWBase::Environment::get()
.getWorld()
->getStore()
.get<ESM::GameSetting>()
.getESMStore()
->get<ESM::GameSetting>()
.find("fSwimHeightScale")
->mValue.getFloat()))
, mSlowFall(slowFall)

@ -112,7 +112,7 @@ namespace MWRender
// Try to recover the body part model, use ground model as a fallback otherwise.
if (!bodyparts.empty())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const MWWorld::Store<ESM::BodyPart>& partStore = store.get<ESM::BodyPart>();
for (const auto& part : bodyparts)
{

@ -1413,7 +1413,7 @@ namespace MWRender
// given race and gender as well Since it is a quite rare case, there should not be a noticable
// performance loss Note: consider that player and werewolves have no custom animation files
// attached for now
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Race* race = store.get<ESM::Race>().find(ref->mBase->mRace);
bool isBeast = (race->mData.mFlags & ESM::Race::Beast) != 0;

@ -290,7 +290,7 @@ namespace MWRender
void GlobalMap::render()
{
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
// get the size of the world
MWWorld::Store<ESM::Cell>::iterator it = esmStore.get<ESM::Cell>().extBegin();

@ -56,7 +56,7 @@ namespace
if (sVampireMapping.find(thisCombination) == sVampireMapping.end())
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
for (const ESM::BodyPart& bodypart : store.get<ESM::BodyPart>())
{
if (!bodypart.mData.mVampire)
@ -463,7 +463,7 @@ namespace MWRender
for (size_t i = 0; i < ESM::PRT_Count; i++)
removeIndividualPart((ESM::PartReferenceType)i);
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const ESM::Race* race = store.get<ESM::Race>().find(mNpc->mRace);
NpcType curType = getNpcType();
bool isWerewolf = (curType == Type_Werewolf);
@ -873,7 +873,7 @@ namespace MWRender
void NpcAnimation::addPartGroup(int group, int priority, const std::vector<ESM::PartReference>& parts,
bool enchantedGlow, osg::Vec4f* glowColor)
{
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
const MWWorld::Store<ESM::BodyPart>& partStore = store.get<ESM::BodyPart>();
const char* ext = (mViewMode == VM_FirstPerson) ? ".1st" : "";
@ -1201,7 +1201,7 @@ namespace MWRender
if (werewolf)
return parts;
const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& store = *MWBase::Environment::get().getESMStore();
for (const ESM::BodyPart& bodypart : store.get<ESM::BodyPart>())
{

@ -28,7 +28,7 @@ namespace MWRender
bool TerrainStorage::hasData(int cellX, int cellY)
{
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
const ESM::Land* land = esmStore.get<ESM::Land>().search(cellX, cellY);
return land != nullptr;
@ -41,7 +41,7 @@ namespace MWRender
maxX = 0;
maxY = 0;
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
MWWorld::Store<ESM::Land>::iterator it = esmStore.get<ESM::Land>().begin();
for (; it != esmStore.get<ESM::Land>().end(); ++it)
@ -73,7 +73,7 @@ namespace MWRender
const ESM::LandTexture* TerrainStorage::getLandTexture(int index, short plugin)
{
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
const MWWorld::ESMStore& esmStore = *MWBase::Environment::get().getESMStore();
return esmStore.get<ESM::LandTexture>().search(index, plugin);
}

@ -114,7 +114,7 @@ namespace MWRender
* osg::Quat(actor.getRefData().getPosition().rot[2], osg::Vec3f(0, 0, -1));
const MWWorld::Store<ESM::GameSetting>& gmst
= MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
= MWBase::Environment::get().getESMStore()->get<ESM::GameSetting>();
MWMechanics::applyFatigueLoss(actor, *weapon, attackStrength);

Some files were not shown because too many files have changed in this diff Show More

Loading…
Cancel
Save