(prod, nati): Use max_pop() instead of hardcoded values. Before,

struct dchrstr member d_maxpop had no effect in some cases.
This commit is contained in:
Markus Armbruster 2005-02-13 18:25:30 +00:00
parent 41da51e548
commit f8b2860ec5
2 changed files with 8 additions and 20 deletions

View file

@ -95,8 +95,6 @@ nati(void)
pr(" Plague factor : %6.2f%%\n", pfac); pr(" Plague factor : %6.2f%%\n", pfac);
pr("\n"); pr("\n");
poplimit = 999;
if (opt_RES_POP)
poplimit = max_pop(natp->nat_level[NAT_RLEV], 0); poplimit = max_pop(natp->nat_level[NAT_RLEV], 0);
pr("Max population : %d\n", poplimit); pr("Max population : %d\n", poplimit);

View file

@ -109,10 +109,8 @@ prod(void)
if (!player->owner) if (!player->owner)
continue; continue;
civs = min(9999, (int)((obrate * etu_per_update + 1.0) civs = (1.0 + obrate * etu_per_update) * sect.sct_item[I_CIVIL];
* sect.sct_item[I_CIVIL])); uws = (1.0 + uwbrate * etu_per_update) * sect.sct_item[I_UW];
uws = min(9999, (int)((uwbrate * etu_per_update + 1.0)
* sect.sct_item[I_UW]));
natp = getnatp(sect.sct_own); natp = getnatp(sect.sct_own);
maxpop = max_pop(natp->nat_level[NAT_RLEV], &sect); maxpop = max_pop(natp->nat_level[NAT_RLEV], &sect);
civs = min(civs, maxpop); civs = min(civs, maxpop);
@ -145,16 +143,9 @@ prod(void)
if (opt_BIG_CITY) { if (opt_BIG_CITY) {
if (!eff && dchr[otype].d_pkg == UPKG && if (!eff && dchr[otype].d_pkg == UPKG &&
dchr[type].d_pkg != UPKG) { dchr[type].d_pkg != UPKG) {
if (opt_RES_POP) {
natp = getnatp(sect.sct_own); natp = getnatp(sect.sct_own);
civs = min(civs, civs = min(civs, max_pop(natp->nat_level[NAT_RLEV], 0));
max_pop(natp->nat_level[NAT_RLEV], 0)); uws = min(uws, max_pop(natp->nat_level[NAT_RLEV], 0));
uws = min(uws,
max_pop(natp->nat_level[NAT_RLEV], 0));
} else {
civs = min(9999, civs);
uws = min(9999, uws);
}
wforce = (int)(((double)civs * sect.sct_work) / 100.0 wforce = (int)(((double)civs * sect.sct_work) / 100.0
+ uws + uws
+ sect.sct_item[I_MILIT] * 2 / 5.0); + sect.sct_item[I_MILIT] * 2 / 5.0);
@ -320,10 +311,9 @@ prod(void)
int enlisted; int enlisted;
int civs; int civs;
civs = min(999, (int)((obrate * etu_per_update + 1.0) civs = (1.0 + obrate * etu_per_update) * sect.sct_item[I_CIVIL];
* sect.sct_item[I_CIVIL]));
natp = getnatp(sect.sct_own); natp = getnatp(sect.sct_own);
maxpop = max_pop((float)natp->nat_level[NAT_RLEV], &sect); maxpop = max_pop(natp->nat_level[NAT_RLEV], &sect);
civs = min(civs, maxpop); civs = min(civs, maxpop);
/* This isn't quite right, since research might /* This isn't quite right, since research might
rise/fall during the update, but it's the best rise/fall during the update, but it's the best