diff --git a/src/lib/commands/coll.c b/src/lib/commands/coll.c index 854eb7d7..e6439d76 100644 --- a/src/lib/commands/coll.c +++ b/src/lib/commands/coll.c @@ -99,7 +99,7 @@ coll(void) xyas(x, y, player->cnum), cname(loan.l_lonee)); return RET_FAIL; } - pay = dchr[sect.sct_type].d_value * ((float)sect.sct_effic + 100.0); + pay = dchr[sect.sct_type].d_value * (sect.sct_effic + 100.0); for (i = 0; ichr[i].i_name; i++) { if (ichr[i].i_value == 0 || ichr[i].i_uid == I_NONE) continue; diff --git a/src/lib/commands/enli.c b/src/lib/commands/enli.c index ca3a73a4..2f38c635 100644 --- a/src/lib/commands/enli.c +++ b/src/lib/commands/enli.c @@ -135,7 +135,7 @@ enli(void) natp->nat_reserve -= totalmil; putnat(natp); } - if ((player->btused += roundavg((float)totalmil * 0.02)) > 0) + if ((player->btused += roundavg(totalmil * 0.02)) > 0) pr("Paperwork at recruiting stations ... %d\n", player->btused); return RET_OK; } diff --git a/src/lib/commands/fuel.c b/src/lib/commands/fuel.c index 1917e1dc..43c22698 100644 --- a/src/lib/commands/fuel.c +++ b/src/lib/commands/fuel.c @@ -179,7 +179,7 @@ fuel(void) fueled = 1; if ((pet_amt * 5) >= move_amt) { - extra = ((float)move_amt / 5.0) - (move_amt / 5); + extra = move_amt / 5.0 - move_amt / 5; if (extra > 0.0) sect.sct_item[I_PETROL] = MAX((pet_amt - move_amt / 5) - 1, 0); @@ -189,7 +189,7 @@ fuel(void) } else { sect.sct_item[I_PETROL] = 0; move_amt -= pet_amt * 5; - extra = ((float)move_amt / 50.0) - (move_amt / 50); + extra = move_amt / 50.0 - move_amt / 50; sect.sct_item[I_OIL] = MAX(oil_amt - move_amt / 50, 0); if (extra > 0.0) sect.sct_item[I_OIL] @@ -255,7 +255,7 @@ fuel(void) fueled = 1; if ((pet_amt * 5) >= move_amt) { - extra = ((float)move_amt / 5.0) - (move_amt / 5); + extra = move_amt / 5.0 - move_amt / 5; if (extra > 0.0) item2.ship.shp_item[I_PETROL] = MAX((pet_amt - move_amt / 5) - 1, 0); @@ -265,7 +265,7 @@ fuel(void) } else { item2.ship.shp_item[I_PETROL] = 0; move_amt -= pet_amt * 5; - extra = ((float)move_amt / 50.0) - (move_amt / 50); + extra = move_amt / 50.0 - move_amt / 50; item2.ship.shp_item[I_OIL] = MAX(oil_amt - (move_amt / 50), 0); if (extra > 0.0) @@ -340,7 +340,7 @@ fuel(void) fueled = 1; if ((pet_amt * 5) >= move_amt) { - extra = ((float)move_amt / 5.0) - (move_amt / 5); + extra = move_amt / 5.0 - move_amt / 5; if (extra > 0.0) sect.sct_item[I_PETROL] = MAX((pet_amt - move_amt / 5) - 1, 0); @@ -350,7 +350,7 @@ fuel(void) } else { sect.sct_item[I_PETROL] = 0; move_amt -= pet_amt * 5; - extra = ((float)move_amt / 50.0) - (move_amt / 50); + extra = move_amt / 50.0 - move_amt / 50; sect.sct_item[I_OIL] = MAX(oil_amt - move_amt / 50, 0); if (extra > 0.0) sect.sct_item[I_OIL] @@ -417,7 +417,7 @@ fuel(void) fueled = 1; if ((pet_amt * 5) >= move_amt) { - extra = ((float)move_amt / 5.0) - (move_amt / 5); + extra = move_amt / 5.0 - move_amt / 5; if (extra > 0.0) item2.land.lnd_item[I_PETROL] = MAX((pet_amt - move_amt / 5) - 1, 0); @@ -427,7 +427,7 @@ fuel(void) } else { item2.land.lnd_item[I_PETROL] = 0; move_amt -= pet_amt * 5; - extra = ((float)move_amt / 50.0) - (move_amt / 50); + extra = move_amt / 50.0 - move_amt / 50; item2.land.lnd_item[I_OIL] = MAX(oil_amt - move_amt / 50, 0); if (extra > 0.0) diff --git a/src/lib/commands/payo.c b/src/lib/commands/payo.c index bf735bfa..c8ee9225 100644 --- a/src/lib/commands/payo.c +++ b/src/lib/commands/payo.c @@ -99,14 +99,14 @@ payo(void) if (dist < trade_1_dist) cash = 0; else if (dist < trade_2_dist) - cash = (1.0 + trade_1 * ((float)dist)); + cash = 1.0 + trade_1 * dist; else if (dist < trade_3_dist) - cash = (1.0 + trade_2 * ((float)dist)); + cash = 1.0 + trade_2 * dist; else - cash = (1.0 + trade_3 * ((float)dist)); + cash = 1.0 + trade_3 * dist; cash *= mp->m_cost; - cash *= (((float)ship.shp_effic) / 100.0); + cash *= ship.shp_effic / 100.0; if (sect.sct_own && (sect.sct_own != ship.shp_own)) cash *= (1.0 + trade_ally_bonus); diff --git a/src/lib/commands/scra.c b/src/lib/commands/scra.c index 9cdba96d..ca0aed71 100644 --- a/src/lib/commands/scra.c +++ b/src/lib/commands/scra.c @@ -171,7 +171,7 @@ scra(void) continue; } if (type == EF_SHIP) { - eff = ((float)item.ship.shp_effic / 100.0); + eff = item.ship.shp_effic / 100.0; mp = &mchr[(int)item.ship.shp_type]; if (opt_TRADESHIPS) { if (mp->m_flags & M_TRADE) { @@ -249,7 +249,7 @@ scra(void) item.ship.shp_own = 0; putship(item.ship.shp_uid, &item.ship); } else if (type == EF_LAND) { - eff = ((float)item.land.lnd_effic / 100.0); + eff = item.land.lnd_effic / 100.0; lp = &lchr[(int)item.land.lnd_type]; pr("%s", prland(&item.land)); for (i = I_NONE + 1; i <= I_MAX; i++) { @@ -317,7 +317,7 @@ scra(void) item.land.lnd_own = 0; putland(item.land.lnd_uid, &item.land); } else { - eff = ((float)item.land.lnd_effic / 100.0); + eff = item.land.lnd_effic / 100.0; pp = &plchr[(int)item.plane.pln_type]; pr("%s", prplane(&item.plane)); sect.sct_item[I_LCM] += pp->pl_lcm * 2 / 3 * eff; diff --git a/src/lib/commands/scut.c b/src/lib/commands/scut.c index f84d9703..6e1bc780 100644 --- a/src/lib/commands/scut.c +++ b/src/lib/commands/scut.c @@ -204,13 +204,13 @@ scuttle_tradeship(struct shpstr *sp, int interactive) if (dist < trade_1_dist) cash = 0; else if (dist < trade_2_dist) - cash = (1.0 + trade_1 * ((float)dist)); + cash = 1.0 + trade_1 * dist; else if (dist < trade_3_dist) - cash = (1.0 + trade_2 * ((float)dist)); + cash = 1.0 + trade_2 * dist; else - cash = (1.0 + trade_3 * ((float)dist)); + cash = 1.0 + trade_3 * dist; cash *= mp->m_cost; - cash *= (((float)sp->shp_effic) / 100.0); + cash *= sp->shp_effic / 100.0; if (sect.sct_own != sp->shp_own) { ally_cash = cash * trade_ally_cut; diff --git a/src/lib/commands/sona.c b/src/lib/commands/sona.c index e4648b47..8691ad5b 100644 --- a/src/lib/commands/sona.c +++ b/src/lib/commands/sona.c @@ -265,7 +265,7 @@ plane_sona(struct emp_qelem *plane_list, int x, int y, pln_identchance(pp, shp_hardtarget(targ), EF_SHIP)) continue; pingrange = MAX(targ->shp_visib, 10) * range / 10; - vrange = ((float)pingrange) * ((float)pp->pln_effic / 200.0); + vrange = pingrange * (pp->pln_effic / 200.0); dist = mapdist(targ->shp_x, targ->shp_y, x, y); pingrange = (MAX(pingrange, 2) * targ->shp_effic); pingrange = roundavg(pingrange / 100.0); diff --git a/src/lib/subs/aircombat.c b/src/lib/subs/aircombat.c index e8235201..8b3f8e2e 100644 --- a/src/lib/subs/aircombat.c +++ b/src/lib/subs/aircombat.c @@ -625,8 +625,8 @@ ac_dog(struct plist *ap, struct plist *dp) att -= 2; if ((dp->pcp->pl_flags & P_F) && dp->bombs != 0) def -= 2; - att += ((float)ap->pcp->pl_stealth / 25.0); - def += ((float)dp->pcp->pl_stealth / 25.0); + att += ap->pcp->pl_stealth / 25.0; + def += dp->pcp->pl_stealth / 25.0; if (att < 1) { def += 1 - att; att = 1; @@ -1073,7 +1073,7 @@ getilist(struct emp_qelem *list, natid own, struct emp_qelem *a, && (pcp->pl_flags & P_V) == 0) continue; } - if ((float)petrol < (float)pcp->pl_fuel / 2.0) + if (petrol <= pcp->pl_fuel / 2) continue; /* Finally, is it in the list of planes already in flight? */ @@ -1160,13 +1160,13 @@ do_evade(struct emp_qelem *bomb_list, struct emp_qelem *esc_list) evade = 100.0; for (qp = bomb_list->q_forw; qp != bomb_list; qp = qp->q_forw) { plp = (struct plist *)qp; - if (evade > ((float)plp->pcp->pl_stealth / 100.0)) - evade = (plp->pcp->pl_stealth / 100.0); + if (evade > plp->pcp->pl_stealth / 100.0) + evade = plp->pcp->pl_stealth / 100.0; } for (qp = esc_list->q_forw; qp != esc_list; qp = qp->q_forw) { plp = (struct plist *)qp; if (evade > plp->pcp->pl_stealth / 100.0) - evade = (plp->pcp->pl_stealth / 100.0); + evade = plp->pcp->pl_stealth / 100.0; } if (chance(evade)) diff --git a/src/lib/subs/attsub.c b/src/lib/subs/attsub.c index b2c00340..5432c429 100644 --- a/src/lib/subs/attsub.c +++ b/src/lib/subs/attsub.c @@ -1493,7 +1493,7 @@ att_reacting_units(struct combat *def, struct emp_qelem *list, int a_spy, dtotal = 0; snxtitem_all(&ni, EF_LAND); while (nxtitem(&ni, &land) && - (dtotal + new_land * eff < (int)(1.2 * (float)ototal))) { + (dtotal + new_land * eff < (int)(1.2 * ototal))) { if (!land.lnd_own) continue; if (!land.lnd_rad_max) diff --git a/src/lib/subs/lndsub.c b/src/lib/subs/lndsub.c index 60fa0dfd..c55943ce 100644 --- a/src/lib/subs/lndsub.c +++ b/src/lib/subs/lndsub.c @@ -1383,7 +1383,7 @@ lnd_fortify (struct lndstr *lp, int hard_amt) eng = has_helpful_engineer(lp->lnd_x, lp->lnd_y, lp->lnd_own); if (eng) - hard_amt = ((float)hard_amt * 1.5); + hard_amt *= 1.5; if ((lp->lnd_harden + hard_amt) > land_mob_max) hard_amt = land_mob_max - lp->lnd_harden; @@ -1394,7 +1394,7 @@ lnd_fortify (struct lndstr *lp, int hard_amt) /* Now, if an engineer helped, it's really only 2/3rds of that */ if (eng) - mob_used = (int)((float)mob_used / 1.5); + mob_used /= 1.5; /* If we increased it, but not much, we gotta take at least 1 mob point. */ diff --git a/src/lib/subs/plnsub.c b/src/lib/subs/plnsub.c index d6a6cb24..c6423ac1 100644 --- a/src/lib/subs/plnsub.c +++ b/src/lib/subs/plnsub.c @@ -1146,7 +1146,7 @@ pln_hitchance(struct plnstr *pp, int hardtarget, int type) acc += 35; } hitchance = (int)(pp->pln_effic * (1.0 - 0.1 * tfact) * - (1.0 - (float)acc / 100.0)) - hardtarget; + (1.0 - acc / 100.0)) - hardtarget; /* smooth out the bottom of the graph with asymtote at 5 -KHS */ if (hitchance < 20) diff --git a/src/lib/update/land.c b/src/lib/update/land.c index fe2b2ef9..194e7462 100644 --- a/src/lib/update/land.c +++ b/src/lib/update/land.c @@ -276,7 +276,7 @@ landrepair(struct lndstr *land, struct natstr *np, if (left > delta) left = delta; - leftp = ((float)left / 100.0); + leftp = left / 100.0; memset(mvec, 0, sizeof(mvec)); mvec[I_LCM] = lcm_needed = ldround(lp->l_lcm * leftp, 1); diff --git a/src/lib/update/plane.c b/src/lib/update/plane.c index 8aa20f13..3b936003 100644 --- a/src/lib/update/plane.c +++ b/src/lib/update/plane.c @@ -191,7 +191,7 @@ prod_plane(int etus, int natnum, int *bp, int buildem) if (left > delta) left = delta; - leftp = ((float)left / 100.0); + leftp = left / 100.0; memset(mvec, 0, sizeof(mvec)); mvec[I_MILIT] = mil_needed = ldround(plp->pl_crew * leftp, 1); mvec[I_LCM] = lcm_needed = ldround(plp->pl_lcm * leftp, 1); diff --git a/src/lib/update/ship.c b/src/lib/update/ship.c index 80cb5aab..7de8ed8a 100644 --- a/src/lib/update/ship.c +++ b/src/lib/update/ship.c @@ -345,7 +345,7 @@ shiprepair(struct shpstr *ship, struct natstr *np, if (left > delta) left = delta; - leftp = ((float)left / 100.0); + leftp = left / 100.0; memset(mvec, 0, sizeof(mvec)); mvec[I_LCM] = lcm_needed = ldround(mp->m_lcm * leftp, 1); mvec[I_HCM] = hcm_needed = ldround(mp->m_hcm * leftp, 1);