]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/bomb.c
Fix confused and buggy bridge splashing code
[empserver] / src / lib / commands / bomb.c
index c10dfb06eee5be36ad99b2e43ecdab3fab3cbe95..72e4f1f95d34fd3bb133a51899dabc021a7c6db5 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
 #include <config.h>
 
 #include <ctype.h>
-#include <string.h>
-#include "misc.h"
-#include "player.h"
-#include "sect.h"
-#include "ship.h"
-#include "land.h"
+#include "commands.h"
+#include "damage.h"
 #include "item.h"
-#include "plane.h"
-#include "retreat.h"
-#include "xy.h"
-#include "nsc.h"
+#include "land.h"
 #include "news.h"
-#include "file.h"
-#include "nat.h"
-#include "path.h"
 #include "optlist.h"
-#include "damage.h"
-#include "commands.h"
+#include "path.h"
+#include "plane.h"
+#include "retreat.h"
+#include "ship.h"
 
 static void pin_bomb(struct emp_qelem *list, struct sctstr *target);
 static void strat_bomb(struct emp_qelem *list, struct sctstr *target);
@@ -377,14 +369,7 @@ eff_bomb(struct emp_qelem *list, struct sctstr *target)
           "%s bombing raid did %d%% damage in %s\n",
           cname(player->cnum), oldeff - target->sct_effic,
           xyas(target->sct_x, target->sct_y, target->sct_own));
-    if (target->sct_effic < SCT_MINEFF) {
-       if (target->sct_type == SCT_BSPAN)
-           knockdown(target, list);
-       else if (target->sct_type == SCT_BTOWER) {
-           knockdown(target, list);
-           bridgefall(target, list);
-       }
-    }
+    bridge_damaged(target, list);
     putsect(&sect);
     collateral_damage(target->sct_x, target->sct_y, dam, list);
 }
@@ -864,14 +849,7 @@ pinflak_planedamage(struct plnstr *pp, struct plchrstr *pcp, natid from,
     natid plane_owner;
     int dam;
 
-    flak -= pp->pln_def;
-    if ((pcp->pl_flags & P_T) == 0)
-       flak--;
-    if (pcp->pl_flags & P_X)
-       flak -= 2;
-    if (pcp->pl_flags & P_H)
-       flak -= 1;
-    dam = ac_flak_dam(flak);
+    dam = ac_flak_dam(flak, pp->pln_def, pcp->pl_flags);
     disp = 0;
     plane_owner = pp->pln_own;
     eff = pp->pln_effic;
@@ -885,7 +863,7 @@ pinflak_planedamage(struct plnstr *pp, struct plchrstr *pcp, natid from,
        sprintf(dmess, " -- shot down");
        disp = 1;
     } else if (chance((100 - eff) / 100.0)) {
-       sprintf(dmess, " -- aborted with %d%%%% damage", 100 - eff);
+       sprintf(dmess, " -- aborted with %d%% damage", 100 - eff);
        disp = 2;
     }
     PR(plane_owner, "    Flak! %s %s takes %d%s.\n",