]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/detonate.c
Fix trailing whitespace
[empserver] / src / lib / subs / detonate.c
index d3ddd791b19c83baa9ecc1daa069ce430b3d2614..5bbd5fcd772bc2c8f41c09e62f336301b2a59b49 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
  *  ---
  *
  *  detonate.c: Detonate a nuclear device in a sector.
- * 
+ *
  *  Known contributors to this file:
  *     Steve McClure, 1998-2000
  */
 
 #include <config.h>
 
-#include "misc.h"
-#include "player.h"
-#include "xy.h"
-#include "nat.h"
 #include "file.h"
-#include "sect.h"
-#include "nuke.h"
-#include "ship.h"
 #include "land.h"
+#include "lost.h"
+#include "misc.h"
+#include "nat.h"
 #include "news.h"
-#include "plane.h"
 #include "nsc.h"
+#include "nuke.h"
 #include "optlist.h"
+#include "plane.h"
+#include "player.h"
 #include "prototypes.h"
+#include "sect.h"
+#include "ship.h"
+#include "xy.h"
 
 static void kaboom(int x, int y, int rad, natid cn);
 
@@ -97,15 +98,14 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
            continue;
        if (type == SCT_SANCT) {
            mpr(bombown, "bounced off %s\n", xyas(ns.x, ns.y, bombown));
-           if (own != 0)
-               mpr(own, "%s nuclear device bounced off %s\n",
-                   cname(bombown), xyas(ns.x, ns.y, bombown));
+           mpr(own, "%s nuclear device bounced off %s\n",
+               cname(bombown), xyas(ns.x, ns.y, bombown));
            nreport(bombown, N_NUKE, own, 1);
            continue;
        }
        if (opt_FALLOUT)
            fallout = sect.sct_fallout;
-       sect_damage(&sect, damage, 0);
+       sect_damage(&sect, damage);
        if (sect.sct_x == x && sect.sct_y == y)
            retval = damage;
        if (opt_FALLOUT) {
@@ -116,7 +116,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
            sect.sct_fallout = MIN(fallout, FALLOUT_MAX);
        }
        if (damage > 100) {
-           makelost(EF_SECTOR, sect.sct_own, 0, sect.sct_x, sect.sct_y);
            sect.sct_oldown = 0;
            sect.sct_own = 0;
            if (type == SCT_WATER || type == SCT_BSPAN ||
@@ -135,8 +134,6 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
            sprintf(buf, "did %d%%%% damage in %%s\n", damage);
            bp = buf;
        }
-       if ((type == SCT_CAPIT || type == SCT_MOUNT) && damage >= 100)
-           caploss(&sect, own, "\n%s lost its capital!\n\n");
        (void)putsect(&sect);
        if (type != SCT_WATER)
            nreport(bombown, N_NUKE, own, 1);
@@ -156,7 +153,7 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
            continue;
        if ((own = plane.pln_own) == 0)
            continue;
-       if ((plane.pln_flags & PLN_LAUNCHED) && (airburst != 2))
+       if (plane.pln_flags & PLN_LAUNCHED)
            continue;
        damage = nukedamage(ncp, ni.curdist, airburst) - plane.pln_harden;
        if (damage <= 0)
@@ -190,10 +187,9 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
                prplane(&plane),
                xyas(plane.pln_x, plane.pln_y, own), damage);
        } else {
-           if (own != 0)
-               mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
-                   cname(bombown), damage,
-                   prplane(&plane), xyas(plane.pln_x, plane.pln_y, own));
+           mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
+               cname(bombown), damage,
+               prplane(&plane), xyas(plane.pln_x, plane.pln_y, own));
        }
        putplane(ni.cur, &plane);
     }
@@ -238,10 +234,9 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
            mpr(bombown, "%s at %s reports %d%% damage\n",
                prland(&land), xyas(land.lnd_x, land.lnd_y, own), damage);
        } else {
-           if (own != 0)
-               mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
-                   cname(bombown), damage,
-                   prland(&land), xyas(land.lnd_x, land.lnd_y, own));
+           mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
+               cname(bombown), damage,
+               prland(&land), xyas(land.lnd_x, land.lnd_y, own));
        }
        putland(land.lnd_uid, &land);
     }
@@ -280,10 +275,9 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
            mpr(bombown, "%s at %s reports %d%% damage\n",
                prship(&ship), xyas(ship.shp_x, ship.shp_y, own), damage);
        } else {
-           if (own != 0)
-               mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
-                   cname(bombown), damage, prship(&ship),
-                   xyas(ship.shp_x, ship.shp_y, own));
+           mpr(own, "%s nuclear device did %d%% damage to %s at %s\n",
+               cname(bombown), damage, prship(&ship),
+               xyas(ship.shp_x, ship.shp_y, own));
        }
        putship(ship.shp_uid, &ship);
     }
@@ -301,16 +295,13 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
            continue;
        if (roll(100) >= damage)
            continue;
-       makelost(EF_NUKE, nuke.nuk_own, nuke.nuk_uid, nuke.nuk_x,
-                nuke.nuk_y);
-       nuke.nuk_own = 0;
+       nuke.nuk_effic = 0;
        if (own == bombown) {
            mpr(bombown, "%s at %s destroyed\n",
                prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own));
        } else {
-           if (own != 0)
-               mpr(own, "%s at %s destroyed\n",
-                   prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own));
+           mpr(own, "%s at %s destroyed\n",
+               prnuke(&nuke), xyas(nuke.nuk_x, nuke.nuk_y, own));
        }
        putnuke(ni.cur, &nuke);
     }
@@ -325,8 +316,8 @@ detonate(struct nukstr *np, coord x, coord y, int airburst)
 static void
 kaboom(int x, int y, int rad, natid cn)
 {
-    mpr(cn, "\n\nK A B ");
-    while (rad-- > 0)
+    mpr(cn, "\n\nK A B O O ");
+    while (rad-- > 1)
        mpr(cn, "O O ");
     mpr(cn, "M ! in %s\n\n", xyas(x, y, cn));
 }