(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:
parent
d581485d32
commit
a2798857cf
8 changed files with 36 additions and 40 deletions
|
@ -165,6 +165,7 @@ extern int sctoff(coord x, coord y);
|
||||||
|
|
||||||
extern struct dchrstr dchr[SCT_MAXDEF + 1];
|
extern struct dchrstr dchr[SCT_MAXDEF + 1];
|
||||||
extern struct dchrstr bigcity_dchr;
|
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) */
|
/* Minimal efficiency of sectors that can be knocked down (bridges) */
|
||||||
#define SCT_MINEFF 20
|
#define SCT_MINEFF 20
|
||||||
|
|
|
@ -121,9 +121,8 @@ fuel(void)
|
||||||
|
|
||||||
if ((sect.sct_type != SCT_HARBR)
|
if ((sect.sct_type != SCT_HARBR)
|
||||||
&& (sect.sct_type != SCT_WATER)
|
&& (sect.sct_type != SCT_WATER)
|
||||||
&& (sect.sct_type != SCT_BSPAN) && (!opt_BIG_CITY
|
&& (sect.sct_type != SCT_BSPAN)
|
||||||
|| sect.sct_type !=
|
&& (!IS_BIG_CITY(sect.sct_type))) {
|
||||||
SCT_CAPIT)) {
|
|
||||||
pr("Sector %s is not a harbor, bridge span, or sea.\n",
|
pr("Sector %s is not a harbor, bridge span, or sea.\n",
|
||||||
xyas(item.ship.shp_x, item.ship.shp_y,
|
xyas(item.ship.shp_x, item.ship.shp_y,
|
||||||
item.ship.shp_own));
|
item.ship.shp_own));
|
||||||
|
@ -134,7 +133,7 @@ fuel(void)
|
||||||
|
|
||||||
harbor = 0;
|
harbor = 0;
|
||||||
if (sect.sct_type == SCT_HARBR
|
if (sect.sct_type == SCT_HARBR
|
||||||
|| (opt_BIG_CITY && sect.sct_type == SCT_CAPIT)) {
|
|| IS_BIG_CITY(sect.sct_type)) {
|
||||||
harbor = 1;
|
harbor = 1;
|
||||||
oil_amt = sect.sct_item[I_OIL];
|
oil_amt = sect.sct_item[I_OIL];
|
||||||
pet_amt = sect.sct_item[I_PETROL];
|
pet_amt = sect.sct_item[I_PETROL];
|
||||||
|
|
|
@ -138,7 +138,7 @@ load(void)
|
||||||
continue;
|
continue;
|
||||||
if (!player->owner &&
|
if (!player->owner &&
|
||||||
sect.sct_type != SCT_HARBR &&
|
sect.sct_type != SCT_HARBR &&
|
||||||
(!opt_BIG_CITY || sect.sct_type != SCT_CAPIT))
|
!IS_BIG_CITY(sect.sct_type))
|
||||||
continue;
|
continue;
|
||||||
if (!sect.sct_own)
|
if (!sect.sct_own)
|
||||||
continue;
|
continue;
|
||||||
|
@ -149,11 +149,13 @@ load(void)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (sect.sct_type != SCT_HARBR &&
|
if (sect.sct_type != SCT_HARBR &&
|
||||||
(!opt_BIG_CITY || sect.sct_type != SCT_CAPIT)) {
|
!IS_BIG_CITY(sect.sct_type)) {
|
||||||
if (noisy)
|
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),
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
if (sect.sct_own != player->cnum && load_unload == UNLOAD
|
if (sect.sct_own != player->cnum && load_unload == UNLOAD
|
||||||
|
|
|
@ -136,9 +136,8 @@ prod(void)
|
||||||
type = sect.sct_newtype;
|
type = sect.sct_newtype;
|
||||||
eff = 0;
|
eff = 0;
|
||||||
}
|
}
|
||||||
if (opt_BIG_CITY) {
|
if (!eff && IS_BIG_CITY(otype) &&
|
||||||
if (!eff && dchr[otype].d_pkg == UPKG &&
|
!IS_BIG_CITY(type)) {
|
||||||
dchr[type].d_pkg != UPKG) {
|
|
||||||
natp = getnatp(sect.sct_own);
|
natp = getnatp(sect.sct_own);
|
||||||
maxpop = max_population(natp->nat_level[NAT_RLEV],
|
maxpop = max_population(natp->nat_level[NAT_RLEV],
|
||||||
type, eff);
|
type, eff);
|
||||||
|
@ -148,7 +147,6 @@ prod(void)
|
||||||
uws, maxpop));
|
uws, maxpop));
|
||||||
bwork = min(work / 2, bwork);
|
bwork = min(work / 2, bwork);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
twork = 100 - eff;
|
twork = 100 - eff;
|
||||||
if (twork > bwork) {
|
if (twork > bwork) {
|
||||||
twork = bwork;
|
twork = bwork;
|
||||||
|
|
|
@ -46,11 +46,9 @@ max_population(float research, int desig, int eff)
|
||||||
int maxpop = dchr[desig].d_maxpop;
|
int maxpop = dchr[desig].d_maxpop;
|
||||||
int rmax;
|
int rmax;
|
||||||
|
|
||||||
if (opt_BIG_CITY) {
|
|
||||||
/* city efficiency limits maximum population */
|
/* city efficiency limits maximum population */
|
||||||
if (dchr[desig].d_pkg == UPKG)
|
if (IS_BIG_CITY(desig))
|
||||||
maxpop *= 1 + 9.0 * eff / 100;
|
maxpop *= 1 + 9.0 * eff / 100;
|
||||||
}
|
|
||||||
|
|
||||||
if (opt_RES_POP) {
|
if (opt_RES_POP) {
|
||||||
/* research limits maximum population */
|
/* research limits maximum population */
|
||||||
|
|
|
@ -834,7 +834,7 @@ shp_nav_one_sector(struct emp_qelem *list, int dir, natid actor,
|
||||||
continue;
|
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) {
|
if (mlp->mcp->m_lcm + 2 * mlp->mcp->m_hcm >= 60) {
|
||||||
sprintf(dp,
|
sprintf(dp,
|
||||||
"is too large to fit into the canal system at %s",
|
"is too large to fit into the canal system at %s",
|
||||||
|
|
|
@ -192,7 +192,7 @@ nav_loadship(struct shpstr *sp, natid cnum)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (sectp->sct_type != SCT_HARBR &&
|
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 */
|
/* we can only load in harbors */
|
||||||
didsomething[i] = 1;
|
didsomething[i] = 1;
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -84,9 +84,8 @@ upd_buildeff(struct natstr *np, struct sctstr *sp, int *workp,
|
||||||
}
|
}
|
||||||
neweff = n;
|
neweff = n;
|
||||||
*cost += work_cost;
|
*cost += work_cost;
|
||||||
if (opt_BIG_CITY) {
|
if (!n && IS_BIG_CITY(old_type) &&
|
||||||
if (!n && dchr[old_type].d_pkg == UPKG &&
|
!IS_BIG_CITY(*desig)) {
|
||||||
dchr[*desig].d_pkg != UPKG) {
|
|
||||||
int maxpop = max_population(np->nat_level[NAT_RLEV], *desig, n);
|
int maxpop = max_population(np->nat_level[NAT_RLEV], *desig, n);
|
||||||
if (vec[I_CIVIL] > maxpop)
|
if (vec[I_CIVIL] > maxpop)
|
||||||
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);
|
buildeff_work = min((int)(*workp / 2), buildeff_work);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
if (np->nat_priorities[*desig]) {
|
if (np->nat_priorities[*desig]) {
|
||||||
if (*desig == sp->sct_newtype) {
|
if (*desig == sp->sct_newtype) {
|
||||||
work_cost = 100 - neweff;
|
work_cost = 100 - neweff;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue