Adjust EXP storage to uint64 (#4377)

* Updates EXP table to 200/70
* Always store exp as uint64 no matter the client date.
* Adjusts guild exp to uint64.
Co-authored-by: Aleos <aleos89@users.noreply.github.com>
Co-authored-by: Lemongrass3110 <lemongrass@kstp.at>
This commit is contained in:
Cydh Ramdh
2020-07-29 03:43:46 +07:00
committed by GitHub
parent 8b7f44cc63
commit 1658f273de
21 changed files with 321 additions and 192 deletions

View File

@@ -365,7 +365,7 @@ unsigned int get_percentage(const unsigned int A, const unsigned int B)
if( B == 0 )
{
ShowError("get_percentage(): divison by zero! (A=%u,B=%u)\n", A, B);
ShowError("get_percentage: divison by zero! (A=%u,B=%u)\n", A, B);
return ~0U;
}
@@ -373,9 +373,30 @@ unsigned int get_percentage(const unsigned int A, const unsigned int B)
if( result > UINT_MAX )
{
ShowError("get_percentage(): result percentage too high! (A=%u,B=%u,result=%g)\n", A, B, result);
ShowError("get_percentage: result percentage too high! (A=%u,B=%u,result=%g)\n", A, B, result);
return UINT_MAX;
}
return (unsigned int)floor(result);
}
uint32 get_percentage_exp(const uint64 a, const uint64 b)
{
double result;
if (b == 0)
{
ShowError("get_percentage_exp: divison by zero! (a=%" PRIu64 ",b=%" PRIu64 ")\n", a, b);
return ~0U;
}
result = 100.0 * ((double)a / (double)b);
if (result > UINT32_MAX)
{
ShowError("get_percentage_exp: result percentage too high! (a=%" PRIu64 ",b=%" PRIu64 ",result=%g)\n", a, b, result);
return UINT32_MAX;
}
return (uint32)floor(result);
}