Skip to content

Commit

Permalink
Merge pull request #2326 from Capostrophic/regression
Browse files Browse the repository at this point in the history
Fix zero division in enchantment magnitude calculation
  • Loading branch information
akortunov committed Apr 14, 2019
2 parents 88f44c6 + 2c473d8 commit d115288
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion apps/openmw/mwworld/inventorystore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -644,7 +644,8 @@ void MWWorld::InventoryStore::updateMagicEffects(const Ptr& actor)
{
int delta = effect.mMagnMax - effect.mMagnMin;
// Roll some dice, one for each effect
params[i].mRandom = Misc::Rng::rollDice(delta + 1) / static_cast<float>(delta);
if (delta)
params[i].mRandom = Misc::Rng::rollDice(delta + 1) / static_cast<float>(delta);
// Try resisting each effect
params[i].mMultiplier = MWMechanics::getEffectMultiplier(effect.mEffectID, actor, actor);
++i;
Expand Down

0 comments on commit d115288

Please sign in to comment.