Toaninja / Gladius

0 stars 0 forks source link

Bug: Issue with randomly dividing by zero #13

Closed Toaninja closed 3 years ago

Toaninja commented 3 years ago

Reproduce: When either X or Y passed to roll() is 0

Root cause: One of the values being given by a getter is 0, thus causing the modulus operation to be something by 0.

Location: engine.cpp, within the roll function

Solution:

Version:

Toaninja commented 3 years ago

Solution: changed the % to fmod so that a float value could be used, as well as adding the FLT_MIN so that it was the value passed plus the smallest possible value for a float so that it technically would never be 0, but would effectively be 0.