mirror of
https://gitlab.com/OpenMW/openmw.git
synced 2025-01-26 18:35:20 +00:00
Merge branch 'init_gmst' into 'master'
Use lambda instead of bool to make sure GMST initialized once See merge request OpenMW/openmw!1309
This commit is contained in:
commit
0d810fe41c
@ -82,12 +82,13 @@ namespace MWClass
|
||||
|
||||
const Creature::GMST& Creature::getGmst()
|
||||
{
|
||||
static GMST gmst;
|
||||
static bool inited = false;
|
||||
if (!inited)
|
||||
static const GMST gmst = []
|
||||
{
|
||||
GMST gmst;
|
||||
|
||||
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Store<ESM::GameSetting> &store = world->getStore().get<ESM::GameSetting>();
|
||||
|
||||
gmst.fMinWalkSpeedCreature = store.find("fMinWalkSpeedCreature");
|
||||
gmst.fMaxWalkSpeedCreature = store.find("fMaxWalkSpeedCreature");
|
||||
gmst.fEncumberedMoveEffect = store.find("fEncumberedMoveEffect");
|
||||
@ -101,8 +102,9 @@ namespace MWClass
|
||||
gmst.fKnockDownMult = store.find("fKnockDownMult");
|
||||
gmst.iKnockDownOddsMult = store.find("iKnockDownOddsMult");
|
||||
gmst.iKnockDownOddsBase = store.find("iKnockDownOddsBase");
|
||||
inited = true;
|
||||
}
|
||||
|
||||
return gmst;
|
||||
} ();
|
||||
return gmst;
|
||||
}
|
||||
|
||||
|
@ -266,10 +266,10 @@ namespace MWClass
|
||||
|
||||
const Npc::GMST& Npc::getGmst()
|
||||
{
|
||||
static GMST gmst;
|
||||
static bool inited = false;
|
||||
if(!inited)
|
||||
static const GMST gmst = []
|
||||
{
|
||||
GMST gmst;
|
||||
|
||||
const MWBase::World *world = MWBase::Environment::get().getWorld();
|
||||
const MWWorld::Store<ESM::GameSetting> &store = world->getStore().get<ESM::GameSetting>();
|
||||
|
||||
@ -294,8 +294,8 @@ namespace MWClass
|
||||
gmst.iKnockDownOddsBase = store.find("iKnockDownOddsBase");
|
||||
gmst.fCombatArmorMinMult = store.find("fCombatArmorMinMult");
|
||||
|
||||
inited = true;
|
||||
}
|
||||
return gmst;
|
||||
} ();
|
||||
return gmst;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user