From c40dd61bf0639414fa94312b950112469bebad67 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Fri, 27 Jun 2008 06:53:43 -0400 Subject: [PATCH] Don't unlimber when guns unsuccessfully try to fire This happened when fire command failed becayse the gun lacked shells, and when other ways to fire failed because the gun was inefficient, embarked, lacked mil, guns or shells. Broken in commit b8bdc32b, hvy-metal-2.4. --- src/lib/commands/mfir.c | 2 -- src/lib/subs/landgun.c | 1 + src/lib/subs/lndsub.c | 1 - src/lib/subs/mission.c | 1 - 4 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/lib/commands/mfir.c b/src/lib/commands/mfir.c index d277727b..5c65583c 100644 --- a/src/lib/commands/mfir.c +++ b/src/lib/commands/mfir.c @@ -349,7 +349,6 @@ multifire(void) range2 = -1; } - lnd_unlimber(&fland); dam = lnd_fire(&fland); putland(fland.lnd_uid, &fland); if (dam < 0) { @@ -713,7 +712,6 @@ quiet_bigdef(int type, struct emp_qelem *list, natid own, natid aown, if (fp) dam2 = fp->defdam; else { - lnd_unlimber(&land); dam2 = lnd_fire(&land); putland(land.lnd_uid, &land); } diff --git a/src/lib/subs/landgun.c b/src/lib/subs/landgun.c index a6a21da9..160b403d 100644 --- a/src/lib/subs/landgun.c +++ b/src/lib/subs/landgun.c @@ -207,6 +207,7 @@ lnd_fire(struct lndstr *lp) I_SHELL, ammo - shells); if (shells == 0) return -1; + lnd_unlimber(lp); d = landunitgun(lp->lnd_effic, guns); if (shells < ammo) { d *= (double)shells / (double)ammo; diff --git a/src/lib/subs/lndsub.c b/src/lib/subs/lndsub.c index 62cfd821..12f8ecc7 100644 --- a/src/lib/subs/lndsub.c +++ b/src/lib/subs/lndsub.c @@ -1142,7 +1142,6 @@ lnd_support(natid victim, natid attacker, coord x, coord y, int defending) if (dist > range) continue; - lnd_unlimber(&land); dam2 = lnd_fire(&land); putland(land.lnd_uid, &land); if (dam2 < 0) diff --git a/src/lib/subs/mission.c b/src/lib/subs/mission.c index f4d1bf13..2f147f47 100644 --- a/src/lib/subs/mission.c +++ b/src/lib/subs/mission.c @@ -445,7 +445,6 @@ perform_mission(coord x, coord y, natid victim, struct emp_qelem *list, if (md > range) continue; - lnd_unlimber(lp); dam2 = lnd_fire(lp); putland(lp->lnd_uid, lp); if (dam2 < 0)