]> git.pond.sub.org Git - empserver/blobdiff - include/ship.h
Update copyright notice.
[empserver] / include / ship.h
index 41ba7cd5948b5e13ddbe8aaea008f2e53d1e120e..3042e0d602901d56786565bdf6aa89abd7048c84 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 "item.h"
 #include "queue.h"
-#include "misc.h"
 #include "retreat.h"
+#include "types.h"
 
-#define N_MAXSHIPS     40
+#define SHP_TYPE_MAX   46
 #define        SHIP_MINEFF     20
 
 /* bit masks for the autonav mode flags */
 #define        MAXSHPNAMLEN    24
 
 struct shpstr {
-    /* initial part must match struct genitem */
+    /* initial part must match struct empobj */
     short ef_type;
     natid shp_own;             /* owner's country num */
     short shp_uid;             /* unit id (ship #) */
     coord shp_x;               /* x location in abs coords */
     coord shp_y;               /* y location in abs coords */
-    s_char shp_type;           /* index in mchr[] */
-    s_char shp_effic;          /* 0% to 100% */
-    s_char shp_mobil;          /* mobility units */
+    signed char shp_type;      /* index in mchr[] */
+    signed char shp_effic;     /* 0% to 100% */
+    signed char shp_mobil;     /* mobility units */
+    unsigned char shp_off;     /* repairs stopped? */
     short shp_tech;            /* tech level ship was built at */
-    s_char shp_fleet;          /* group membership */
+    char shp_fleet;            /* group membership */
     coord shp_opx, shp_opy;    /* Op sector coords */
     short shp_mission;         /* mission code */
     short shp_radius;          /* mission radius */
-    /* end of part matching struct genitem */
+    /* end of part matching struct empobj */
     unsigned char shp_nplane;  /* number of planes on board */
     unsigned char shp_nland;   /* number of land units on board */
     short shp_armor;
@@ -117,7 +118,7 @@ struct fltelemstr {
 
 struct fltheadstr {
     int leader;
-    s_char real_q;
+    signed char real_q;
 /* defines for the real_q member */
 #define        LEADER_VIRTUAL  0
 #define        LEADER_REAL     1
@@ -178,31 +179,21 @@ struct mchrstr {
 #define M_CANAL                bit(19) /* Can navigate a canal (BIG CITY) */
 #define M_ANTIMISSILE   bit(20)        /* Shoot down missile */
 
-#define getship(n, p) \
-       ef_read(EF_SHIP, n, p)
-#define putship(n, p) \
-       ef_write(EF_SHIP, n, p)
-#define getshipp(n) \
-       (struct shpstr *) ef_ptr(EF_SHIP, n)
-
-extern struct mchrstr mchr[N_MAXSHIPS + 1];
-
-struct mlist {
-    struct emp_qelem queue;    /* list of ships */
-    struct mchrstr *mcp;       /* pointer to desc of ship */
-    struct shpstr ship;                /* struct ship */
-    double mobil;              /* how much mobility the ship has left */
-};
-
-#define SHP_DEF(b, t) (t ? (b * (logx((double)t, (double)40.0) < 1.0 ? 1.0 : \
-                            logx((double)t, (double)40.0))) : b)
-#define SHP_SPD(b, t) (t ? (b * (logx((double)t, (double)35.0) < 1.0 ? 1.0 : \
-                            logx((double)t, (double)35.0))) : b)
-#define SHP_VIS(b, t) (b * (1 - (sqrt((double)t) / 50)))
-#define SHP_RNG(b, t) (t ? (b * (logx((double)t, (double)35.0) < 1.0 ? 1.0 : \
-                            logx((double)t, (double)35.0))) : b)
-#define SHP_FIR(b, t) (t ? (b * (logx((double)t, (double)60.0) < 1.0 ? 1.0 : \
-                            logx((double)t, (double)60.0))) : b)
+#define getship(n, p) ef_read(EF_SHIP, (n), (p))
+#define putship(n, p) ef_write(EF_SHIP, (n), (p))
+#define getshipp(n) (struct shpstr *)ef_ptr(EF_SHIP, (n))
+
+extern struct mchrstr mchr[SHP_TYPE_MAX + 2];
+
+#define SHP_DEF(b, t) (t ? (b * (logx(t, 40.0) < 1.0 ? 1.0 : \
+                                logx(t, 40.0))) : b)
+#define SHP_SPD(b, t) (t ? (b * (logx(t, 35.0) < 1.0 ? 1.0 : \
+                                logx(t, 35.0))) : b)
+#define SHP_VIS(b, t) (b * (1 - (sqrt(t) / 50)))
+#define SHP_RNG(b, t) (t ? (b * (logx(t, 35.0) < 1.0 ? 1.0 : \
+                                logx(t, 35.0))) : b)
+#define SHP_FIR(b, t) (t ? (b * (logx(t, 60.0) < 1.0 ? 1.0 : \
+                                logx(t, 60.0))) : b)
 
 /* Work required for building 100% */
 #define SHP_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm))