Remove superflous casts and parenthesis.

This commit is contained in:
Markus Armbruster 2006-05-21 12:24:30 +00:00
parent f883710417
commit cd73a47dfa
28 changed files with 136 additions and 145 deletions

View file

@ -99,7 +99,7 @@ do_feed(struct sctstr *sp, struct natstr *np, short *vec,
supply ships in port, or supply units */
int needed;
needed = ldround((double)(1 + etu * people * eatrate), 1);
needed = ldround(1.0 + etu * people * eatrate, 1);
/* Now, find some food */
vec[I_FOOD] = supply_commod(sp->sct_own,

View file

@ -306,26 +306,26 @@ do_mob_ship(struct shpstr *sp, int etus)
/* opt_FUEL in force */
if (mchr[(int)sp->shp_type].m_fuelu == 0) {
value = sp->shp_mobil + ((float)etus * ship_mob_scale);
value = sp->shp_mobil + (float)etus * ship_mob_scale;
if (value > ship_mob_max)
value = ship_mob_max;
sp->shp_mobil = (signed char)value;
} else {
can_add = ship_mob_max - sp->shp_mobil;
if (can_add > ((float)etus * ship_mob_scale))
can_add = ((float)etus * ship_mob_scale);
have_fuel_for = ldround((((double)sp->shp_fuel /
(double)mchr[(int)sp->shp_type].m_fuelu)
* (double)fuel_mult), 1);
if (can_add > (float)etus * ship_mob_scale)
can_add = (float)etus * ship_mob_scale;
have_fuel_for = ldround(((double)sp->shp_fuel /
(double)mchr[(int)sp->shp_type].m_fuelu)
* (double)fuel_mult, 1);
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
d = (double)need;
d *= (double)mchr[(int)sp->shp_type].m_fuelu;
d /= (double)fuel_mult;
d = need;
d *= mchr[(int)sp->shp_type].m_fuelu;
d /= fuel_mult;
d /= 5.0;
if ((d - (int)d) > 0.0)
if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
@ -333,18 +333,18 @@ do_mob_ship(struct shpstr *sp, int etus)
sp->shp_fuel += newfuel * 5;
}
have_fuel_for = ldround((((double)sp->shp_fuel /
(double)mchr[(int)sp->shp_type].m_fuelu)
* (double)fuel_mult), 1);
have_fuel_for = ldround(((double)sp->shp_fuel /
(double)mchr[(int)sp->shp_type].m_fuelu)
* (double)fuel_mult, 1);
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
d = (double)need;
d *= (double)mchr[(int)sp->shp_type].m_fuelu;
d /= (double)fuel_mult;
d = need;
d *= mchr[(int)sp->shp_type].m_fuelu;
d /= fuel_mult;
d /= 50.0;
if ((d - (int)d) > 0.0)
if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
@ -352,17 +352,17 @@ do_mob_ship(struct shpstr *sp, int etus)
sp->shp_fuel += newfuel * 50;
}
have_fuel_for = ldround((((double)sp->shp_fuel /
(double)mchr[(int)sp->shp_type].m_fuelu)
* (double)fuel_mult), 1);
have_fuel_for = ldround(((double)sp->shp_fuel /
(double)mchr[(int)sp->shp_type].m_fuelu)
* (double)fuel_mult, 1);
if (can_add > have_fuel_for)
total_add = have_fuel_for;
else
total_add = can_add;
d = (double)total_add;
d *= (double)mchr[(int)sp->shp_type].m_fuelu;
d /= (double)fuel_mult;
d = total_add;
d *= mchr[(int)sp->shp_type].m_fuelu;
d /= fuel_mult;
sp->shp_fuel -= ldround(d, 1);
sp->shp_fuel = MIN(sp->shp_fuel, mchr[(int)sp->shp_type].m_fuelc);
sp->shp_mobil += total_add;
@ -429,19 +429,19 @@ do_mob_land(struct lndstr *lp, int etus)
can_add = land_mob_max - lp->lnd_mobil;
if (can_add > ((float)etus * land_mob_scale))
can_add = ((float)etus * land_mob_scale);
if (can_add > (float)etus * land_mob_scale)
can_add = (float)etus * land_mob_scale;
have_fuel_for = (lp->lnd_fuel / lp->lnd_fuelu) * fuel_mult;
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
d = (double)need;
d *= (double)lp->lnd_fuelu;
d /= (double)fuel_mult;
d = need;
d *= lp->lnd_fuelu;
d /= fuel_mult;
d /= 5.0;
if ((d - (int)d) > 0.0)
if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(lp->lnd_own, lp->lnd_x, lp->lnd_y,
@ -454,11 +454,11 @@ do_mob_land(struct lndstr *lp, int etus)
if (can_add > have_fuel_for) {
int need;
need = can_add - have_fuel_for;
d = (double)need;
d *= (double)lp->lnd_fuelu;
d /= (double)fuel_mult;
d = need;
d *= lp->lnd_fuelu;
d /= fuel_mult;
d /= 50.0;
if ((d - (int)d) > 0.0)
if (d - (int)d > 0.0)
d++;
need = (int)d;
newfuel = supply_commod(lp->lnd_own, lp->lnd_x, lp->lnd_y,
@ -472,9 +472,9 @@ do_mob_land(struct lndstr *lp, int etus)
total_add = have_fuel_for;
} else
total_add = can_add;
d = (double)total_add;
d *= (double)lp->lnd_fuelu;
d /= (double)fuel_mult;
d = total_add;
d *= lp->lnd_fuelu;
d /= fuel_mult;
lp->lnd_fuel -= ldround(d, 1);
lp->lnd_fuel = MIN(lp->lnd_fuel, lp->lnd_fuelc);
lp->lnd_mobil += total_add;

View file

@ -262,7 +262,7 @@ nav_ship(struct shpstr *sp)
mlp = malloc(sizeof(struct mlist));
mlp->mcp = mchr + sp->shp_type;
mlp->ship = *sp;
mlp->mobil = (double)sp->shp_mobil;
mlp->mobil = sp->shp_mobil;
emp_insque(&mlp->queue, &ship_list);
quit = 1; /* setup loop, we want to check it 1 time. */

View file

@ -212,10 +212,10 @@ auto_fuel_ship(struct shpstr *sp)
if (opt_FUEL == 0)
return;
getship(sp->shp_uid, sp); /* refresh */
/* fill with petro */
/* fill with petrol */
maxfuel = mchr[(int)sp->shp_type].m_fuelc;
d = (double)maxfuel / 5.0;
if ((d - (int)d > 0.0))
d = maxfuel / 5.0;
if (d - (int)d > 0.0)
d++;
need = (int)d;
@ -233,8 +233,8 @@ auto_fuel_ship(struct shpstr *sp)
}
add_fuel = 0;
/* fill with oil */
d = (double)(maxfuel - totalfuel) / 50.0;
if ((d - (int)d > 0.0))
d = (maxfuel - totalfuel) / 50.0;
if (d - (int)d > 0.0)
d++;
need = (int)d;

View file

@ -170,7 +170,7 @@ plague_people(struct natstr *np, short *vec,
plg_num = 100.0 * etus;
plg_denom = (np->nat_level[NAT_RLEV] + 100.0) *
(*ptime + etus + 1.0);
pct_left = 1.0 - (double)(plg_num / plg_denom);
pct_left = 1.0 - plg_num / plg_denom;
if (pct_left < 0.2)
pct_left = 0.2;
vec[I_CIVIL] = vec[I_CIVIL] * pct_left;

View file

@ -95,7 +95,7 @@ populace(struct natstr *np, struct sctstr *sp, int etu)
if (n < 0)
n = 0;
sp->sct_work = n;
if (chance((double)work_red / 1000.0)) {
if (chance(work_red / 1000.0)) {
/*
* small chance of rebellion...
* if work_red is (max) 67,

View file

@ -258,7 +258,7 @@ decay_fallout(struct sctstr *sp, int etus)
if (etus > 24)
etus = 24;
decay = roundavg(((decay_per_etu + 6.0) * fallout_spread) *
decay = roundavg((decay_per_etu + 6.0) * fallout_spread *
(double)etus * (double)sp->sct_fallout);
sp->sct_fallout = decay < sp->sct_fallout ? sp->sct_fallout - decay : 0;

View file

@ -171,8 +171,8 @@ upd_ship(struct shpstr *sp, int etus,
sp->shp_item[I_MILIT],
sp->shp_item[I_UW],
ITEM_MAX)
* (double)sp->shp_effic / 100.0
* (double)sectp->sct_oil / 100.0
* sp->shp_effic / 100.0
* sectp->sct_oil / 100.0
* prod_eff(product, sp->shp_tech));
max_oil = mp->m_item[I_OIL];
if (sp->shp_item[I_OIL] + oil_gained > max_oil)