From 5bb48462676a66cd2f10e545934aa29bc0c60939 Mon Sep 17 00:00:00 2001 From: Markus Armbruster Date: Wed, 16 Jun 2010 21:26:19 +0200 Subject: [PATCH] Clean up ac_planedamage() a bit Reshuffle code for clarity, and delete a bogus comment. --- src/lib/subs/aircombat.c | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/src/lib/subs/aircombat.c b/src/lib/subs/aircombat.c index e21ce687..3a778da2 100644 --- a/src/lib/subs/aircombat.c +++ b/src/lib/subs/aircombat.c @@ -515,9 +515,6 @@ ac_dog(struct plist *ap, struct plist *dp) /* * zap plane associated with plp. * Damaging country is "from", damage is "dam". - * def_own is the country on the other side of the conflict from the plane - * owner. The only time def_own != from is when the interceptor is getting - * damaged. * * NOTE: This routine removes the appropriate plane element from the * queue if it gets destroyed. That means that the caller must assume @@ -529,20 +526,20 @@ ac_planedamage(struct plist *plp, natid from, int dam, int flak, char *mesg) { struct plnstr *pp; - int disp; - int eff; + int eff, disp; - disp = 0; - pp = &plp->plane; - eff = pp->pln_effic; *mesg = 0; if (dam <= 0) { snprintf(mesg, 14, " no damage"); return; } - eff -= dam; + + pp = &plp->plane; + eff = pp->pln_effic - dam; if (eff < 0) eff = 0; + + disp = 0; if (eff < PLANE_MINEFF) { snprintf(mesg, 14, " shot down"); disp = 1;