]> git.pond.sub.org Git - empserver/blobdiff - src/lib/common/sectdamage.c
Update copyright notice.
[empserver] / src / lib / common / sectdamage.c
index 7694a14006fed7a782024c13a909e8e140bf290c..e17e9579fea5a16391c3e829e28ac22f224b95ee 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-2007, 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.
  *
  *  ---
  *
  *     Steve McClure, 1996
  */
 
+#include <config.h>
+
+#include "combat.h"
+#include "damage.h"
+#include "file.h"
+#include "land.h"
 #include "misc.h"
+#include "nat.h"
+#include "nsc.h"
+#include "optlist.h"
+#include "plane.h"
+#include "prototypes.h"
 #include "sect.h"
 #include "ship.h"
-#include "land.h"
-#include "plane.h"
-#include "nuke.h"
 #include "xy.h"
-#include "nsc.h"
-#include "file.h"
-#include "nat.h"
-#include "optlist.h"
-#include "damage.h"
-#include "common.h"
-#include "gen.h"
-#include "subs.h"
-#include "lost.h"
-#include "combat.h"
 
 int
 sect_damage(struct sctstr *sp, int dam, struct emp_qelem *list)
@@ -65,8 +63,6 @@ sect_damage(struct sctstr *sp, int dam, struct emp_qelem *list)
     sp->sct_road = damage(sp->sct_road, dam);
     sp->sct_rail = damage(sp->sct_rail, dam);
     sp->sct_defense = damage(sp->sct_defense, dam);
-    if (!opt_DEFENSE_INFRA)
-       sp->sct_defense = sp->sct_effic;
 
     eff = dam;
 
@@ -90,16 +86,12 @@ sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
     struct nstr_item ni;
     struct lndstr land;
     struct plnstr plane;
-    double real_dam;
     int eff;
 
     /* Some sectors are harder/easier to kill..   */
     /* Average sector has a dstr of 1, so adjust  */
     /* the damage accordingly. Makes forts a pain */
-
-/*     real_dam = (double)dam * (1.0/((((double)(dchr[sp->sct_type].d_dstr - 1))*(sp->sct_effic/100.0)) + 1.0));*/
-    real_dam = (double)dam *(1.0 / sector_strength(sp));
-    dam = ldround(real_dam, 1);
+    dam = ldround(dam / sector_strength(sp), 1);
 
     eff = sect_damage(sp, PERCENT_DAMAGE(dam), list);
 
@@ -110,7 +102,7 @@ sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
        return eff;
 
     snxtitem_xy(&ni, EF_LAND, sp->sct_x, sp->sct_y);
-    while (nxtitem(&ni, (s_char *)&land)) {
+    while (nxtitem(&ni, &land)) {
        if (!land.lnd_own)
            continue;
        landdamage(&land, dam);
@@ -121,7 +113,7 @@ sectdamage(struct sctstr *sp, int dam, struct emp_qelem *list)
     if (dam <= 0)
        return eff;
     snxtitem_xy(&ni, EF_PLANE, sp->sct_x, sp->sct_y);
-    while (nxtitem(&ni, (s_char *)&plane)) {
+    while (nxtitem(&ni, &plane)) {
        if (!plane.pln_own)
            continue;
        if (plane.pln_flags & PLN_LAUNCHED)