1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-02-03 19:45:34 +00:00

Add epsilon to armor class calculation

This commit is contained in:
scrawl 2014-07-30 20:26:47 +02:00
parent 261e755e73
commit 0f1451babd

View file

@ -157,15 +157,19 @@ namespace MWClass
float iWeight = gmst.find (typeGmst)->getInt(); float iWeight = gmst.find (typeGmst)->getInt();
if (iWeight * gmst.find ("fLightMaxMod")->getFloat()>= float epsilon = 5e-4;
ref->mBase->mData.mWeight)
if (ref->mBase->mData.mWeight == 0)
return ESM::Skill::Unarmored;
if (ref->mBase->mData.mWeight <= iWeight * gmst.find ("fLightMaxMod")->getFloat() + epsilon)
return ESM::Skill::LightArmor; return ESM::Skill::LightArmor;
if (iWeight * gmst.find ("fMedMaxMod")->getFloat()>= if (ref->mBase->mData.mWeight <= iWeight * gmst.find ("fMedMaxMod")->getFloat() + epsilon)
ref->mBase->mData.mWeight)
return ESM::Skill::MediumArmor; return ESM::Skill::MediumArmor;
return ESM::Skill::HeavyArmor; else
return ESM::Skill::HeavyArmor;
} }
int Armor::getValue (const MWWorld::Ptr& ptr) const int Armor::getValue (const MWWorld::Ptr& ptr) const