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.
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;
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);
}
/*