Commit 16fa381f authored by rswindell's avatar rswindell
Browse files

Use (float) typecast to insure ratios between 50-99% are calculated correctly

(not rounded up to 100%).
parent 9a8b278b
......@@ -394,7 +394,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
break;
case AR_PCR: /* post/call ratio (by percentage) */
if(user->logons>user->posts
&& (!user->posts || (100/(user->logons/user->posts))<(long)n))
&& (!user->posts || (100/((float)user->logons/user->posts))<(long)n))
result=_not;
else
result=!_not;
......@@ -406,7 +406,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
l=user->dlb;
if(!l) l=1;
if(user->dlb>user->ulb
&& (!user->ulb || (100/(l/user->ulb))<n))
&& (!user->ulb || (100/((float)l/user->ulb))<n))
result=_not;
else
result=!_not;
......@@ -418,7 +418,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
i=user->dls;
if(!i) i=1;
if(user->dls>user->uls
&& (!user->uls || (100/(i/user->uls))<n))
&& (!user->uls || (100/((float)i/user->uls))<n))
result=_not;
else
result=!_not;
......
......@@ -1523,7 +1523,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user)
if(user==NULL)
result=not;
else if(user->logons>user->posts
&& (!user->posts || 100/(user->logons/user->posts)<(long)n))
&& (!user->posts || 100/((float)user->logons/user->posts)<(long)n))
result=not;
else
result=!not;
......@@ -1535,7 +1535,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user)
l=user->dlb;
if(!l) l=1;
if(user->dlb>user->ulb
&& (!user->ulb || 100/(l/user->ulb)<n))
&& (!user->ulb || 100/((float)l/user->ulb)<n))
result=not;
else
result=!not;
......@@ -1548,7 +1548,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user)
i=user->dls;
if(!i) i=1;
if(user->dls>user->uls
&& (!user->uls || 100/(i/user->uls)<n))
&& (!user->uls || 100/((float)i/user->uls)<n))
result=not;
else
result=!not;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment