Factor prod_resource_limit() out of produce() and prod()
This commit is contained in:
parent
ec60098c36
commit
ba2600e7db
3 changed files with 23 additions and 9 deletions
|
@ -82,6 +82,7 @@ prod(void)
|
|||
int there;
|
||||
int unit_work; /* sum of component amounts */
|
||||
int used; /* production w/infinite workforce */
|
||||
int res_limit;
|
||||
i_type it;
|
||||
i_type vtype;
|
||||
unsigned char *resource;
|
||||
|
@ -227,10 +228,9 @@ prod(void)
|
|||
* workforce?
|
||||
*/
|
||||
max = (int)(work * p_e / (double)unit_work + 0.5);
|
||||
if (resource && pp->p_nrdep != 0) {
|
||||
if (*resource * 100 < pp->p_nrdep * max)
|
||||
max = *resource * 100 / pp->p_nrdep;
|
||||
}
|
||||
res_limit = prod_resource_limit(pp, resource);
|
||||
if (max > res_limit)
|
||||
max = res_limit;
|
||||
act = MIN(used, max);
|
||||
|
||||
real = (double)act * prodeff;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue