1
0
Fork 1
mirror of https://github.com/TES3MP/openmw-tes3mp.git synced 2025-02-01 20:15:33 +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();
if (iWeight * gmst.find ("fLightMaxMod")->getFloat()>=
ref->mBase->mData.mWeight)
float epsilon = 5e-4;
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;
if (iWeight * gmst.find ("fMedMaxMod")->getFloat()>=
ref->mBase->mData.mWeight)
if (ref->mBase->mData.mWeight <= iWeight * gmst.find ("fMedMaxMod")->getFloat() + epsilon)
return ESM::Skill::MediumArmor;
return ESM::Skill::HeavyArmor;
else
return ESM::Skill::HeavyArmor;
}
int Armor::getValue (const MWWorld::Ptr& ptr) const