(build_ship, build_land, build_plane): Compute initial efficiency in
double rather than float, because all its uses convert it to double. Remove redundant casts.
This commit is contained in:
parent
276cbc54d2
commit
8646d6f6d0
1 changed files with 13 additions and 13 deletions
|
@ -292,12 +292,12 @@ build_ship(struct sctstr *sp, struct mchrstr *mp, short *vec, int tlev)
|
||||||
struct nstr_item nstr;
|
struct nstr_item nstr;
|
||||||
int avail, i;
|
int avail, i;
|
||||||
double cost;
|
double cost;
|
||||||
float eff = SHIP_MINEFF / 100.0;
|
double eff = SHIP_MINEFF / 100.0;
|
||||||
int lcm, hcm;
|
int lcm, hcm;
|
||||||
int freeship = 0;
|
int freeship = 0;
|
||||||
|
|
||||||
hcm = roundavg((double)mp->m_hcm * eff);
|
hcm = roundavg(mp->m_hcm * eff);
|
||||||
lcm = roundavg((double)mp->m_lcm * eff);
|
lcm = roundavg(mp->m_lcm * eff);
|
||||||
|
|
||||||
if (sp->sct_type != SCT_HARBR) {
|
if (sp->sct_type != SCT_HARBR) {
|
||||||
pr("Ships must be built in harbours.\n");
|
pr("Ships must be built in harbours.\n");
|
||||||
|
@ -405,19 +405,19 @@ build_land(struct sctstr *sp, struct lchrstr *lp, short *vec, int tlev)
|
||||||
struct nstr_item nstr;
|
struct nstr_item nstr;
|
||||||
int avail;
|
int avail;
|
||||||
double cost;
|
double cost;
|
||||||
float eff = LAND_MINEFF / 100.0;
|
double eff = LAND_MINEFF / 100.0;
|
||||||
int mil, lcm, hcm, gun, shell;
|
int mil, lcm, hcm, gun, shell;
|
||||||
int freeland = 0;
|
int freeland = 0;
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
mil = roundavg(((double)lp->l_mil * eff));
|
mil = roundavg(lp->l_mil * eff);
|
||||||
shell = roundavg(((double)lp->l_shell * eff));
|
shell = roundavg(lp->l_shell * eff);
|
||||||
gun = roundavg(((double)lp->l_gun * eff));
|
gun = roundavg(lp->l_gun * eff);
|
||||||
#else
|
#else
|
||||||
mil = shell = gun = 0;
|
mil = shell = gun = 0;
|
||||||
#endif
|
#endif
|
||||||
hcm = roundavg(((double)lp->l_hcm * eff));
|
hcm = roundavg(lp->l_hcm * eff);
|
||||||
lcm = roundavg(((double)lp->l_lcm * eff));
|
lcm = roundavg(lp->l_lcm * eff);
|
||||||
|
|
||||||
if (sp->sct_type != SCT_HEADQ) {
|
if (sp->sct_type != SCT_HEADQ) {
|
||||||
pr("Land Units must be built in headquarters.\n");
|
pr("Land Units must be built in headquarters.\n");
|
||||||
|
@ -720,16 +720,16 @@ build_plane(struct sctstr *sp, struct plchrstr *pp, short *vec, int tlev)
|
||||||
struct nstr_item nstr;
|
struct nstr_item nstr;
|
||||||
int avail;
|
int avail;
|
||||||
double cost;
|
double cost;
|
||||||
float eff = PLANE_MINEFF / 100.0;
|
double eff = PLANE_MINEFF / 100.0;
|
||||||
int hcm, lcm, mil;
|
int hcm, lcm, mil;
|
||||||
int freeplane;
|
int freeplane;
|
||||||
|
|
||||||
mil = roundavg(((double)pp->pl_crew * eff));
|
mil = roundavg(pp->pl_crew * eff);
|
||||||
/* Always use at least 1 mil to build a plane */
|
/* Always use at least 1 mil to build a plane */
|
||||||
if (mil == 0 && pp->pl_crew > 0)
|
if (mil == 0 && pp->pl_crew > 0)
|
||||||
mil = 1;
|
mil = 1;
|
||||||
hcm = roundavg(((double)pp->pl_hcm * eff));
|
hcm = roundavg(pp->pl_hcm * eff);
|
||||||
lcm = roundavg(((double)pp->pl_lcm * eff));
|
lcm = roundavg(pp->pl_lcm * eff);
|
||||||
if (sp->sct_type != SCT_AIRPT && !player->god) {
|
if (sp->sct_type != SCT_AIRPT && !player->god) {
|
||||||
pr("Planes must be built in airports.\n");
|
pr("Planes must be built in airports.\n");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue