Clean up ac_planedamage() a bit

Reshuffle code for clarity, and delete a bogus comment.
This commit is contained in:
Markus Armbruster 2010-06-16 21:26:19 +02:00
parent 22834d6793
commit 5bb4846267

View file

@ -515,9 +515,6 @@ ac_dog(struct plist *ap, struct plist *dp)
/* /*
* zap plane associated with plp. * zap plane associated with plp.
* Damaging country is "from", damage is "dam". * 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 * NOTE: This routine removes the appropriate plane element from the
* queue if it gets destroyed. That means that the caller must assume * 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) char *mesg)
{ {
struct plnstr *pp; struct plnstr *pp;
int disp; int eff, disp;
int eff;
disp = 0;
pp = &plp->plane;
eff = pp->pln_effic;
*mesg = 0; *mesg = 0;
if (dam <= 0) { if (dam <= 0) {
snprintf(mesg, 14, " no damage"); snprintf(mesg, 14, " no damage");
return; return;
} }
eff -= dam;
pp = &plp->plane;
eff = pp->pln_effic - dam;
if (eff < 0) if (eff < 0)
eff = 0; eff = 0;
disp = 0;
if (eff < PLANE_MINEFF) { if (eff < PLANE_MINEFF) {
snprintf(mesg, 14, " shot down"); snprintf(mesg, 14, " shot down");
disp = 1; disp = 1;