(max_population): New, factored out of max_pop().
(max_pop): Use it. Don't support null argument anymore. (nati, gen_power): Use max_population() instead of max_pop() with null argument. (show_sect_stats): Use max_population() to simplify the code. (prod, upd_buildeff): Use max_population() to get correct new maximum population for limiting work when tearing down a big city. Previously, this was broken in upd_buildeff(). In prod(), it was broken when the new designation had odd maximum population, which should not occur.
This commit is contained in:
parent
f8b2860ec5
commit
ff67d93711
7 changed files with 20 additions and 14 deletions
|
@ -95,7 +95,7 @@ nati(void)
|
|||
pr(" Plague factor : %6.2f%%\n", pfac);
|
||||
pr("\n");
|
||||
|
||||
poplimit = max_pop(natp->nat_level[NAT_RLEV], 0);
|
||||
poplimit = max_population(natp->nat_level[NAT_RLEV], SCT_MINE, 0);
|
||||
pr("Max population : %d\n", poplimit);
|
||||
|
||||
safepop =
|
||||
|
|
|
@ -329,7 +329,7 @@ gen_power(void)
|
|||
|
||||
if (opt_RES_POP) {
|
||||
np = getnatp(i);
|
||||
maxpop = max_pop(np->nat_level[NAT_RLEV], 0);
|
||||
maxpop = max_population(np->nat_level[NAT_RLEV], SCT_MINE, 0);
|
||||
f = 1.0 + (((float)maxpop) / 10000.0);
|
||||
}
|
||||
powbuf[i].p_power *= f;
|
||||
|
|
|
@ -144,8 +144,10 @@ prod(void)
|
|||
if (!eff && dchr[otype].d_pkg == UPKG &&
|
||||
dchr[type].d_pkg != UPKG) {
|
||||
natp = getnatp(sect.sct_own);
|
||||
civs = min(civs, max_pop(natp->nat_level[NAT_RLEV], 0));
|
||||
uws = min(uws, max_pop(natp->nat_level[NAT_RLEV], 0));
|
||||
maxpop = max_population(natp->nat_level[NAT_RLEV],
|
||||
type, eff);
|
||||
civs = min(civs, maxpop);
|
||||
uws = min(uws, maxpop);
|
||||
wforce = (int)(((double)civs * sect.sct_work) / 100.0
|
||||
+ uws
|
||||
+ sect.sct_item[I_MILIT] * 2 / 5.0);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue