Disable some incorrect uses of supply_commod()
Because supply_commod() updates supply sources it used, the caller must not cache objects that could be supply sources across a supply call. This is very easy to get wrong. ac_doflak() supplies flak shells if the sector hasn't enough for its guns. It caches the sector that receives them. If the sector has some shells, but not enough, it supplies them to itself, causing it to be updated from within supply_commod(). ac_doflak() then adds the supplied shells to its cached sector, then writes that back. This doubles shells already there, and triggers a a seqno mismatch oops. shp_missile_defense() has similar problems, only for ships. Disable ac_doflak() and shp_missile_defense() for now, to at least reduce the oopsing to manageable levels. Most likely other calls of supply_commod() are also wrong. Many of them can't be just disabled, because supply is too relevant to gameplay there.
This commit is contained in:
parent
b313b61cd4
commit
f7d6181717
2 changed files with 12 additions and 0 deletions
|
@ -770,12 +770,18 @@ ac_doflak(struct emp_qelem *list, struct sctstr *from)
|
||||||
|
|
||||||
gun = MIN(FLAK_GUN_MAX, from->sct_item[I_GUN]);
|
gun = MIN(FLAK_GUN_MAX, from->sct_item[I_GUN]);
|
||||||
shell = from->sct_item[I_SHELL];
|
shell = from->sct_item[I_SHELL];
|
||||||
|
#if 0
|
||||||
|
/*
|
||||||
|
* FIXME can supply from itself, causing seqno mismatch oops
|
||||||
|
* further down
|
||||||
|
*/
|
||||||
if (gun > shell * 2) {
|
if (gun > shell * 2) {
|
||||||
shell += supply_commod(from->sct_own, from->sct_x, from->sct_y,
|
shell += supply_commod(from->sct_own, from->sct_x, from->sct_y,
|
||||||
I_SHELL, (gun + 1) / 2 - shell);
|
I_SHELL, (gun + 1) / 2 - shell);
|
||||||
from->sct_item[I_SHELL] = shell;
|
from->sct_item[I_SHELL] = shell;
|
||||||
putsect(from);
|
putsect(from);
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (gun > shell * 2)
|
if (gun > shell * 2)
|
||||||
gun = shell * 2;
|
gun = shell * 2;
|
||||||
|
|
||||||
|
|
|
@ -867,12 +867,18 @@ shp_missile_defense(coord dx, coord dy, natid bombown, int hardtarget)
|
||||||
shell = ship.shp_item[I_SHELL];
|
shell = ship.shp_item[I_SHELL];
|
||||||
if (ship.shp_item[I_MILIT] < 1) /* do we have mil? */
|
if (ship.shp_item[I_MILIT] < 1) /* do we have mil? */
|
||||||
continue;
|
continue;
|
||||||
|
#if 0
|
||||||
|
/*
|
||||||
|
* FIXME can supply from itself, causing seqno mismatch oops
|
||||||
|
* further down
|
||||||
|
*/
|
||||||
if (shell < 2) { /* do we need shells */
|
if (shell < 2) { /* do we need shells */
|
||||||
shell += supply_commod(ship.shp_own, ship.shp_x, ship.shp_y,
|
shell += supply_commod(ship.shp_own, ship.shp_x, ship.shp_y,
|
||||||
I_SHELL, 2);
|
I_SHELL, 2);
|
||||||
if (shell < 2)
|
if (shell < 2)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
if (ship.shp_item[I_GUN] < 1) /* we need at least 1 gun */
|
if (ship.shp_item[I_GUN] < 1) /* we need at least 1 gun */
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue