matronator / GlobalCollapse

Browser-based MMORPG based around the COVID pandemic. PWA supported.
https://global-collapse.com
MIT License
45 stars 18 forks source link

[BUG] Money runs into int32 overflow #2

Closed gerbenjacobs closed 4 years ago

gerbenjacobs commented 4 years ago

Describe the bug Money runs into int32 overflow. I sold 66,332,326 meth at $65 which should give me $4.311.601.190; however my balance turned to 2,147,483,647.

To Reproduce Steps to reproduce the behavior:

  1. Sell drugs at Darknet resulting in more than $2,147,483,647

Expected behavior 66,332,326 * 65 should result in $4.311.601.190 in my wallet.

Desktop (please complete the following information):

matronator commented 4 years ago

Hi, thank you for reporting! I'll get on to it right right away.

matronator commented 4 years ago

Instead of switching to bigInt or floats, I decided to cap the money player can have at $999,999,999, because I'm planning on changing how the Darknet works a bit so it won't be exponentially growing profits anymore