mirror of
https://github.com/TES3MP/openmw-tes3mp.git
synced 2025-01-19 21:23:52 +00:00
Remove some unnecessary per-frame store searches
This commit is contained in:
parent
984c455027
commit
44dd62067e
3 changed files with 8 additions and 5 deletions
|
@ -838,7 +838,7 @@ namespace MWMechanics
|
|||
if (ptr.getClass().isClass(ptr, "Guard") && creatureStats.getAiSequence().getTypeId() != AiPackage::TypeIdPursue && !creatureStats.getAiSequence().isInCombat())
|
||||
{
|
||||
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore();
|
||||
int cutoff = esmStore.get<ESM::GameSetting>().find("iCrimeThreshold")->getInt();
|
||||
static const int cutoff = esmStore.get<ESM::GameSetting>().find("iCrimeThreshold")->getInt();
|
||||
// Force dialogue on sight if bounty is greater than the cutoff
|
||||
// In vanilla morrowind, the greeting dialogue is scripted to either arrest the player (< 5000 bounty) or attack (>= 5000 bounty)
|
||||
if ( player.getClass().getNpcStats(player).getBounty() >= cutoff
|
||||
|
@ -846,7 +846,7 @@ namespace MWMechanics
|
|||
&& MWBase::Environment::get().getWorld()->getLOS(ptr, player)
|
||||
&& MWBase::Environment::get().getMechanicsManager()->awarenessCheck(player, ptr))
|
||||
{
|
||||
static int iCrimeThresholdMultiplier = esmStore.get<ESM::GameSetting>().find("iCrimeThresholdMultiplier")->getInt();
|
||||
static const int iCrimeThresholdMultiplier = esmStore.get<ESM::GameSetting>().find("iCrimeThresholdMultiplier")->getInt();
|
||||
if (player.getClass().getNpcStats(player).getBounty() >= cutoff * iCrimeThresholdMultiplier)
|
||||
MWBase::Environment::get().getMechanicsManager()->startCombat(ptr, player);
|
||||
else
|
||||
|
|
|
@ -48,8 +48,10 @@ namespace MWMechanics
|
|||
const MWWorld::Store<ESM::GameSetting> &gmst =
|
||||
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
|
||||
|
||||
return gmst.find ("fFatigueBase")->getFloat()
|
||||
- gmst.find ("fFatigueMult")->getFloat() * (1-normalised);
|
||||
static const float fFatigueBase = gmst.find("fFatigueBase")->getFloat();
|
||||
static const float fFatigueMult = gmst.find("fFatigueMult")->getFloat();
|
||||
|
||||
return fFatigueBase - fFatigueMult * (1-normalised);
|
||||
}
|
||||
|
||||
const AttributeValue &CreatureStats::getAttribute(int index) const
|
||||
|
|
|
@ -1009,7 +1009,8 @@ namespace MWWorld
|
|||
if (mActivationDistanceOverride >= 0)
|
||||
return static_cast<float>(mActivationDistanceOverride);
|
||||
|
||||
return getStore().get<ESM::GameSetting>().find("iMaxActivateDist")->getFloat() * 5 / 4;
|
||||
static const int iMaxActivateDist = getStore().get<ESM::GameSetting>().find("iMaxActivateDist")->getInt();
|
||||
return iMaxActivateDist * 5.f / 4.f;
|
||||
}
|
||||
|
||||
MWWorld::Ptr World::getFacedObject()
|
||||
|
|
Loading…
Reference in a new issue