Don't drill (and deplete) more oil than the ship can hold.

Closes #955071.
This commit is contained in:
Ron Koenderink 2004-08-05 01:32:09 +00:00
parent 8ce25abc1f
commit 743be658c8

View file

@ -170,10 +170,10 @@ upd_ship(register struct shpstr *sp, register int etus,
*/
oil_gained = roundavg((sp->shp_item[I_CIVIL] * etus / 10000.0)
* sectp->sct_oil);
sp->shp_item[I_OIL] += oil_gained;
max_oil = vl_find(V_OIL, mp->m_vtype, mp->m_vamt, mp->m_nv);
if (sp->shp_item[I_OIL] > max_oil)
sp->shp_item[I_OIL] = max_oil;
oil_gained = max_oil - sp->shp_item[I_OIL];
sp->shp_item[I_OIL] += oil_gained;
product = &pchr[P_OIL];
if (product->p_nrdep != 0 && oil_gained > 0) {
resource = ((s_char *)sectp) + product->p_nrndx;