Remove redundant casts of argument to (prototyped) double parameter.

This commit is contained in:
Markus Armbruster 2006-05-01 12:34:16 +00:00
parent 7c3899bf89
commit 7ed308526c
19 changed files with 82 additions and 93 deletions

View file

@ -142,27 +142,27 @@ struct lchrstr {
#define L_TRAIN bit(11) /* train unit - neato */ #define L_TRAIN bit(11) /* train unit - neato */
#define L_HEAVY bit(12) /* heavy unit - can't go on trains */ #define L_HEAVY bit(12) /* heavy unit - can't go on trains */
#define LND_ATTDEF(b, t) (((b) * (1.0 + ((sqrt((double)(t)) / 100.0) * 4.0))) \ #define LND_ATTDEF(b, t) (((b) * (1.0 + ((sqrt((t)) / 100.0) * 4.0))) \
> 127 ? 127 : \ > 127 ? 127 : \
((b) * (1.0 + ((sqrt((double)(t)) / 100.0) * 4.0)))) ((b) * (1.0 + ((sqrt((t)) / 100.0) * 4.0))))
#define LND_SPD(b, t) ((b * (1.0 + ((sqrt((double)t) / 100.0) * 2.1))) > 127\ #define LND_SPD(b, t) ((b * (1.0 + ((sqrt(t) / 100.0) * 2.1))) > 127 \
? 127 : (b * (1.0 + ((sqrt((double)t) / 100.0) * 2.1)))) ? 127 : (b * (1.0 + ((sqrt(t) / 100.0) * 2.1))))
#define LND_VUL(b, t) ((b * (1.0 - ((sqrt((double)t) / 100.0) * 1.1))) < 0\ #define LND_VUL(b, t) ((b * (1.0 - ((sqrt(t) / 100.0) * 1.1))) < 0 \
? 0 : (b * (1.0 - ((sqrt((double)t) / 100.0) * 1.1)))) ? 0 : (b * (1.0 - ((sqrt(t) / 100.0) * 1.1))))
#define LND_VIS(b, t) (b) #define LND_VIS(b, t) (b)
#define LND_SPY(b, t) (b) #define LND_SPY(b, t) (b)
#define LND_RAD(b, t) (b) #define LND_RAD(b, t) (b)
#define LND_FRG(b, t) ((t) ? \ #define LND_FRG(b, t) ((t) ? \
((b) * (logx((double)(t), (double)35.0) < 1.0 ? 1.0 : \ ((b) * (logx((t), 35.0) < 1.0 ? 1.0 : \
logx((double)(t), (double)35.0))) : (b)) logx((t), 35.0))) : (b))
#define LND_DAM(b, t) ((t) ? \ #define LND_DAM(b, t) ((t) ? \
((b) * (logx((double)(t), (double)60.0) < 1.0 ? 1.0 : \ ((b) * (logx((t), 60.0) < 1.0 ? 1.0 : \
logx((double)(t), (double)60.0))) : (b)) logx((t), 60.0))) : (b))
#define LND_ACC(b, t) ((b * (1.0 - ((sqrt((double)t) / 100.0) * 1.1))) < 0\ #define LND_ACC(b, t) ((b * (1.0 - ((sqrt(t) / 100.0) * 1.1))) < 0 \
? 0 : (b * (1.0 - ((sqrt((double)t) / 100.0) * 1.1)))) ? 0 : (b * (1.0 - ((sqrt(t) / 100.0) * 1.1))))
#define LND_AMM(b, d, t) ((b) ? ((LND_DAM((d), (t)) / 2) + 1) : 0) #define LND_AMM(b, d, t) ((b) ? ((LND_DAM((d), (t)) / 2) + 1) : 0)
#define LND_AAF(b, t) ((b * (1.0 + ((sqrt((double)t) / 100.0) * 3.0))) > 127\ #define LND_AAF(b, t) ((b * (1.0 + ((sqrt(t) / 100.0) * 3.0))) > 127 \
? 127 : (b * (1.0 + ((sqrt((double)t) / 100.0) * 3.0)))) ? 127 : (b * (1.0 + ((sqrt(t) / 100.0) * 3.0))))
#define LND_FC(b, t) (b) #define LND_FC(b, t) (b)
#define LND_FU(b, t) (b) #define LND_FU(b, t) (b)
#define LND_XPL(b, t) (b) #define LND_XPL(b, t) (b)

View file

@ -149,10 +149,10 @@ struct shiplist {
}; };
#define PLN_ATTDEF(b, t) (b + ((b?1:0) * ((t/20)>10?10:(t/20)))) #define PLN_ATTDEF(b, t) (b + ((b?1:0) * ((t/20)>10?10:(t/20))))
#define PLN_ACC(b, t) (b * (1.0 - (sqrt((double)t) / 50.))) #define PLN_ACC(b, t) (b * (1.0 - (sqrt(t) / 50.)))
#define PLN_RAN(b, t) (t ? (b + (logx((double)t, (double)2.0))) : b) #define PLN_RAN(b, t) (t ? (b + (logx(t, 2.0))) : b)
#define PLN_LOAD(b, t) (t ? (b * (logx((double)t, (double)50.0) < 1.0 ? 1.0 : \ #define PLN_LOAD(b, t) (t ? (b * (logx(t, 50.0) < 1.0 ? 1.0 : \
logx((double)t, (double)50.0))) : b) logx(t, 50.0))) : b)
/* Work required for building 100% */ /* Work required for building 100% */
#define PLN_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm)) #define PLN_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm))

View file

@ -191,15 +191,15 @@ struct mlist {
double mobil; /* how much mobility the ship has left */ double mobil; /* how much mobility the ship has left */
}; };
#define SHP_DEF(b, t) (t ? (b * (logx((double)t, (double)40.0) < 1.0 ? 1.0 : \ #define SHP_DEF(b, t) (t ? (b * (logx(t, 40.0) < 1.0 ? 1.0 : \
logx((double)t, (double)40.0))) : b) logx(t, 40.0))) : b)
#define SHP_SPD(b, t) (t ? (b * (logx((double)t, (double)35.0) < 1.0 ? 1.0 : \ #define SHP_SPD(b, t) (t ? (b * (logx(t, 35.0) < 1.0 ? 1.0 : \
logx((double)t, (double)35.0))) : b) logx(t, 35.0))) : b)
#define SHP_VIS(b, t) (b * (1 - (sqrt((double)t) / 50))) #define SHP_VIS(b, t) (b * (1 - (sqrt(t) / 50)))
#define SHP_RNG(b, t) (t ? (b * (logx((double)t, (double)35.0) < 1.0 ? 1.0 : \ #define SHP_RNG(b, t) (t ? (b * (logx(t, 35.0) < 1.0 ? 1.0 : \
logx((double)t, (double)35.0))) : b) logx(t, 35.0))) : b)
#define SHP_FIR(b, t) (t ? (b * (logx((double)t, (double)60.0) < 1.0 ? 1.0 : \ #define SHP_FIR(b, t) (t ? (b * (logx(t, 60.0) < 1.0 ? 1.0 : \
logx((double)t, (double)60.0))) : b) logx(t, 60.0))) : b)
/* Work required for building 100% */ /* Work required for building 100% */
#define SHP_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm)) #define SHP_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm))

View file

@ -550,7 +550,7 @@ ship_bomb(struct emp_qelem *list, struct sctstr *target)
} }
mcp = &mchr[(int)ship.shp_type]; mcp = &mchr[(int)ship.shp_type];
if (gun > 0 && shell > 0 && !(mcp->m_flags & M_SUB)) { if (gun > 0 && shell > 0 && !(mcp->m_flags & M_SUB)) {
flak = (int)(techfact(ship.shp_tech, (double)gun) * 2.0); flak = (int)(techfact(ship.shp_tech, gun) * 2.0);
ship.shp_item[I_SHELL] = shell; ship.shp_item[I_SHELL] = shell;
putship(ship.shp_uid, &ship); putship(ship.shp_uid, &ship);
PR(ship.shp_own, "Flak! Firing %d guns from ship %s\n", PR(ship.shp_own, "Flak! Firing %d guns from ship %s\n",
@ -775,7 +775,7 @@ land_bomb(struct emp_qelem *list, struct sctstr *target)
if (unitno < 0) if (unitno < 0)
continue; continue;
flak = (int)(techfact(land.lnd_tech, (double)land.lnd_aaf) * 3.0); flak = (int)(techfact(land.lnd_tech, land.lnd_aaf) * 3.0);
if (flak) { if (flak) {
PR(land.lnd_own, PR(land.lnd_own,
"Flak! Firing flak guns from unit %s (aa rating %d)\n", "Flak! Firing flak guns from unit %s (aa rating %d)\n",

View file

@ -127,7 +127,7 @@ look_ship(struct shpstr *lookship)
int dist; int dist;
range = (int)techfact(lookship->shp_tech, range = (int)techfact(lookship->shp_tech,
(double)mchr[(int)lookship->shp_type].m_vrnge); mchr[(int)lookship->shp_type].m_vrnge);
range = range * (lookship->shp_effic / 100.0); range = range * (lookship->shp_effic / 100.0);
smcp = &mchr[(int)lookship->shp_type]; smcp = &mchr[(int)lookship->shp_type];
if (smcp->m_flags & M_SUB) if (smcp->m_flags & M_SUB)
@ -259,7 +259,7 @@ look_land(struct lndstr *lookland)
int i; int i;
int dist; int dist;
drange = techfact(lookland->lnd_tech, (double)lookland->lnd_spy); drange = techfact(lookland->lnd_tech, lookland->lnd_spy);
drange = (drange * ((double)lookland->lnd_effic / 100.0)); drange = (drange * ((double)lookland->lnd_effic / 100.0));
range = ldround(drange, 1); range = ldround(drange, 1);
@ -280,7 +280,7 @@ look_land(struct lndstr *lookland)
if (!(chance(LND_SPY_DETECT_CHANCE(lp->lnd_effic)))) if (!(chance(LND_SPY_DETECT_CHANCE(lp->lnd_effic))))
continue; continue;
} }
vrange = ldround((double)((lp->lnd_vis * range) / 20.0), 1); vrange = ldround((lp->lnd_vis * range) / 20.0, 1);
dist = mapdist(lp->lnd_x, lp->lnd_y, dist = mapdist(lp->lnd_x, lp->lnd_y,
lookland->lnd_x, lookland->lnd_y); lookland->lnd_x, lookland->lnd_y);
if (dist > vrange) if (dist > vrange)
@ -288,7 +288,7 @@ look_land(struct lndstr *lookland)
pr("%s (#%d) %s (approx %d mil) @ %s\n", pr("%s (#%d) %s (approx %d mil) @ %s\n",
cname(lp->lnd_own), lp->lnd_own, cname(lp->lnd_own), lp->lnd_own,
prland(lp), ldround((double)total_mil(lp), 20), prland(lp), ldround(total_mil(lp), 20),
xyas(lp->lnd_x, lp->lnd_y, player->cnum)); xyas(lp->lnd_x, lp->lnd_y, player->cnum));
if (opt_HIDDEN) if (opt_HIDDEN)
setcont(player->cnum, lp->lnd_own, FOUND_LOOK); setcont(player->cnum, lp->lnd_own, FOUND_LOOK);
@ -300,7 +300,7 @@ look_land(struct lndstr *lookland)
continue; continue;
if (pp->pln_flags & PLN_LAUNCHED) if (pp->pln_flags & PLN_LAUNCHED)
continue; continue;
vrange = ldround((double)((10 * range) / 20.0), 1); vrange = ldround((10 * range) / 20.0, 1);
dist = mapdist(pp->pln_x, pp->pln_y, dist = mapdist(pp->pln_x, pp->pln_y,
lookland->lnd_x, lookland->lnd_y); lookland->lnd_x, lookland->lnd_y);
if (dist > vrange) if (dist > vrange)

View file

@ -803,9 +803,8 @@ quiet_bigdef(int attacker, struct emp_qelem *list, natid own, natid aown,
if (ship.shp_mobil <= 0) if (ship.shp_mobil <= 0)
continue; continue;
*/ */
erange = ship.shp_effic * erange = ship.shp_effic
techfact(ship.shp_tech, ((double)ship.shp_frnge)) * techfact(ship.shp_tech, ship.shp_frnge) / 100.0;
/ 100.0;
erange = (double)roundrange(erange); erange = (double)roundrange(erange);
range = mapdist(ship.shp_x, ship.shp_y, ax, ay); range = mapdist(ship.shp_x, ship.shp_y, ax, ay);
if (range > erange) if (range > erange)

View file

@ -131,9 +131,9 @@ navi(void)
} }
radmapnopr(shp->shp_x, shp->shp_y, (int)shp->shp_effic, radmapnopr(shp->shp_x, shp->shp_y, (int)shp->shp_effic,
(int)techfact(shp->shp_tech, (int)techfact(shp->shp_tech,
(double)mchr[(int)shp->shp_type].m_vrnge), mchr[(int)shp->shp_type].m_vrnge),
(double)((mchr[(int)shp->shp_type].m_flags & M_SONAR) (mchr[(int)shp->shp_type].m_flags & M_SONAR)
? techfact(shp->shp_tech, 1.0) : 0.0)); ? techfact(shp->shp_tech, 1.0) : 0.0);
if (cp == 0 || *cp == '\0') if (cp == 0 || *cp == '\0')
cp = &dirch[DIR_STOP]; cp = &dirch[DIR_STOP];
if (*cp == 'M' || if (*cp == 'M' ||

View file

@ -132,7 +132,7 @@ rada(void)
} }
tf = 0.0; tf = 0.0;
pr("%s at ", prland(&land)); pr("%s at ", prland(&land));
tech = techfact(land.lnd_tech, (double)land.lnd_spy); tech = techfact(land.lnd_tech, land.lnd_spy);
if (tech > ((double)WORLD_Y / 2.0)) if (tech > ((double)WORLD_Y / 2.0))
tech = ((double)WORLD_Y / 2.0); tech = ((double)WORLD_Y / 2.0);
if (tech > ((double)WORLD_X / 4.0)) if (tech > ((double)WORLD_X / 4.0))

View file

@ -115,7 +115,7 @@ sona(void)
getsect(ship.shp_x, ship.shp_y, &sect); getsect(ship.shp_x, ship.shp_y, &sect);
if (sect.sct_type != SCT_WATER) if (sect.sct_type != SCT_WATER)
continue; continue;
range = (int)techfact(ship.shp_tech, (double)mcp->m_vrnge); range = (int)techfact(ship.shp_tech, mcp->m_vrnge);
srange = MIN(7, 7 * range * ship.shp_effic / 200); srange = MIN(7, 7 * range * ship.shp_effic / 200);
pr("%s at %s efficiency %d%%, max range %d\n", pr("%s at %s efficiency %d%%, max range %d\n",
prship(&ship), prship(&ship),
@ -248,9 +248,7 @@ plane_sona(struct emp_qelem *plane_list, int x, int y,
pcp = ip->pcp; pcp = ip->pcp;
if (!(pcp->pl_flags & P_A)) /* if it isn't an ASW plane */ if (!(pcp->pl_flags & P_A)) /* if it isn't an ASW plane */
continue; continue;
range = range = (int)techfact(pp->pln_tech, (100 - pp->pln_acc) / 10);
(int)techfact(pp->pln_tech,
(double)((100 - pp->pln_acc) / 10));
/* /*
for (i=0; targ = getshipp(i); i++) { for (i=0; targ = getshipp(i); i++) {
*/ */

View file

@ -165,7 +165,7 @@ torp(void)
continue; continue;
} }
erange = ((double)sub.shp_effic / 100.0) * erange = ((double)sub.shp_effic / 100.0) *
techfact(sub.shp_tech, ((double)sub.shp_frnge)); techfact(sub.shp_tech, sub.shp_frnge);
erange = (double)roundrange(erange); erange = (double)roundrange(erange);
pr("Effective torpedo range is %.1f\n", erange); pr("Effective torpedo range is %.1f\n", erange);
shells -= SHP_TORP_SHELLS; shells -= SHP_TORP_SHELLS;
@ -263,7 +263,7 @@ anti_torp(int f, int ntorping, int vshipown)
if (!canshoot(&dd, &sub)) if (!canshoot(&dd, &sub))
continue; continue;
erange = techfact(dd.shp_tech, ((double)dd.shp_frnge)) / 2.0; erange = techfact(dd.shp_tech, dd.shp_frnge) / 2.0;
erange = (double)roundrange(erange); erange = (double)roundrange(erange);

View file

@ -245,7 +245,7 @@ tran_plane(void)
return RET_FAIL; return RET_FAIL;
} }
dam = 1; dam = 1;
mcost = move_ground(&sect, &endsect, (double)weight, mcost = move_ground(&sect, &endsect, weight,
player->argp[3], tran_map, 0, &dam); player->argp[3], tran_map, 0, &dam);
dam /= count; dam /= count;
if (mcost < 0) if (mcost < 0)

View file

@ -845,7 +845,7 @@ ac_shipflak(struct emp_qelem *list, coord x, coord y)
} }
if (gun == 0 || shell == 0) if (gun == 0 || shell == 0)
continue; continue;
firing = (int)(techfact(ship.shp_tech, (double)gun) * 2.0); firing = (int)(techfact(ship.shp_tech, gun) * 2.0);
guns += firing; guns += firing;
if (!nats[ship.shp_own]) { if (!nats[ship.shp_own]) {
@ -863,7 +863,7 @@ ac_shipflak(struct emp_qelem *list, coord x, coord y)
if (guns > 0) { if (guns > 0) {
if (guns > 14) if (guns > 14)
guns = 14; guns = 14;
guns = 2.0 * tfact(from, (double)guns); guns = 2.0 * tfact(from, guns);
PR(plane_owner, "Flak! Ships firing %d flak guns...\n", guns); PR(plane_owner, "Flak! Ships firing %d flak guns...\n", guns);
ac_fireflak(list, from, 0, guns); ac_fireflak(list, from, 0, guns);
} }
@ -908,8 +908,7 @@ ac_landflak(struct emp_qelem *list, coord x, coord y)
rel = getrel(getnatp(land.lnd_own), plane_owner); rel = getrel(getnatp(land.lnd_own), plane_owner);
if (rel > HOSTILE) if (rel > HOSTILE)
continue; continue;
firing = firing = (int)(techfact(land.lnd_tech, land.lnd_aaf) * 3.0);
(int)(techfact(land.lnd_tech, (double)land.lnd_aaf) * 3.0);
guns += firing; guns += firing;
if (!nats[land.lnd_own]) { if (!nats[land.lnd_own]) {
@ -928,7 +927,7 @@ ac_landflak(struct emp_qelem *list, coord x, coord y)
if (guns > 0) { if (guns > 0) {
if (guns > 14) if (guns > 14)
guns = 14; guns = 14;
guns = 2.0 * tfact(from, (double)guns); guns = 2.0 * tfact(from, guns);
PR(plane_owner, "Flak! Land units firing %d flak guns...\n", PR(plane_owner, "Flak! Land units firing %d flak guns...\n",
guns); guns);
ac_fireflak(list, from, 0, guns); ac_fireflak(list, from, 0, guns);

View file

@ -940,7 +940,7 @@ lnd_fort_interdiction(struct emp_qelem *list,
gun = fsect.sct_item[I_GUN]; gun = fsect.sct_item[I_GUN];
if (gun < 1) if (gun < 1)
continue; continue;
range = tfactfire(fsect.sct_own, (double)MIN(gun, 7)); range = tfactfire(fsect.sct_own, MIN(gun, 7));
if (fsect.sct_effic > 59) if (fsect.sct_effic > 59)
range++; range++;
range2 = roundrange(range); range2 = roundrange(range);

View file

@ -531,7 +531,7 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
continue; continue;
if (!(mcp->m_flags & M_DCH) && !(mcp->m_flags & M_SUBT)) if (!(mcp->m_flags & M_DCH) && !(mcp->m_flags & M_SUBT))
continue; continue;
range2 = techfact(sp->shp_tech, (double)mcp->m_vrnge); range2 = techfact(sp->shp_tech, mcp->m_vrnge);
range2 *= (double)sp->shp_effic / 200.0; range2 *= (double)sp->shp_effic / 200.0;
if (md > range2) if (md > range2)
continue; continue;
@ -557,9 +557,8 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list,
if (shell < SHP_TORP_SHELLS) if (shell < SHP_TORP_SHELLS)
continue; continue;
range = sp->shp_effic * techfact(sp->shp_tech, range = sp->shp_effic
((double)sp->shp_frnge)) / * techfact(sp->shp_tech, sp->shp_frnge) / 100.0;
100.0;
range2 = (double)roundrange(range); range2 = (double)roundrange(range);
if (md > range) if (md > range)

View file

@ -675,7 +675,7 @@ shp_fort_interdiction(struct emp_qelem *list, coord newx, coord newy,
gun = fsect.sct_item[I_GUN]; gun = fsect.sct_item[I_GUN];
if (gun < 1) if (gun < 1)
continue; continue;
range = tfactfire(fsect.sct_own, (double)MIN(gun, 7)); range = tfactfire(fsect.sct_own, MIN(gun, 7));
if (fsect.sct_effic > 59) if (fsect.sct_effic > 59)
range++; range++;
range2 = roundrange(range); range2 = roundrange(range);
@ -878,7 +878,7 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
putship(mlp->ship.shp_uid, &mlp->ship); putship(mlp->ship.shp_uid, &mlp->ship);
/* Now update the map for this ship */ /* Now update the map for this ship */
tech = techfact(mlp->ship.shp_tech, (double)mlp->mcp->m_vrnge); tech = techfact(mlp->ship.shp_tech, mlp->mcp->m_vrnge);
if (mlp->mcp->m_flags & M_SONAR) if (mlp->mcp->m_flags & M_SONAR)
tf = techfact(mlp->ship.shp_tech, 1.0); tf = techfact(mlp->ship.shp_tech, 1.0);
else else

View file

@ -279,12 +279,12 @@ landrepair(struct lndstr *land, struct natstr *np,
leftp = ((float)left / 100.0); leftp = ((float)left / 100.0);
memset(mvec, 0, sizeof(mvec)); memset(mvec, 0, sizeof(mvec));
mvec[I_LCM] = lcm_needed = ldround((double)(lp->l_lcm * leftp), 1); mvec[I_LCM] = lcm_needed = ldround(lp->l_lcm * leftp, 1);
mvec[I_HCM] = hcm_needed = ldround((double)(lp->l_hcm * leftp), 1); mvec[I_HCM] = hcm_needed = ldround(lp->l_hcm * leftp, 1);
/* /*
mvec[I_GUN] = gun_needed = ldround((double)(lp->l_gun * leftp),1); mvec[I_GUN] = gun_needed = ldround(lp->l_gun * leftp, 1);
mvec[I_MILIT] = mil_needed = ldround((double)(lp->l_mil * leftp),1); mvec[I_MILIT] = mil_needed = ldround(lp->l_mil * leftp, 1);
mvec[I_SHELL] = shell_needed = ldround((double)(lp->l_shell *leftp),1); mvec[I_SHELL] = shell_needed = ldround(lp->l_shell *leftp, 1);
*/ */
mvec[I_GUN] = gun_needed = 0; mvec[I_GUN] = gun_needed = 0;
mvec[I_MILIT] = mil_needed = 0; mvec[I_MILIT] = mil_needed = 0;
@ -305,15 +305,15 @@ landrepair(struct lndstr *land, struct natstr *np,
if (mvec[I_SHELL] < shell_needed) if (mvec[I_SHELL] < shell_needed)
buildp = MIN(buildp, ((float)mvec[I_SHELL] / (float)lp->l_shell)); buildp = MIN(buildp, ((float)mvec[I_SHELL] / (float)lp->l_shell));
build = ldround((double)(buildp * 100.0), 1); build = ldround(buildp * 100.0, 1);
memset(mvec, 0, sizeof(mvec)); memset(mvec, 0, sizeof(mvec));
mvec[I_LCM] = lcm_needed = roundavg((double)(lp->l_lcm * buildp)); mvec[I_LCM] = lcm_needed = roundavg(lp->l_lcm * buildp);
mvec[I_HCM] = hcm_needed = roundavg((double)(lp->l_hcm * buildp)); mvec[I_HCM] = hcm_needed = roundavg(lp->l_hcm * buildp);
/* /*
mvec[I_GUN] = gun_needed = roundavg((double)(lp->l_gun * buildp)); mvec[I_GUN] = gun_needed = roundavg(lp->l_gun * buildp);
mvec[I_MILIT] = mil_needed = roundavg((double)(lp->l_mil * buildp)); mvec[I_MILIT] = mil_needed = roundavg(lp->l_mil * buildp);
mvec[I_SHELL] = shell_needed = roundavg((double)(lp->l_shell *buildp)); mvec[I_SHELL] = shell_needed = roundavg(lp->l_shell *buildp);
*/ */
mvec[I_GUN] = gun_needed = 0; mvec[I_GUN] = gun_needed = 0;
mvec[I_MILIT] = mil_needed = 0; mvec[I_MILIT] = mil_needed = 0;

View file

@ -193,12 +193,9 @@ prod_plane(int etus, int natnum, int *bp, int buildem)
leftp = ((float)left / 100.0); leftp = ((float)left / 100.0);
memset(mvec, 0, sizeof(mvec)); memset(mvec, 0, sizeof(mvec));
mvec[I_MILIT] = mil_needed = mvec[I_MILIT] = mil_needed = ldround(plp->pl_crew * leftp, 1);
ldround((double)(plp->pl_crew * leftp), 1); mvec[I_LCM] = lcm_needed = ldround(plp->pl_lcm * leftp, 1);
mvec[I_LCM] = lcm_needed = mvec[I_HCM] = hcm_needed = ldround(plp->pl_hcm * leftp, 1);
ldround((double)(plp->pl_lcm * leftp), 1);
mvec[I_HCM] = hcm_needed =
ldround((double)(plp->pl_hcm * leftp), 1);
get_materials(sp, bp, mvec, 0); get_materials(sp, bp, mvec, 0);
@ -215,14 +212,11 @@ prod_plane(int etus, int natnum, int *bp, int buildem)
buildp = MIN(buildp, ((float)mvec[I_HCM] / buildp = MIN(buildp, ((float)mvec[I_HCM] /
(float)plp->pl_hcm)); (float)plp->pl_hcm));
build = ldround((double)(buildp * 100.0), 1); build = ldround(buildp * 100.0, 1);
memset(mvec, 0, sizeof(mvec)); memset(mvec, 0, sizeof(mvec));
mvec[I_MILIT] = mil_needed = mvec[I_MILIT] = mil_needed = roundavg(plp->pl_crew * buildp);
roundavg((double)(plp->pl_crew * buildp)); mvec[I_LCM] = lcm_needed = roundavg(plp->pl_lcm * buildp);
mvec[I_LCM] = lcm_needed = mvec[I_HCM] = hcm_needed = roundavg(plp->pl_hcm * buildp);
roundavg((double)(plp->pl_lcm * buildp));
mvec[I_HCM] = hcm_needed =
roundavg((double)(plp->pl_hcm * buildp));
get_materials(sp, bp, mvec, 1); get_materials(sp, bp, mvec, 1);

View file

@ -78,7 +78,7 @@ populace(struct natstr *np, struct sctstr *sp, int etu)
tech = np->nat_level[NAT_TLEV]; tech = np->nat_level[NAT_TLEV];
pct = (double)((tech - 40) / 40.0 + edu / 3.0); pct = (double)((tech - 40) / 40.0 + edu / 3.0);
if (sp->sct_own == sp->sct_oldown && hap < pct && if (sp->sct_own == sp->sct_oldown && hap < pct &&
chance((double)(((double)pct - (double)hap) / (double)5.0))) { chance(((double)pct - (double)hap) / (double)5.0)) {
/* /*
* zap the loyalty of unhappy civilians. * zap the loyalty of unhappy civilians.
* there is a 20% chance per hap point below the * there is a 20% chance per hap point below the

View file

@ -347,8 +347,8 @@ shiprepair(struct shpstr *ship, struct natstr *np,
leftp = ((float)left / 100.0); leftp = ((float)left / 100.0);
memset(mvec, 0, sizeof(mvec)); memset(mvec, 0, sizeof(mvec));
mvec[I_LCM] = lcm_needed = ldround((double)(mp->m_lcm * leftp), 1); mvec[I_LCM] = lcm_needed = ldround(mp->m_lcm * leftp, 1);
mvec[I_HCM] = hcm_needed = ldround((double)(mp->m_hcm * leftp), 1); mvec[I_HCM] = hcm_needed = ldround(mp->m_hcm * leftp, 1);
get_materials(sp, bp, mvec, 0); get_materials(sp, bp, mvec, 0);
@ -359,10 +359,10 @@ shiprepair(struct shpstr *ship, struct natstr *np,
if (mvec[I_HCM] < hcm_needed) if (mvec[I_HCM] < hcm_needed)
buildp = MIN(buildp, ((float)mvec[I_HCM] / (float)mp->m_hcm)); buildp = MIN(buildp, ((float)mvec[I_HCM] / (float)mp->m_hcm));
build = ldround((double)(buildp * 100.0), 1); build = ldround(buildp * 100.0, 1);
memset(mvec, 0, sizeof(mvec)); memset(mvec, 0, sizeof(mvec));
mvec[I_LCM] = lcm_needed = roundavg((double)(mp->m_lcm * buildp)); mvec[I_LCM] = lcm_needed = roundavg(mp->m_lcm * buildp);
mvec[I_HCM] = hcm_needed = roundavg((double)(mp->m_hcm * buildp)); mvec[I_HCM] = hcm_needed = roundavg(mp->m_hcm * buildp);
get_materials(sp, bp, mvec, 1); get_materials(sp, bp, mvec, 1);