(total_work): Remove redundant conversion to int.
(total_work): New parameter maxpop. Callers changed. (newe, prod): Use total_work(). Old code failed to limit military workers, thus didn't match the update. (do_feed): Simplify.
This commit is contained in:
parent
43d07b458d
commit
5ba8cab9b5
6 changed files with 40 additions and 43 deletions
|
@ -84,7 +84,6 @@ prod(void)
|
|||
int there;
|
||||
int unit_work; /* sum of component amounts */
|
||||
int used; /* production w/infinite workforce */
|
||||
int wforce;
|
||||
i_type it;
|
||||
i_type vtype;
|
||||
u_char *resource;
|
||||
|
@ -113,15 +112,12 @@ prod(void)
|
|||
uws = (1.0 + uwbrate * etu_per_update) * sect.sct_item[I_UW];
|
||||
natp = getnatp(sect.sct_own);
|
||||
maxpop = max_pop(natp->nat_level[NAT_RLEV], §);
|
||||
civs = min(civs, maxpop);
|
||||
uws = min(uws, maxpop);
|
||||
|
||||
/* This isn't quite right, since research might rise/fall */
|
||||
/* during the update, but it's the best we can really do */
|
||||
wforce = (int)(((double)civs * sect.sct_work) / 100.0
|
||||
+ uws
|
||||
+ sect.sct_item[I_MILIT] * 2.0 / 5.0);
|
||||
work = new_work(§, wforce * etu_per_update / 100);
|
||||
work = new_work(§,
|
||||
total_work(sect.sct_work, etu_per_update,
|
||||
civs, sect.sct_item[I_MILIT], uws, maxpop));
|
||||
bwork = work / 2;
|
||||
|
||||
if (sect.sct_off)
|
||||
|
@ -146,13 +142,11 @@ prod(void)
|
|||
natp = getnatp(sect.sct_own);
|
||||
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);
|
||||
work = etu_per_update * wforce / 100;
|
||||
bwork = min((int)(work / 2), bwork);
|
||||
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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue