Skip to content
Snippets Groups Projects
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
No related branches found
No related tags found
No related merge requests found
...@@ -394,7 +394,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user) ...@@ -394,7 +394,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
break; break;
case AR_PCR: /* post/call ratio (by percentage) */ case AR_PCR: /* post/call ratio (by percentage) */
if(user->logons>user->posts 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; result=_not;
else else
result=!_not; result=!_not;
...@@ -406,7 +406,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user) ...@@ -406,7 +406,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
l=user->dlb; l=user->dlb;
if(!l) l=1; if(!l) l=1;
if(user->dlb>user->ulb if(user->dlb>user->ulb
&& (!user->ulb || (100/(l/user->ulb))<n)) && (!user->ulb || (100/((float)l/user->ulb))<n))
result=_not; result=_not;
else else
result=!_not; result=!_not;
...@@ -418,7 +418,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user) ...@@ -418,7 +418,7 @@ bool sbbs_t::ar_exp(uchar **ptrptr, user_t* user)
i=user->dls; i=user->dls;
if(!i) i=1; if(!i) i=1;
if(user->dls>user->uls if(user->dls>user->uls
&& (!user->uls || (100/(i/user->uls))<n)) && (!user->uls || (100/((float)i/user->uls))<n))
result=_not; result=_not;
else else
result=!_not; result=!_not;
......
...@@ -1523,7 +1523,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user) ...@@ -1523,7 +1523,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user)
if(user==NULL) if(user==NULL)
result=not; result=not;
else if(user->logons>user->posts 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; result=not;
else else
result=!not; result=!not;
...@@ -1535,7 +1535,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user) ...@@ -1535,7 +1535,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user)
l=user->dlb; l=user->dlb;
if(!l) l=1; if(!l) l=1;
if(user->dlb>user->ulb if(user->dlb>user->ulb
&& (!user->ulb || 100/(l/user->ulb)<n)) && (!user->ulb || 100/((float)l/user->ulb)<n))
result=not; result=not;
else else
result=!not; result=!not;
...@@ -1548,7 +1548,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user) ...@@ -1548,7 +1548,7 @@ static BOOL ar_exp(scfg_t* cfg, uchar **ptrptr, user_t* user)
i=user->dls; i=user->dls;
if(!i) i=1; if(!i) i=1;
if(user->dls>user->uls if(user->dls>user->uls
&& (!user->uls || 100/(i/user->uls)<n)) && (!user->uls || 100/((float)i/user->uls)<n))
result=not; result=not;
else else
result=!not; result=!not;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment