Make depth charges work with just one shell

Commit a3ad623b (v4.3.12) made depth charging fail when there's just
one shell.  This let players find all submarine uids.  It basically
reopened the loophole closed in commit aa26c53e (v4.2.20).

Fix by making shp_dchrg() with just one shell succeed and return
damage like fire from one gun.
This commit is contained in:
Markus Armbruster 2008-05-04 19:02:15 +02:00
parent 66165f34cb
commit cd6d12c4fb

View file

@ -135,7 +135,7 @@ shp_fire(struct shpstr *sp)
int
shp_dchrg(struct shpstr *sp)
{
int shells;
int shells, dchrgs;
if (sp->shp_effic < 60 || (mchr[sp->shp_type].m_flags & M_DCH) == 0)
return -1;
@ -144,10 +144,11 @@ shp_dchrg(struct shpstr *sp)
shells = sp->shp_item[I_SHELL];
shells += supply_commod(sp->shp_own, sp->shp_x, sp->shp_y,
I_SHELL, 2 - shells);
if (shells < 2)
if (shells == 0)
return -1;
sp->shp_item[I_SHELL] = shells - 2;
return (int)seagun(sp->shp_effic, 3);
dchrgs = MIN(2, shells);
sp->shp_item[I_SHELL] = shells - dchrgs;
return (int)seagun(sp->shp_effic, 2 * dchrgs - 1);
}
/*