Unbreak percentage display in /map.
This now uses integer arithmetic instead of floating point.
This commit is contained in:
parent
72b8a371c5
commit
d76c16d49f
|
@ -87,7 +87,7 @@ mo_map(struct Client *client_p, struct Client *source_p, int parc, const char *p
|
||||||
static void
|
static void
|
||||||
dump_map(struct Client *client_p, struct Client *root_p, char *pbuf)
|
dump_map(struct Client *client_p, struct Client *root_p, char *pbuf)
|
||||||
{
|
{
|
||||||
int cnt = 0, i = 0, len;
|
int cnt = 0, i = 0, len, frac;
|
||||||
struct Client *server_p;
|
struct Client *server_p;
|
||||||
rb_dlink_node *ptr;
|
rb_dlink_node *ptr;
|
||||||
*pbuf = '\0';
|
*pbuf = '\0';
|
||||||
|
@ -110,9 +110,10 @@ dump_map(struct Client *client_p, struct Client *root_p, char *pbuf)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
frac = (1000 * rb_dlink_list_length(&root_p->serv->users) + Count.total / 2) / Count.total;
|
||||||
rb_snprintf(buf + USER_COL, BUFSIZE - USER_COL,
|
rb_snprintf(buf + USER_COL, BUFSIZE - USER_COL,
|
||||||
" | Users: %5lu (%4.1f%%)", rb_dlink_list_length(&root_p->serv->users),
|
" | Users: %5lu (%2d.%1d%%)", rb_dlink_list_length(&root_p->serv->users),
|
||||||
100 * (float) rb_dlink_list_length(&root_p->serv->users) / (float) Count.total);
|
frac / 10, frac % 10);
|
||||||
|
|
||||||
sendto_one_numeric(client_p, RPL_MAP, form_str(RPL_MAP), buf);
|
sendto_one_numeric(client_p, RPL_MAP, form_str(RPL_MAP), buf);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue