]> git.pond.sub.org Git - empserver/blobdiff - include/ship.h
Generation numbers to catch write back of stale copies
[empserver] / include / ship.h
index c3e24a44ecfc9af059711e85d30141a7b61e3fd9..a8762d5783ffcd20b72a0916494c991d260c030d 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
  *  ---
  *
  *  ship.h: Definitions for things having to do with ships
- * 
+ *
  *  Known contributors to this file:
  *     Dave Pare
  *     Thomas Ruschak, 1992
  *     Ken Stevens, 1995
  *     Steve McClure, 1998
+ *     Markus Armbruster, 2004-2008
  */
 
 #ifndef SHIP_H
@@ -64,6 +65,9 @@ struct shpstr {
     /* initial part must match struct empobj */
     short ef_type;
     short shp_uid;             /* unit id (ship #) */
+    unsigned shp_seqno;
+    unsigned shp_generation;
+    time_t shp_timestamp;      /* Last time this ship was touched. */
     natid shp_own;             /* owner's country num */
     coord shp_x;               /* x location in abs coords */
     coord shp_y;               /* y location in abs coords */
@@ -77,13 +81,6 @@ struct shpstr {
     short shp_mission;         /* mission code */
     short shp_radius;          /* mission radius */
     /* 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;
-    short shp_speed;
-    short shp_visib;
-    short shp_frnge;
-    short shp_glim;
     coord shp_destx[2];                /* location for ship destination */
     coord shp_desty[2];
     i_type shp_tstart[TMAX];   /* what goods to pick up at start point */
@@ -95,14 +92,10 @@ struct shpstr {
     short shp_pstage;          /* plague stage */
     short shp_ptime;           /* how many etus remain in this stage */
     short shp_access;          /* Last tick mob was updated (MOB_ACCESS) */
-    time_t shp_timestamp;      /* Last time this ship was touched. */
     unsigned char shp_mobquota;        /* mobility quota */
     char shp_path[MAXSHPPATH];
     short shp_follow;
     char shp_name[MAXSHPNAMLEN]; /* name set with the "name" command */
-    unsigned char shp_fuel;    /* How much fuel do we have */
-    unsigned char shp_nchoppers; /* How many choppers on board? */
-    unsigned char shp_nxlight; /* How many xlight planes on board? */
     coord shp_orig_x;
     coord shp_orig_y;          /* Where we were built */
     natid shp_orig_own;                /* Who built us */
@@ -122,8 +115,6 @@ struct mchrstr {
     int m_glim;                        /* how many guns it can fire */
     unsigned char m_nxlight;   /* maximum number of xlight planes */
     unsigned char m_nchoppers; /* maximum number of choppers */
-    unsigned char m_fuelc;     /* fuel capacity */
-    unsigned char m_fuelu;     /* fuel used per 10 mob */
     char *m_name;              /* full name of type of ship */
     int m_tech;                        /* tech required to build */
     int m_cost;                        /* how much it costs to build */
@@ -152,7 +143,7 @@ struct mchrstr {
 #define M_SEMILAND     bit(14) /* can land 1/4 */
 /* unused              bit(15) */
 /* unused              bit(16) */
-#define M_OILER                bit(17) /* can re-fuel ships */
+/* unused              bit(17) */
 #define M_SUPPLY       bit(18) /* Can supply units/sects/ships */
 #define M_CANAL                bit(19) /* Can navigate a canal (BIG CITY) */
 #define M_ANTIMISSILE   bit(20)        /* Shoot down missile */
@@ -182,8 +173,20 @@ extern int m_speed(struct mchrstr *, int);
 extern int m_visib(struct mchrstr *, int);
 extern int m_frnge(struct mchrstr *, int);
 extern int m_glim(struct mchrstr *, int);
+extern int shp_armor(struct shpstr *);
+extern int shp_speed(struct shpstr *);
+extern int shp_visib(struct shpstr *);
+extern int shp_frnge(struct shpstr *);
+extern int shp_glim(struct shpstr *);
+
+extern int shp_nplane(struct shpstr *, int *, int *, int *);
+extern int shp_nland(struct shpstr *);
 
 extern int shp_dchrg(struct shpstr *);
 extern int shp_fire(struct shpstr *);
+extern int shp_torp(struct shpstr *, int);
+extern double shp_fire_range(struct shpstr *);
+extern int shp_usable_guns(struct shpstr *);
+extern double shp_torp_hitchance(struct shpstr *, int);
 
 #endif