]> git.pond.sub.org Git - empserver/blobdiff - src/lib/subs/aircombat.c
Update copyright notice
[empserver] / src / lib / subs / aircombat.c
index 2050bc1ed6d206dec7661980285a6f76cb5358dc..daf99ea12e12733dcda9ab67199e29a32392cde7 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2011, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2020, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                Ken Stevens, Steve McClure, Markus Armbruster
  *
  *  Empire is free software: you can redistribute it and/or modify
  *     Dave Pare, 1986
  *     Thomas Ruschak, 1992
  *     Steve McClure, 1996
- *     Markus Armbruster, 2006-2011
+ *     Markus Armbruster, 2006-2014
  */
 
 #include <config.h>
 
-#include "file.h"
+#include "chance.h"
 #include "land.h"
 #include "map.h"
 #include "misc.h"
@@ -45,6 +45,7 @@
 #include "nsc.h"
 #include "optlist.h"
 #include "path.h"
+#include "plague.h"
 #include "plane.h"
 #include "player.h"
 #include "prototypes.h"
@@ -54,8 +55,6 @@
 
 #define FLAK_GUN_MAX 14
 
-static void sam_intercept(struct emp_qelem *, struct emp_qelem *,
-                         natid, natid, coord, coord, int);
 static void ac_intercept(struct emp_qelem *, struct emp_qelem *,
                         struct emp_qelem *, natid, coord, coord, int);
 static void ac_combat_headers(natid, natid);
@@ -66,7 +65,7 @@ static void ac_doflak(struct emp_qelem *, struct sctstr *);
 static void ac_landflak(struct emp_qelem *, coord, coord);
 static void ac_shipflak(struct emp_qelem *, coord, coord);
 static void ac_fireflak(struct emp_qelem *, natid, int);
-static void getilists(struct emp_qelem *, unsigned char *, natid);
+static void getilists(struct emp_qelem *, enum relations[], natid);
 static int do_evade(struct emp_qelem *, struct emp_qelem *);
 
 void
@@ -77,7 +76,7 @@ ac_encounter(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
     int dir;
     unsigned char gotships[MAXNOC];
     unsigned char gotlands[MAXNOC];
-    unsigned char rel[MAXNOC];
+    enum relations rel[MAXNOC];
     int overfly[MAXNOC];
     int flags;
     struct emp_qelem ilist[MAXNOC];
@@ -314,11 +313,7 @@ ac_intercept(struct emp_qelem *bomb_list, struct emp_qelem *esc_list,
     sam_intercept(esc_list, def_list, def_own, plane_owner, x, y,
                  only_mission);
 
-    att_count = 0;
-    for (qp = bomb_list->q_forw; qp != bomb_list; qp = qp->q_forw)
-       att_count++;
-    for (qp = esc_list->q_forw; qp != esc_list; qp = qp->q_forw)
-       att_count++;
+    att_count = emp_quelen(bomb_list) + emp_quelen(esc_list);
     if (!att_count)
        return;
 
@@ -668,7 +663,7 @@ ac_landflak(struct emp_qelem *list, coord x, coord y)
        ngun += flak;
        total += techfact(land.lnd_tech, flak * 2.0);
 
-       mpr(land.lnd_own, "firing flak guns from unit %s (aa rating %d)\n",
+       mpr(land.lnd_own, "firing flak guns from unit %s (AA rating %d)\n",
            prland(&land), aaf);
        from = land.lnd_own;
     }
@@ -746,7 +741,7 @@ ac_flak_dam(int guns, int def, int pl_flags)
  * Get planes available for interception duties.
  */
 static void
-getilists(struct emp_qelem *list, unsigned char *rel, natid intruder)
+getilists(struct emp_qelem *list, enum relations rel[], natid intruder)
 {
     natid cn;
     struct plchrstr *pcp;
@@ -784,6 +779,7 @@ getilists(struct emp_qelem *list, unsigned char *rel, natid intruder)
        /* got one! */
        ip = malloc(sizeof(*ip));
        ip->load = 0;
+       ip->pstage = PLG_HEALTHY;
        ip->pcp = &plchr[(int)plane.pln_type];
        ip->plane = plane;
        emp_insque(&ip->queue, &list[plane.pln_own]);