NUK_BLD_WORK): New, to encapsulate the formula in one place.
(SCT_MINEFF): New. Use it instead of literal 20.
(buil): Use CANT_HAPPEN() for internal error.
(build_ship, build_land, build_bridge, build_nuke, build_plane,
build_tower): Simplify avail calculation.
(lupgr, supgr, pupgr): Charge 15% of total build avail instead of an
undocumented amount computed from build lcm and hcm.
(build_ship, build_land, build_bridge, build_nuke, build_plane,
build_tower, lupgr, supgr, pupgr): Fix reporting of required avail
when there's not enough. Closes #942823.
(lupgr, supgr, pupgr): Code printed cost rounded down, but required
and charged unrounded cost. Confusing. Round cost down, like the
build command. Closes #942811.
(UPGR_COST, UPGR_EFF, lupgr, supgr, pupgr): New UPGR_COST, UPGR_COST replace
literal values.
(show_bridge, show_tower): Don't claim bridge building requires
`workers' (whatever that is), since it doesn't.
#define LND_FU(b, t) (b)
#define LND_XPL(b, t) (b)
#define LND_MXL(b, t) (b)
-#define LND_COST(b, t) ((b) * (1.0 + (sqrt((double)(t)) / 100.0)))
+
+/* Work required for building 100% */
+#define LND_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm))
/* Chance to detect L_SPY unit (percent) */
#define LND_SPY_DETECT_CHANCE(eff) ((110-(eff))/100.0)
#define getnukep(n) \
(struct nukstr *) ef_ptr(EF_NUKE, n)
+/* Work required for building */
+#define NUK_BLD_WORK(lcm, hcm, oil, rad) \
+ (((lcm) + 2 * (hcm) + (oil) + (rad) + 4) / 5)
+
extern struct nchrstr nchr[];
extern int nuk_maxno;
#define PLN_LOAD(b, t) (t ? (b * (logx((double)t, (double)50.0) < 1.0 ? 1.0 : \
logx((double)t, (double)50.0))) : b)
+/* Work required for building 100% */
+#define PLN_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm))
/* src/lib/subs/aircombat.c */
extern void ac_planedamage(struct plist *, natid, int, natid, int,
extern struct dchrstr dchr[];
extern struct dchrstr bigcity_dchr;
+/* Minimal efficiency of sectors that can be knocked down (bridges) */
+#define SCT_MINEFF 20
+
+/* Work required for building */
+#define SCT_BLD_WORK(lcm, hcm) ((lcm) + 2 * (hcm))
+
#define MIN_MOBCOST 0.001 /* lowest cost a sector can have to move into */
#define FORTEFF 5 /* forts must be 5% efficient to fire. */
/* bit masks for the autonav mode flags */
-/*
-#define AN_SAILDIR 1
-#define AN_AUTONAV 2
-#define AN_STANDBY 4
-#define AN_LOADING 8
- */
#define AN_SAILDIR bit(1)
#define AN_AUTONAV bit(2)
#define AN_STANDBY bit(3)
#define SHP_FIR(b, t) (t ? (b * (logx((double)t, (double)60.0) < 1.0 ? 1.0 : \
logx((double)t, (double)60.0))) : b)
+/* Work required for building 100% */
+#define SHP_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm))
+
/* return codes from shp_check_nav */
#define CN_NAVIGABLE (0)
#define CN_LANDLOCKED (1)
"%s bombing raid did %d%% damage in %s\n",
cname(player->cnum), oldeff - target->sct_effic,
xyas(target->sct_x, target->sct_y, target->sct_own));
- if (target->sct_effic < 20) {
+ if (target->sct_effic < SCT_MINEFF) {
if (target->sct_type == SCT_BSPAN)
knockdown(target, list);
else if (target->sct_type == SCT_BTOWER) {
built = build_plane(§, pp, sect.sct_item, tlev);
break;
default:
- pr("internal error in build (%d)\n", what);
+ CANT_HAPPEN("Bad WHAT");
return RET_FAIL;
}
if (built) {
{
struct shpstr ship;
struct nstr_item nstr;
- int cost, i;
- int w_p_eff, x;
- float eff = ((float)SHIP_MINEFF / 100.0);
- int points, lcm, hcm;
+ int avail, cost, i;
+ float eff = SHIP_MINEFF / 100.0;
+ int lcm, hcm;
int freeship = 0;
int techdiff;
- hcm = roundavg(((double)mp->m_hcm * (double)eff));
- lcm = roundavg(((double)mp->m_lcm * (double)eff));
+ hcm = roundavg((double)mp->m_hcm * eff);
+ lcm = roundavg((double)mp->m_lcm * eff);
if (sp->sct_type != SCT_HARBR) {
pr("Ships must be built in harbours.\n");
xyas(sp->sct_x, sp->sct_y, player->cnum));
return 0;
}
- w_p_eff = (20 + mp->m_lcm + (mp->m_hcm * 2));
- points = sp->sct_avail * 100 / w_p_eff;
- if (points < SHIP_MINEFF) {
+ avail = (SHP_BLD_WORK(mp->m_lcm, mp->m_hcm) * SHIP_MINEFF + 99) / 100;
+ if (sp->sct_avail < avail) {
pr("Not enough available work in %s to build a %s\n",
xyas(sp->sct_x, sp->sct_y, player->cnum), mp->m_name);
- pr(" (%d available work required)\n",
- 1 + (w_p_eff * SHIP_MINEFF) / 100);
+ pr(" (%d available work required)\n", avail);
return 0;
}
- cost = mp->m_cost * eff;
+ cost = mp->m_cost * SHIP_MINEFF / 100;
if (cash < cost) {
pr("Not enough money left to build a %s\n", mp->m_name);
return 0;
return 0;
if (!check_sect_ok(sp))
return 0;
- sp->sct_avail = (sp->sct_avail * 100 - w_p_eff * SHIP_MINEFF) / 100;
+ sp->sct_avail -= avail;
player->dolcost += cost;
cash -= cost;
snxtitem_all(&nstr, EF_SHIP);
ship.shp_orig_y = sp->sct_y;
ship.shp_fuel = mchr[(int)ship.shp_type].m_fuelc;
ship.shp_rflags = 0;
- for (x = 0; x < 10; x++)
- ship.shp_rpath[x] = 0;
+ memset(ship.shp_rpath, 0, sizeof(ship.shp_rpath));
vec[I_LCM] -= lcm;
vec[I_HCM] -= hcm;
{
struct lndstr land;
struct nstr_item nstr;
- int cost;
- int w_p_eff;
- int points;
+ int avail, cost;
struct natstr *natp;
- float eff = ((float)LAND_MINEFF / 100.0);
+ float eff = LAND_MINEFF / 100.0;
int mil, lcm, hcm, gun, shell;
int freeland = 0;
- /*
- mil = roundavg(((double)lp->l_mil * (double)eff));
- shell = roundavg(((double)lp->l_shell * (double)eff));
- gun = roundavg(((double)lp->l_gun * (double)eff));
- */
+#if 0
+ mil = roundavg(((double)lp->l_mil * eff));
+ shell = roundavg(((double)lp->l_shell * eff));
+ gun = roundavg(((double)lp->l_gun * eff));
+#else
mil = shell = gun = 0;
- hcm = roundavg(((double)lp->l_hcm * (double)eff));
- lcm = roundavg(((double)lp->l_lcm * (double)eff));
+#endif
+ hcm = roundavg(((double)lp->l_hcm * eff));
+ lcm = roundavg(((double)lp->l_lcm * eff));
natp = getnatp(player->cnum);
return 0;
if (!check_sect_ok(sp))
return 0;
- w_p_eff = (20 + lp->l_lcm + (lp->l_hcm * 2));
- points = sp->sct_avail * 100 / w_p_eff;
- if (points < LAND_MINEFF) {
+ avail = (LND_BLD_WORK(lp->l_lcm, lp->l_hcm) * LAND_MINEFF + 99) / 100;
+ if (sp->sct_avail < avail) {
pr("Not enough available work in %s to build a %s\n",
xyas(sp->sct_x, sp->sct_y, player->cnum), lp->l_name);
- pr(" (%d available work required)\n",
- 1 + (w_p_eff * LAND_MINEFF) / 100);
+ pr(" (%d available work required)\n", avail);
return 0;
}
- cost = ((float)lp->l_cost * eff);
- /* cost = (int)LND_COST(cost, tlev - lp->l_tech); */
+ cost = lp->l_cost * LAND_MINEFF / 100;
if (cash < cost) {
pr("Not enough money left to build a %s\n", lp->l_name);
return 0;
}
- sp->sct_avail = (sp->sct_avail * 100 - w_p_eff * LAND_MINEFF) / 100;
+ sp->sct_avail -= avail;
player->dolcost += cost;
cash -= cost;
snxtitem_all(&nstr, EF_LAND);
struct sctstr sect;
int val;
int newx, newy;
- int w_p_eff;
- int points;
+ int avail;
int nx, ny, i, good = 0;
s_char *p;
s_char buf[1024];
pr("you only have %d.\n", cash);
return 0;
}
- w_p_eff = buil_bh * 2;
- points = sp->sct_avail * 100 / w_p_eff;
- if (points < 20) {
+ avail = (SCT_BLD_WORK(0, buil_bh) * SCT_MINEFF + 99) / 100;
+ if (sp->sct_avail < avail) {
pr("Not enough available work in %s to build a bridge\n",
xyas(sp->sct_x, sp->sct_y, player->cnum));
- pr(" (%d available work required)\n", 1 + (w_p_eff * 20) / 100);
+ pr(" (%d available work required)\n", avail);
return 0;
}
if (!player->argp[3]) {
return 0;
}
} /* end EASY_BRIDGES */
- sp->sct_avail = (sp->sct_avail * 100 - w_p_eff * 20) / 100;
+ sp->sct_avail -= avail;
player->dolcost += buil_bc;
cash -= buil_bc;
sect.sct_type = SCT_BSPAN;
sect.sct_newtype = SCT_BSPAN;
- sect.sct_effic = 20;
+ sect.sct_effic = SCT_MINEFF;
sect.sct_road = 0;
sect.sct_rail = 0;
sect.sct_defense = 0;
build_nuke(register struct sctstr *sp, register struct nchrstr *np,
short *vec)
{
- int w_p_eff;
- int points;
+ int avail;
if (sp->sct_type != SCT_NUKE && !player->god) {
pr("Nuclear weapons must be built in nuclear plants.\n");
pr("You need $%d, you only have %d.\n", np->n_cost, cash);
return 0;
}
- w_p_eff = np->n_rad + np->n_oil + np->n_lcm + np->n_hcm * 2;
- points = sp->sct_avail * 100 / w_p_eff;
+ avail = NUK_BLD_WORK(np->n_lcm, np->n_hcm, np->n_oil, np->n_rad);
/*
* XXX when nukes turn into units (or whatever), then
* make them start at 20%. Since they don't have efficiency
- * now, we choose 20% as a "big" number.
+ * now, we charge all the work right away.
*/
- if (points < 20) {
+ if (sp->sct_avail < avail) {
pr("Not enough available work in %s to build a %s;\n",
xyas(sp->sct_x, sp->sct_y, player->cnum), np->n_name);
- pr(" (%d available work required)\n", 1 + w_p_eff * 20 / 100);
+ pr(" (%d available work required)\n", avail);
return 0;
}
if (!trechk(player->cnum, 0, NEWNUK))
return 0;
if (!check_sect_ok(sp))
return 0;
- sp->sct_avail = (sp->sct_avail * 100 - w_p_eff * 20) / 100;
+ sp->sct_avail -= avail;
player->dolcost += np->n_cost;
cash -= np->n_cost;
nuk_add(sp->sct_x, sp->sct_y, np - nchr, 1);
short *vec, int tlev)
{
struct plnstr plane;
- int cost;
+ int avail, cost;
struct nstr_item nstr;
- float eff = ((float)PLANE_MINEFF / 100.0);
- int points;
- int w_p_eff;
+ float eff = PLANE_MINEFF / 100.0;
int hcm, lcm, mil;
int freeplane = 0;
- mil = roundavg(((double)pp->pl_crew * (double)eff));
+ mil = roundavg(((double)pp->pl_crew * eff));
/* Always use at least 1 mil to build a plane */
if (mil == 0 && pp->pl_crew > 0)
mil = 1;
- hcm = roundavg(((double)pp->pl_hcm * (double)eff));
- lcm = roundavg(((double)pp->pl_lcm * (double)eff));
+ hcm = roundavg(((double)pp->pl_hcm * eff));
+ lcm = roundavg(((double)pp->pl_lcm * eff));
if (sp->sct_type != SCT_AIRPT && !player->god) {
pr("Planes must be built in airports.\n");
return 0;
xyas(sp->sct_x, sp->sct_y, player->cnum));
return 0;
}
- w_p_eff = (20 + pp->pl_lcm + (pp->pl_hcm * 2));
- points = sp->sct_avail * 100 / w_p_eff;
- if (points < PLANE_MINEFF) {
+ avail = (PLN_BLD_WORK(pp->pl_lcm, pp->pl_hcm) * PLANE_MINEFF + 99) / 100;
+ if (sp->sct_avail < avail) {
pr("Not enough available work in %s to build a %s\n",
xyas(sp->sct_x, sp->sct_y, player->cnum), pp->pl_name);
- pr(" (%d available work required)\n",
- 1 + PLANE_MINEFF * w_p_eff / 100);
+ pr(" (%d available work required)\n", avail);
return 0;
}
- cost = pp->pl_cost * eff;
+ cost = pp->pl_cost * PLANE_MINEFF / 100;
if (cash < cost) {
pr("Not enough money left to build a %s\n", pp->pl_name);
return 0;
return 0;
if (!check_sect_ok(sp))
return 0;
- sp->sct_avail = (sp->sct_avail * 100 - w_p_eff * PLANE_MINEFF) / 100;
+ sp->sct_avail -= avail;
player->dolcost += cost;
cash -= cost;
snxtitem_all(&nstr, EF_PLANE);
* planes may have their own stats (like based on tech maybe? :) ) Thus,
* the code now checks the pln_acc, pln_load and pln_fuel instead of using
* the static definitions of them. */
-/*
- n = (int) (pp->pl_range * (0.75 + techfact(tlev - pp->pl_tech, 2.0)));
- if (n > 127)
- n = 127;
- plane.pln_range = n;
- plane.pln_range_max = n;
- n = (int) (pp->pl_att * (0.75 + techfact(tlev - pp->pl_tech, 2.0)));
- if (n > 127)
- n = 127;
- plane.pln_att = n;
- n = (int) (pp->pl_def * (0.75 + techfact(tlev - pp->pl_tech, 2.0)));
- if (n > 127)
- n = 127;
- if (n < pp->pl_def)
- n = pp->pl_def;
- plane.pln_def = n;
- plane.pln_acc = pp->pl_acc;
- plane.pln_load = pp->pl_load;
- plane.pln_fuel = pp->pl_fuel;
-*/
plane.pln_att = PLN_ATTDEF(pp->pl_att, (int)(tlev - pp->pl_tech));
plane.pln_def = PLN_ATTDEF(pp->pl_def, (int)(tlev - pp->pl_tech));
plane.pln_acc = PLN_ACC(pp->pl_acc, (int)(tlev - pp->pl_tech));
struct sctstr sect;
int val;
int newx, newy;
- int w_p_eff;
- int points;
+ int avail;
s_char *p;
s_char buf[1024];
int good;
pr("you only have %d.\n", cash);
return 0;
}
- w_p_eff = buil_tower_bh * 2;
- points = sp->sct_avail * 100 / w_p_eff;
- if (points < 20) {
+ avail = (SCT_BLD_WORK(0, buil_tower_bh) * SCT_MINEFF + 99) / 100;
+ if (sp->sct_avail < avail) {
pr("Not enough available work in %s to build a bridge tower\n",
xyas(sp->sct_x, sp->sct_y, player->cnum));
- pr(" (%d available work required)\n", 1 + (w_p_eff * 20) / 100);
+ pr(" (%d available work required)\n", avail);
return 0;
}
if (!player->argp[3]) {
return 0;
}
- sp->sct_avail = (sp->sct_avail * 100 - w_p_eff * 20) / 100;
+ sp->sct_avail -= avail;
player->dolcost += buil_tower_bc;
cash -= buil_tower_bc;
sect.sct_type = SCT_BTOWER;
sect.sct_newtype = SCT_BTOWER;
- sect.sct_effic = 20;
+ sect.sct_effic = SCT_MINEFF;
sect.sct_road = 0;
sect.sct_rail = 0;
sect.sct_defense = 0;
#include "file.h"
#include "commands.h"
+enum {
+ UPGR_COST = 15, /* how much avail and money to charge */
+ UPGR_EFF = 35 /* efficiency reduction */
+};
+
static int lupgr(void);
static int pupgr(void);
static int supgr(void);
struct lchrstr *lp;
int n;
int tlev;
- int w_p_eff;
- int points;
+ int avail, cost;
int rel;
int techdiff;
long cash;
}
n++;
lp = &lchr[(int)land.lnd_type];
- w_p_eff = ((lp->l_lcm / 2) + lp->l_hcm);
- points = sect.sct_avail * 100 / w_p_eff;
- if (points < 20) {
+ avail = (LND_BLD_WORK(lp->l_lcm, lp->l_hcm) * UPGR_COST + 99) / 100;
+ if (sect.sct_avail < avail) {
pr("Not enough available work in %s to upgrade a %s\n",
xyas(sect.sct_x, sect.sct_y, player->cnum), lp->l_name);
- pr(" (%d available work required)\n",
- 1 + (w_p_eff * 20) / 100);
+ pr(" (%d available work required)\n", avail);
continue;
}
if (land.lnd_effic < 60) {
land.lnd_tech, tlev);
continue;
}
- if (lp->l_cost * .15 + player->dolcost > cash) {
+ cost = lp->l_cost * UPGR_COST / 100;
+ if (cost + player->dolcost > cash) {
pr("You don't have enough money to upgrade %s!\n",
prland(&land));
continue;
}
- sect.sct_avail = (sect.sct_avail * 100 - w_p_eff * 20) / 100;
- land.lnd_effic -= 35;
+ sect.sct_avail -= avail;
+ land.lnd_effic -= UPGR_EFF;
land.lnd_tech = tlev;
techdiff = (int)(tlev - lp->l_tech);
putland(land.lnd_uid, &land);
putsect(§);
- player->dolcost += (double)lp->l_cost * .15;
+ player->dolcost += cost;
pr("%s upgraded to tech %d, at a cost of %d\n", prland(&land),
- land.lnd_tech, (int)(lp->l_cost * .15));
+ land.lnd_tech, cost);
if (land.lnd_own != player->cnum)
wu(0, land.lnd_own,
"%s upgraded by %s to tech %d, at a cost of %d\n",
prland(&land), cname(player->cnum), land.lnd_tech,
- (int)(lp->l_cost * .15));
+ cost);
}
if (n == 0) {
pr("No land units\n");
struct mchrstr *mp;
int n;
int tlev;
- int w_p_eff;
- int points;
+ int avail, cost;
int rel;
int techdiff;
long cash;
}
n++;
mp = &mchr[(int)ship.shp_type];
- w_p_eff = ((mp->m_lcm / 2) + mp->m_hcm);
- points = sect.sct_avail * 100 / w_p_eff;
- if (points < 20) {
+ avail = (SHP_BLD_WORK(mp->m_lcm, mp->m_hcm) * UPGR_COST + 99) / 100;
+ if (sect.sct_avail < avail) {
pr("Not enough available work in %s to upgrade a %s\n",
xyas(sect.sct_x, sect.sct_y, player->cnum), mp->m_name);
- pr(" (%d available work required)\n",
- 1 + (w_p_eff * 20) / 100);
+ pr(" (%d available work required)\n", avail);
continue;
}
if (ship.shp_effic < 60) {
ship.shp_tech, tlev);
continue;
}
- if (mp->m_cost * .15 + player->dolcost > cash) {
+ cost = mp->m_cost * UPGR_COST / 100;
+ if (cost + player->dolcost > cash) {
pr("You don't have enough money to upgrade %s!\n",
prship(&ship));
continue;
}
- sect.sct_avail = (sect.sct_avail * 100 - w_p_eff * 20) / 100;
- ship.shp_effic -= 35;
+ sect.sct_avail -= avail;
+ ship.shp_effic -= UPGR_EFF;
ship.shp_tech = tlev;
techdiff = (int)(tlev - mp->m_tech);
putship(ship.shp_uid, &ship);
putsect(§);
- player->dolcost += (double)mp->m_cost * .15;
+ player->dolcost += cost;
pr("%s upgraded to tech %d, at a cost of %d\n", prship(&ship),
- ship.shp_tech, (int)(mp->m_cost * .15));
+ ship.shp_tech, cost);
if (ship.shp_own != player->cnum)
wu(0, ship.shp_own,
"%s upgraded by %s to tech %d, at a cost of %d\n",
prship(&ship), cname(player->cnum), ship.shp_tech,
- (int)(mp->m_cost * .15));
+ cost);
}
if (n == 0) {
pr("No ships\n");
struct plchrstr *pp;
int n;
int tlev;
- int w_p_eff;
- int points;
+ int avail, cost;
int rel;
int techdiff;
long cash;
}
n++;
pp = &plchr[(int)plane.pln_type];
- w_p_eff = ((pp->pl_lcm / 2) + pp->pl_hcm);
- points = sect.sct_avail * 100 / w_p_eff;
- if (points < 20) {
+ avail = (PLN_BLD_WORK(pp->pl_lcm, pp->pl_hcm) * UPGR_COST + 99) / 100;
+ if (sect.sct_avail < avail) {
pr("Not enough available work in %s to upgrade a %s\n",
xyas(sect.sct_x, sect.sct_y, player->cnum), pp->pl_name);
- pr(" (%d available work required)\n",
- 1 + (w_p_eff * 20) / 100);
+ pr(" (%d available work required)\n", avail);
continue;
}
if (plane.pln_effic < 60) {
plane.pln_tech, tlev);
continue;
}
- if (pp->pl_cost * .15 + player->dolcost > cash) {
+ cost = pp->pl_cost * UPGR_COST / 100;
+ if (cost + player->dolcost > cash) {
pr("You don't have enough money to upgrade %s!\n",
prplane(&plane));
continue;
continue;
}
- sect.sct_avail = (sect.sct_avail * 100 - w_p_eff * 20) / 100;
- plane.pln_effic -= 35;
+ sect.sct_avail -= avail;
+ plane.pln_effic -= UPGR_EFF;
plane.pln_tech = tlev;
techdiff = (int)(tlev - pp->pl_tech);
putplane(plane.pln_uid, &plane);
putsect(§);
- player->dolcost += (double)pp->pl_cost * .15;
+ player->dolcost += cost;
pr("%s upgraded to tech %d, at a cost of %d\n", prplane(&plane),
- plane.pln_tech, (int)(pp->pl_cost * .15));
+ plane.pln_tech, cost);
if (plane.pln_own != player->cnum)
wu(0, plane.pln_own,
"%s upgraded by %s to tech %d, at a cost of %d\n",
prplane(&plane), cname(player->cnum), plane.pln_tech,
- (int)(pp->pl_cost * .15));
+ cost);
}
if (n == 0) {
pr("No planes.\n");
sp->sct_mobil = damage(sp->sct_mobil, dam);
item_damage(dam, sp->sct_item);
if (opt_EASY_BRIDGES == 0) {
- if (sp->sct_effic < 20 && sp->sct_type == SCT_BHEAD)
+ if (sp->sct_effic < SCT_MINEFF && sp->sct_type == SCT_BHEAD)
bridgefall(sp, list);
} else {
- if (sp->sct_effic < 20 && sp->sct_type == SCT_BSPAN)
+ if (sp->sct_effic < SCT_MINEFF && sp->sct_type == SCT_BSPAN)
knockdown(sp, list);
}
putsect(sp);
else
loyalcivs = 0;
- if (sp->sct_effic < 20) {
+ if (sp->sct_effic < SCT_MINEFF) {
if (sp->sct_type == SCT_BSPAN)
knockdown(sp, 0);
else if (sp->sct_type == SCT_BTOWER) {
pr(" %d hcm,", buil_bh);
else if (!opt_NO_LCMS)
pr(" %d lcm,", buil_bh);
- pr(" %d workers,\n", buil_bh * 2);
+ pr(" %d workers,\n", 0);
pr("%d available workforce, and cost $%g\n",
- 1 + (buil_bh * 40 / 100), buil_bc);
+ (SCT_BLD_WORK(0, buil_bh) * SCT_MINEFF + 99) / 100,
+ buil_bc);
}
void
pr(" %d hcm,", buil_tower_bh);
else if (!opt_NO_LCMS)
pr(" %d lcm,", buil_tower_bh);
- pr(" %d workers,\n", buil_tower_bh * 2);
+ pr(" %d workers,\n", 0);
pr("%d available workforce, and cost $%g\n",
- 1 + (buil_tower_bh * 40 / 100), buil_tower_bc);
+ (SCT_BLD_WORK(0, buil_tower_bh) * SCT_MINEFF + 99) / 100,
+ buil_tower_bc);
}
void
if (opt_NONUKES)
return;
for (np = nchr, n = 0; n < N_MAXNUKE; np++, n++) {
- avail =
- (4 + np->n_rad + np->n_oil + np->n_lcm + np->n_hcm * 2) / 5;
+ avail = NUK_BLD_WORK(np->n_lcm, np->n_hcm, np->n_oil, np->n_rad);
if (np->n_tech > tlev)
continue;
if (np->n_name == 0 || np->n_name[0] == '\0')
pr("%-25.25s %3d %3d %5d %4d $%d\n",
mp->m_name, mp->m_lcm, mp->m_hcm,
- 20 + mp->m_lcm + mp->m_hcm * 2, mp->m_tech, mp->m_cost);
+ SHP_BLD_WORK(mp->m_lcm, mp->m_hcm), mp->m_tech, mp->m_cost);
}
}
pr("%-25.25s %3d %3d %3d %5d %4d $%d\n",
pp->pl_name, pp->pl_lcm,
pp->pl_hcm, pp->pl_crew,
- 20 + 2 * pp->pl_hcm + pp->pl_lcm, pp->pl_tech, pp->pl_cost);
+ PLN_BLD_WORK(pp->pl_lcm, pp->pl_hcm), pp->pl_tech, pp->pl_cost);
}
}
lp->l_name, lp->l_lcm,
lp->l_hcm,
lp->l_gun,
- 20 + lp->l_lcm + (lp->l_hcm * 2), lp->l_tech, lp->l_cost);
+ LND_BLD_WORK(lp->l_lcm, lp->l_hcm), lp->l_tech, lp->l_cost);
}
}
else
avail = gt_bg_nmbr(bp, sp, I_MAX + 1) * 100;
- w_p_eff = 20 + (lp->l_lcm + 2 * lp->l_hcm);
+ w_p_eff = LND_BLD_WORK(lp->l_lcm, lp->l_hcm);
delta = roundavg((double)avail / w_p_eff);
if (delta <= 0)
return 1;
shp = getshipp(pp->pln_ship);
avail += (etus * shp->shp_item[I_MILIT] / 2);
}
- w_p_eff = 20 + (desc->pl_lcm + 2 * desc->pl_hcm);
+ w_p_eff = PLN_BLD_WORK(desc->pl_lcm, desc->pl_hcm);
delta = roundavg((double)avail / w_p_eff);
if (delta <= 0)
continue;
avail = wf + gt_bg_nmbr(bp, sp, I_MAX + 1) * 100;
}
- w_p_eff = 20 + (mp->m_lcm + 2 * mp->m_hcm);
+ w_p_eff = SHP_BLD_WORK(mp->m_lcm, mp->m_hcm);
if ((sp->sct_off) && (sp->sct_own == ship->shp_own))
return 1;