(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 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
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -136,18 +136,16 @@ prod(void)
|
|||
type = sect.sct_newtype;
|
||||
eff = 0;
|
||||
}
|
||||
if (opt_BIG_CITY) {
|
||||
if (!eff && dchr[otype].d_pkg == UPKG &&
|
||||
dchr[type].d_pkg != UPKG) {
|
||||
natp = getnatp(sect.sct_own);
|
||||
maxpop = max_population(natp->nat_level[NAT_RLEV],
|
||||
type, eff);
|
||||
work = new_work(§,
|
||||
total_work(sect.sct_work, etu_per_update,
|
||||
civs, sect.sct_item[I_MILIT],
|
||||
uws, maxpop));
|
||||
bwork = min(work / 2, bwork);
|
||||
}
|
||||
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);
|
||||
work = new_work(§,
|
||||
total_work(sect.sct_work, etu_per_update,
|
||||
civs, sect.sct_item[I_MILIT],
|
||||
uws, maxpop));
|
||||
bwork = min(work / 2, bwork);
|
||||
}
|
||||
twork = 100 - eff;
|
||||
if (twork > bwork) {
|
||||
|
|
|
@ -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)
|
||||
maxpop *= 1 + 9.0 * eff / 100;
|
||||
}
|
||||
/* city efficiency limits maximum population */
|
||||
if (IS_BIG_CITY(desig))
|
||||
maxpop *= 1 + 9.0 * eff / 100;
|
||||
|
||||
if (opt_RES_POP) {
|
||||
/* research limits maximum population */
|
||||
|
|
|
@ -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",
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -84,20 +84,18 @@ 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) {
|
||||
int maxpop = max_population(np->nat_level[NAT_RLEV], *desig, n);
|
||||
if (vec[I_CIVIL] > maxpop)
|
||||
vec[I_CIVIL] = maxpop;
|
||||
if (vec[I_UW] > maxpop)
|
||||
vec[I_UW] = maxpop;
|
||||
*workp = (vec[I_CIVIL] * sctwork) / 100.0
|
||||
+ (vec[I_MILIT] * 2 / 5.0) + vec[I_UW];
|
||||
*workp = roundavg((etu * (*workp)) / 100.0);
|
||||
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;
|
||||
if (vec[I_UW] > maxpop)
|
||||
vec[I_UW] = maxpop;
|
||||
*workp = (vec[I_CIVIL] * sctwork) / 100.0
|
||||
+ (vec[I_MILIT] * 2 / 5.0) + vec[I_UW];
|
||||
*workp = roundavg((etu * (*workp)) / 100.0);
|
||||
|
||||
buildeff_work = min((int)(*workp / 2), buildeff_work);
|
||||
}
|
||||
buildeff_work = min((int)(*workp / 2), buildeff_work);
|
||||
}
|
||||
}
|
||||
if (np->nat_priorities[*desig]) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue