• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

Reply to thread

You're still having the same problem. Your "tries" is an unsigned 64-bit integer, it can never be bigger than then biggest possible unsigned 64-bit integer value. That's illogical. Also, even if you confirm that "tries" is lower than that, it does not guarantee that you won't wraparound (or "overflow" as you call it, but mind that semantically it's not correct) after multiplying it by another number.

Consider that you have two numbers: a, b and you need to make sure without multiplying them that the result of said multiplication wouldn't be bigger than c. How would you solve it?

a * b <= c

a <= c/b or b <= c/a

Of course you need to make sure that a or b (whichever you divide by) is not equal 0. You already do that with "tries", but not with "skillTries", so watch out. Dividing may also not be the optimal solution, but this example should give you a better understanding.


Back
Top