forked from teamnwah/openmw-tes3coop
Fix possible division by zero in the fatigue calculation (bug #4510)
This commit is contained in:
parent
0bd6078826
commit
30716344f2
2 changed files with 2 additions and 1 deletions
|
@ -67,6 +67,7 @@
|
|||
Bug #4496: SpellTurnLeft and SpellTurnRight animation groups are unused
|
||||
Bug #4497: File names starting with x or X are not classified as animation
|
||||
Bug #4503: Cast and ExplodeSpell commands increase alteration skill
|
||||
Bug #4510: Division by zero in MWMechanics::CreatureStats::setAttribute
|
||||
Feature #2606: Editor: Implemented (optional) case sensitive global search
|
||||
Feature #3083: Play animation when NPC is casting spell via script
|
||||
Feature #3276: Editor: Search- Show number of (remaining) search results and indicate a search without any results
|
||||
|
|
|
@ -157,7 +157,7 @@ namespace MWMechanics
|
|||
int endurance = getAttribute(ESM::Attribute::Endurance).getModified();
|
||||
DynamicStat<float> fatigue = getFatigue();
|
||||
float diff = (strength+willpower+agility+endurance) - fatigue.getBase();
|
||||
float currentToBaseRatio = (fatigue.getCurrent() / fatigue.getBase());
|
||||
float currentToBaseRatio = fatigue.getBase() > 0 ? (fatigue.getCurrent() / fatigue.getBase()) : 0;
|
||||
fatigue.setModified(fatigue.getModified() + diff, 0);
|
||||
fatigue.setCurrent(fatigue.getBase() * currentToBaseRatio);
|
||||
setFatigue(fatigue);
|
||||
|
|
Loading…
Reference in a new issue