SalieriC / SWIM

A collection of macros for the SWADE system on Foundry with a focus on immersion (i.e. by using sound effects)
GNU General Public License v3.0
10 stars 12 forks source link

[BUG] Travel Calculator doesn't always calculate the time properly. #134

Closed SalieriC closed 1 year ago

SalieriC commented 1 year ago

Describe the bug Sometimes the travel calculator doesn't display the time properly.

To Reproduce An example where this happens is by using 400 miles with a modern car and 200 miles with a modern car. 400 miles works flawlessly, however for 200 miles, the value for the 8hrs/day travel is way off by showing 12 hours (should be 4 instead).

Screenshots image

The calculation happens here: https://github.com/SalieriC/SWADE-Immersive-Macros/blob/b4d0f51e9455f99cb41ceef41addc50e77c8d2ff/swim/scripts/swim_modules/travel_calculator.js#L145-L153

I'll need someone good at both: JS and Math to help me with that, I'm clearly not good enough in either for that. 🤣 Any volunteers?