]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/fortdef.c
COPYING duplicates information from README. Remove. Move GPL from
[empserver] / src / lib / subs / fortdef.c
index 912f1add58dd2d1cb777d8bfd356783f8847f449..29579937167e91f154a509b51c717016d42cad9d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -19,9 +19,9 @@
  *
  *  ---
  *
- *  See the "LEGAL", "LICENSE", "CREDITS" and "README" files for all the
- *  related information and legal notices. It is expected that any future
- *  projects/authors will amend these files as needed.
+ *  See files README, COPYING and CREDITS in the root of the source
+ *  tree for related information and legal notices.  It is expected
+ *  that future projects/authors will amend these files as needed.
  *
  *  ---
  *
  *  Known contributors to this file:
  *    
  */
+
 /*
  * The base routines can also be used for general purposes.
  * Noisy tells whther to send teles, print things, etc.
  * Defending tells whether they are being defensive, or offensive.
  */
 
+#include <config.h>
+
 #include "misc.h"
 #include "xy.h"
 #include "nat.h"
@@ -92,7 +95,7 @@ sd(natid att, natid own, coord x, coord y, int noisy, int defending,
            continue;
        if (ship.shp_effic < 60)
            continue;
-       if ((mchr[(int)ship.shp_type].m_flags & M_SUB) && (!usesubs))
+       if ((mchr[(int)ship.shp_type].m_flags & M_SUB) && !usesubs)
            continue;
        range = techfact(ship.shp_tech,
                         ship.shp_frnge * ship.shp_effic / 200.0);
@@ -104,8 +107,8 @@ sd(natid att, natid own, coord x, coord y, int noisy, int defending,
        if (shell < ship.shp_glim)
            shell += supply_commod(ship.shp_own, ship.shp_x, ship.shp_y,
                                   I_SHELL, shell - ship.shp_glim);
-       nshot = min(min(ship.shp_item[I_GUN], shell), ship.shp_item[I_MILIT]);
-       nshot = min(nshot, ship.shp_glim);
+       nshot = MIN(MIN(ship.shp_item[I_GUN], shell), ship.shp_item[I_MILIT]);
+       nshot = MIN(nshot, ship.shp_glim);
        if (nshot <= 0)
            continue;
        ship.shp_item[I_SHELL] = shell - nshot;
@@ -141,29 +144,8 @@ sd(natid att, natid own, coord x, coord y, int noisy, int defending,
            }
        }
     }
-    return (int)100 - (eff * 100);
-}
-
-/*
- * Determine if any nearby gun-equipped sectors are within
- * range and able to fire at an attacker.  Firing sectors
- * need to have guns, shells, and military.  Sector being
- * attacked is x,y -- attacker is at ax,ay.
- */
-#if 0
-/* defdef isn't called anywhere, and uses wrong
- * number of arguments for dd */
-int
-defdef(att, def_own, defval, ax, ay)
-natid att;
-natid def_own;
-int defval;
-coord ax;
-coord ay;
-{
-    return dd(att, def_own, defval, ax, ay, NOISY, 1);
+    return (int)100 - eff * 100;
 }
-#endif
 
 int
 dd(natid att, natid def_own, coord ax, coord ay, int noisy, int defending)
@@ -188,7 +170,7 @@ dd(natid att, natid def_own, coord ax, coord ay, int noisy, int defending)
            continue;
        if (firing.sct_own == 0)
            continue;
-       if (firing.sct_effic < (u_char)FORTEFF)
+       if (firing.sct_effic < FORTEFF)
            continue;
        rel = getrel(getnatp(firing.sct_own), def_own);
        rel2 = getrel(getnatp(firing.sct_own), att);
@@ -231,7 +213,7 @@ sb(natid att, natid def, struct sctstr *sp, coord tx, coord ty, int noisy,
        return 0;
     }
 
-    if (sp->sct_effic < (u_char)FORTEFF)
+    if (sp->sct_effic < FORTEFF)
        return 0;
 
     own = sp->sct_own;