]> git.pond.sub.org Git - empserver/blobdiff - src/lib/commands/mfir.c
Update copyright notice.
[empserver] / src / lib / commands / mfir.c
index e645b79d40a2b9bea00314638cb845771eca44f0..d205618886298e97fa48ef6a69190e1d7ca7fa76 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-2007, 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 "misc.h"
-#include "player.h"
-#include "xy.h"
-#include "treaty.h"
-#include "nat.h"
-#include "ship.h"
-#include "land.h"
-#include "sect.h"
-#include "retreat.h"
-#include "news.h"
-#include "nsc.h"
-#include "file.h"
-#include "queue.h"
-#include <ctype.h>
-#include "optlist.h"
-#include "damage.h"
 #include "commands.h"
+#include "damage.h"
+#include "empobj.h"
+#include "optlist.h"
+#include "retreat.h"
 
 enum targ_type {
     targ_land, targ_ship, targ_sub, targ_unit, targ_bogus
@@ -64,12 +52,6 @@ struct flist {
     int victim;                        /* who I was shooting at */
 };
 
-union item_u {
-    struct shpstr ship;
-    struct sctstr sect;
-    struct lndstr land;
-};
-
 static void add_to_fired_queue(struct emp_qelem *, struct emp_qelem *);
 static int defend(struct emp_qelem *al,
                  struct emp_qelem *dl,
@@ -120,7 +102,7 @@ multifire(void)
     char *p;
     int nfiring = 0;
     int ndefending = 0;
-    union item_u item;
+    union empobj_storage item;
     struct emp_qelem fired, defended;
     double odds;
     char buf[1024];
@@ -342,8 +324,8 @@ multifire(void)
                continue;
            }
            if (fship.shp_effic < 60) {
-               pr("Ship #%d is crippled (%d%%)\n", fshipno,
-                  fship.shp_effic);
+               pr("Ship #%d is crippled (%d%%)\n",
+                  fshipno, fship.shp_effic);
                continue;
            }
            range = effrange(fship.shp_frnge, fship.shp_tech);
@@ -364,7 +346,7 @@ multifire(void)
            shots = gun;
            guneff = seagun(fship.shp_effic, shots);
            dam = (int)guneff;
-           shell -= ldround(((double)shots) / 2.0, 1);
+           shell -= ldround(shots / 2.0, 1);
            fship.shp_item[I_SHELL] = shell;
            if (opt_NOMOBCOST == 0)
                fship.shp_mobil = MAX(fship.shp_mobil - 15, -100);
@@ -414,8 +396,8 @@ multifire(void)
            dam = (int)landunitgun(fland.lnd_effic, fland.lnd_dam, gun,
                                   fland.lnd_ammo, shell);
            if (target == targ_ship) {
-               if (chance(((double)fland.lnd_acc) / 100.0))
-                   dam = ldround(((double)dam / 2.0), 1);
+               if (chance(fland.lnd_acc / 100.0))
+                   dam = ldround(dam / 2.0, 1);
            }
            use_supply(&fland);
            resupply_commod(&fland, I_SHELL);   /* Get more shells */
@@ -554,7 +536,7 @@ multifire(void)
            prb *= prb;
            if (chance(prb)) {
                pr("Wind deflects shell%s.\n", splur(shots));
-/*                     dam = (int)((double)dam / 2.0);*/
+/*                     dam = (int)(dam / 2.0);*/
                dam *= (90 - (random() % 11)) / 100.0;
                if (dam < 0)
                    dam = 0;
@@ -713,7 +695,7 @@ do_defdam(struct emp_qelem *list, double odds)
            pr("\nDefenders fire back!\n");
            first = 0;
        }
-       dam = (odds * (double)fp->defdam);
+       dam = odds * fp->defdam;
 
        if (fp->type == targ_ship) {
            vict = fp->victim;