Fix mine production resource limit for peffic != 100%
With etu_per_update large and resource depletion quick, a sector can produce more work than is required to fully deplete a mine. In that case, produce() and prod() limit production to what is actually in the ground. Except produce() got it wrong for sector types with production efficiency other than 100%. This affects mountains in the stock game, but only with impractically large etu_per_update.
This commit is contained in:
parent
a61e673a07
commit
e0a2b4ca4c
1 changed files with 4 additions and 4 deletions
|
@ -90,6 +90,10 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
|||
worker_limit = roundavg(work * p_e / unit_work);
|
||||
if (material_consume > worker_limit)
|
||||
material_consume = worker_limit;
|
||||
if (product->p_nrdep != 0) {
|
||||
if (*resource * 100 < product->p_nrdep * material_consume)
|
||||
material_consume = *resource * 100 / product->p_nrdep;
|
||||
}
|
||||
if (material_consume == 0)
|
||||
return 0;
|
||||
prodeff = prod_eff(desig, np->nat_level[product->p_nlndx]);
|
||||
|
@ -114,10 +118,6 @@ produce(struct natstr *np, struct sctstr *sp, short *vec, int work,
|
|||
actual = roundavg(output);
|
||||
if (actual <= 0)
|
||||
return 0;
|
||||
if (product->p_nrdep != 0) {
|
||||
if (*resource * 100 < product->p_nrdep * actual)
|
||||
actual = *resource * 100 / product->p_nrdep;
|
||||
}
|
||||
if (actual > 999) {
|
||||
material_consume = roundavg(999.0 * material_consume / actual);
|
||||
actual = 999;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue