(comm_bomb): Compute damage percentage in double rather than float,

because all its uses convert it to double.
This commit is contained in:
Markus Armbruster 2006-05-06 08:41:01 +00:00
parent f819e7ac85
commit 276cbc54d2

View file

@ -395,7 +395,7 @@ static void
comm_bomb(struct emp_qelem *list, struct sctstr *target) comm_bomb(struct emp_qelem *list, struct sctstr *target)
{ {
struct plist *plp; struct plist *plp;
float b; double b;
int i; int i;
int amt, before; int amt, before;
struct ichrstr *ip; struct ichrstr *ip;
@ -449,10 +449,10 @@ comm_bomb(struct emp_qelem *list, struct sctstr *target)
return; return;
getsect(target->sct_x, target->sct_y, &sect); getsect(target->sct_x, target->sct_y, &sect);
target = § target = §
before = amt = target->sct_item[ip->i_uid]; before = target->sct_item[ip->i_uid];
target->sct_item[ip->i_uid] = amt = commdamage(amt, dam, ip->i_uid); target->sct_item[ip->i_uid] = amt = commdamage(before, dam, ip->i_uid);
if (before > 0.0) if (before > 0.0)
b = 100.0 * (1.0 - ((float)amt / (float)before)); b = 100.0 * (1.0 - (double)amt / (double)before);
else else
b = 0.0; b = 0.0;
pr("did %.2f%% damage to %s in %s\n", pr("did %.2f%% damage to %s in %s\n",