(fuel, load, prod, max_population, shp_nav_one_sector,

nav_loadship, upd_buildeff): Identify BIG_CITY
(IS_BIG_CITY) by using packing type of UPKG instead of
opt_BIG_CITY and sector type of SCT_CAPITAL.
This commit is contained in:
Ron Koenderink 2005-11-14 13:52:12 +00:00
parent d581485d32
commit a2798857cf
8 changed files with 36 additions and 40 deletions

View file

@ -165,6 +165,7 @@ extern int sctoff(coord x, coord y);
extern struct dchrstr dchr[SCT_MAXDEF + 1];
extern struct dchrstr bigcity_dchr;
#define IS_BIG_CITY(sect) (dchr[sect].d_pkg == UPKG)
/* Minimal efficiency of sectors that can be knocked down (bridges) */
#define SCT_MINEFF 20

View file

@ -121,9 +121,8 @@ fuel(void)
if ((sect.sct_type != SCT_HARBR)
&& (sect.sct_type != SCT_WATER)
&& (sect.sct_type != SCT_BSPAN) && (!opt_BIG_CITY
|| sect.sct_type !=
SCT_CAPIT)) {
&& (sect.sct_type != SCT_BSPAN)
&& (!IS_BIG_CITY(sect.sct_type))) {
pr("Sector %s is not a harbor, bridge span, or sea.\n",
xyas(item.ship.shp_x, item.ship.shp_y,
item.ship.shp_own));
@ -134,7 +133,7 @@ fuel(void)
harbor = 0;
if (sect.sct_type == SCT_HARBR
|| (opt_BIG_CITY && sect.sct_type == SCT_CAPIT)) {
|| IS_BIG_CITY(sect.sct_type)) {
harbor = 1;
oil_amt = sect.sct_item[I_OIL];
pet_amt = sect.sct_item[I_PETROL];

View file

@ -138,7 +138,7 @@ load(void)
continue;
if (!player->owner &&
sect.sct_type != SCT_HARBR &&
(!opt_BIG_CITY || sect.sct_type != SCT_CAPIT))
!IS_BIG_CITY(sect.sct_type))
continue;
if (!sect.sct_own)
continue;
@ -149,11 +149,13 @@ load(void)
continue;
}
if (sect.sct_type != SCT_HARBR &&
(!opt_BIG_CITY || sect.sct_type != SCT_CAPIT)) {
!IS_BIG_CITY(sect.sct_type)) {
if (noisy)
pr("Sector %s is not a harbor%s.\n",
pr("Sector %s is not a harbor%s%s.\n",
xyas(ship.shp_x, ship.shp_y, player->cnum),
opt_BIG_CITY ? " or a city" : "");
IS_BIG_CITY(sect.sct_type) ? " or a " : "",
IS_BIG_CITY(sect.sct_type) ?
dchr[sect.sct_type].d_name : "");
continue;
}
if (sect.sct_own != player->cnum && load_unload == UNLOAD

View file

@ -136,9 +136,8 @@ prod(void)
type = sect.sct_newtype;
eff = 0;
}
if (opt_BIG_CITY) {
if (!eff && dchr[otype].d_pkg == UPKG &&
dchr[type].d_pkg != UPKG) {
if (!eff && IS_BIG_CITY(otype) &&
!IS_BIG_CITY(type)) {
natp = getnatp(sect.sct_own);
maxpop = max_population(natp->nat_level[NAT_RLEV],
type, eff);
@ -148,7 +147,6 @@ prod(void)
uws, maxpop));
bwork = min(work / 2, bwork);
}
}
twork = 100 - eff;
if (twork > bwork) {
twork = bwork;

View file

@ -46,11 +46,9 @@ max_population(float research, int desig, int eff)
int maxpop = dchr[desig].d_maxpop;
int rmax;
if (opt_BIG_CITY) {
/* city efficiency limits maximum population */
if (dchr[desig].d_pkg == UPKG)
if (IS_BIG_CITY(desig))
maxpop *= 1 + 9.0 * eff / 100;
}
if (opt_RES_POP) {
/* research limits maximum population */

View file

@ -834,7 +834,7 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
continue;
}
}
if (opt_BIG_CITY && sect.sct_type == SCT_CAPIT) {
if (IS_BIG_CITY(sect.sct_type)) {
if (mlp->mcp->m_lcm + 2 * mlp->mcp->m_hcm >= 60) {
sprintf(dp,
"is too large to fit into the canal system at %s",

View file

@ -192,7 +192,7 @@ nav_loadship(struct shpstr *sp, natid cnum)
continue;
}
if (sectp->sct_type != SCT_HARBR &&
(!opt_BIG_CITY || sectp->sct_type != SCT_CAPIT)) {
!IS_BIG_CITY(sectp->sct_type)) {
/* we can only load in harbors */
didsomething[i] = 1;
continue;

View file

@ -84,9 +84,8 @@ upd_buildeff(struct natstr *np, struct sctstr *sp, int *workp,
}
neweff = n;
*cost += work_cost;
if (opt_BIG_CITY) {
if (!n && dchr[old_type].d_pkg == UPKG &&
dchr[*desig].d_pkg != UPKG) {
if (!n && IS_BIG_CITY(old_type) &&
!IS_BIG_CITY(*desig)) {
int maxpop = max_population(np->nat_level[NAT_RLEV], *desig, n);
if (vec[I_CIVIL] > maxpop)
vec[I_CIVIL] = maxpop;
@ -99,7 +98,6 @@ upd_buildeff(struct natstr *np, struct sctstr *sp, int *workp,
buildeff_work = min((int)(*workp / 2), buildeff_work);
}
}
}
if (np->nat_priorities[*desig]) {
if (*desig == sp->sct_newtype) {
work_cost = 100 - neweff;