Merge remote-tracking branch 'origin/master'

openmw-38
Marc Zinnschlag 9 years ago
commit 7cc950ed64

@ -838,7 +838,7 @@ namespace MWMechanics
if (ptr.getClass().isClass(ptr, "Guard") && creatureStats.getAiSequence().getTypeId() != AiPackage::TypeIdPursue && !creatureStats.getAiSequence().isInCombat()) if (ptr.getClass().isClass(ptr, "Guard") && creatureStats.getAiSequence().getTypeId() != AiPackage::TypeIdPursue && !creatureStats.getAiSequence().isInCombat())
{ {
const MWWorld::ESMStore& esmStore = MWBase::Environment::get().getWorld()->getStore(); 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 // 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) // 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 if ( player.getClass().getNpcStats(player).getBounty() >= cutoff
@ -846,7 +846,7 @@ namespace MWMechanics
&& MWBase::Environment::get().getWorld()->getLOS(ptr, player) && MWBase::Environment::get().getWorld()->getLOS(ptr, player)
&& MWBase::Environment::get().getMechanicsManager()->awarenessCheck(player, ptr)) && 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) if (player.getClass().getNpcStats(player).getBounty() >= cutoff * iCrimeThresholdMultiplier)
MWBase::Environment::get().getMechanicsManager()->startCombat(ptr, player); MWBase::Environment::get().getMechanicsManager()->startCombat(ptr, player);
else else

@ -48,8 +48,10 @@ namespace MWMechanics
const MWWorld::Store<ESM::GameSetting> &gmst = const MWWorld::Store<ESM::GameSetting> &gmst =
MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>(); MWBase::Environment::get().getWorld()->getStore().get<ESM::GameSetting>();
return gmst.find ("fFatigueBase")->getFloat() static const float fFatigueBase = gmst.find("fFatigueBase")->getFloat();
- gmst.find ("fFatigueMult")->getFloat() * (1-normalised); static const float fFatigueMult = gmst.find("fFatigueMult")->getFloat();
return fFatigueBase - fFatigueMult * (1-normalised);
} }
const AttributeValue &CreatureStats::getAttribute(int index) const const AttributeValue &CreatureStats::getAttribute(int index) const

@ -1009,7 +1009,8 @@ namespace MWWorld
if (mActivationDistanceOverride >= 0) if (mActivationDistanceOverride >= 0)
return static_cast<float>(mActivationDistanceOverride); 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() MWWorld::Ptr World::getFacedObject()

@ -1,8 +0,0 @@
#include "stringops.hpp"
namespace Misc
{
std::locale StringUtils::mLocale = std::locale::classic();
}

@ -4,18 +4,15 @@
#include <cctype> #include <cctype>
#include <string> #include <string>
#include <algorithm> #include <algorithm>
#include <locale>
namespace Misc namespace Misc
{ {
class StringUtils class StringUtils
{ {
static std::locale mLocale;
struct ci struct ci
{ {
bool operator()(char x, char y) const { bool operator()(char x, char y) const {
return std::tolower(x, StringUtils::mLocale) < std::tolower(y, StringUtils::mLocale); return tolower(x) < tolower(y);
} }
}; };
@ -31,7 +28,7 @@ public:
std::string::const_iterator xit = x.begin(); std::string::const_iterator xit = x.begin();
std::string::const_iterator yit = y.begin(); std::string::const_iterator yit = y.begin();
for (; xit != x.end(); ++xit, ++yit) { for (; xit != x.end(); ++xit, ++yit) {
if (std::tolower(*xit, mLocale) != std::tolower(*yit, mLocale)) { if (tolower(*xit) != tolower(*yit)) {
return false; return false;
} }
} }
@ -45,7 +42,7 @@ public:
for(;xit != x.end() && yit != y.end() && len > 0;++xit,++yit,--len) for(;xit != x.end() && yit != y.end() && len > 0;++xit,++yit,--len)
{ {
int res = *xit - *yit; int res = *xit - *yit;
if(res != 0 && std::tolower(*xit, mLocale) != std::tolower(*yit, mLocale)) if(res != 0 && tolower(*xit) != tolower(*yit))
return (res > 0) ? 1 : -1; return (res > 0) ? 1 : -1;
} }
if(len > 0) if(len > 0)
@ -61,7 +58,7 @@ public:
/// Transforms input string to lower case w/o copy /// Transforms input string to lower case w/o copy
static std::string &toLower(std::string &inout) { static std::string &toLower(std::string &inout) {
for (unsigned int i=0; i<inout.size(); ++i) for (unsigned int i=0; i<inout.size(); ++i)
inout[i] = std::tolower(inout[i], mLocale); inout[i] = tolower(inout[i]);
return inout; return inout;
} }

Loading…
Cancel
Save