/*
* 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
*
* ---
*
- * 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"
#include "news.h"
#include "nsc.h"
#include "file.h"
-#include "options.h"
#include "optlist.h"
#include "prototypes.h"
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);
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;
}
}
}
- 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)
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);
return 0;
}
- if (sp->sct_effic < (u_char)FORTEFF)
+ if (sp->sct_effic < FORTEFF)
return 0;
own = sp->sct_own;