]> git.pond.sub.org Git - empserver/blobdiff - include/land.h
Generation numbers to catch write back of stale copies
[empserver] / include / land.h
index d74db62119f0cc42e7f77367123d0c14789b5d70..d3c174a046e4c443e61a56db5a9ca79de8c20cb9 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
  *  ---
  *
  *  land.h: Definitions for land units
- * 
+ *
  *  Known contributors to this file:
  *     Thomas Ruschak, 1992
  *     Ken Stevens, 1995
  *     Steve McClure, 1998
+ *     Markus Armbruster, 2004-2009
  */
 
 #ifndef LAND_H
 
 struct lndstr {
     /* initial part must match struct empobj */
-    short ef_type;
-    short lnd_uid;             /* unit id (land unit) */
+    signed ef_type: 8;
+    unsigned lnd_seqno: 12;
+    unsigned lnd_generation: 12;
+    int lnd_uid;               /* unit id (land #) */
+    time_t lnd_timestamp;      /* Last time this unit was touched */
     natid lnd_own;             /* owner's country num */
     coord lnd_x;               /* x location in abs coords */
     coord lnd_y;               /* y location in abs coords */
@@ -63,23 +67,17 @@ struct lndstr {
     short lnd_mission;         /* mission code */
     short lnd_radius;          /* mission radius */
     /* end of part matching struct empobj */
-    signed char lnd_flags;     /* unit flags (unused) */
-    short lnd_ship;            /* pointer to transporting ship */
+    int lnd_ship;              /* uid of transporting ship, or -1 */
     signed char lnd_harden;    /* fortification */
     short lnd_retreat;         /* retreat percentage */
-    unsigned char lnd_fuel;    /* How much fuel do we have */
-    unsigned char lnd_nxlight; /* How many xlight planes on board? */
     int lnd_rflags;            /* When do I retreat? */
     char lnd_rpath[RET_LEN];   /* retreat path */
-    unsigned char lnd_rad_max; /* max radius for this unit */
     unsigned char lnd_scar;    /* how experienced the unit is (not used) */
     short lnd_item[I_MAX+1];   /* amount of items on board */
     short lnd_pstage;          /* plague stage */
     short lnd_ptime;           /* how many etus remain in this stage */
-    short lnd_land;            /* pointer to transporting unit */
-    unsigned char lnd_nland;
+    int lnd_land;              /* uid of transporting land unit, or -1 */
     short lnd_access;          /* Last tick mob was updated (MOB_ACCESS) */
-    time_t lnd_timestamp;      /* Last time this unit was touched */
 };
 
 struct lchrstr {
@@ -104,8 +102,6 @@ struct lchrstr {
     int l_dam;                 /* # of guns firing */
     int l_ammo;                        /* firing ammu used per shot */
     int l_aaf;                 /* aa fire */
-    unsigned char l_fuelc;     /* fuel capacity */
-    unsigned char l_fuelu;     /* fuel used per 10 mob */
     unsigned char l_nxlight;   /* maximum number of xlight planes */
     unsigned char l_nland;     /* maximum number of units */
     signed char l_type;                /* index in lchr[] */
@@ -160,7 +156,16 @@ extern int lnd_acc(struct lndstr *);
 extern int lnd_dam(struct lndstr *);
 extern int lnd_aaf(struct lndstr *);
 
+/* src/lib/common/cargo.c */
+extern void lnd_carrier_change(struct lndstr *, int, int, int);
+extern int lnd_first_on_ship(struct shpstr *);
+extern int lnd_first_on_land(struct lndstr *);
+extern int lnd_next_on_unit(int);
+extern int lnd_nxlight(struct lndstr *);
+extern int lnd_nland(struct lndstr *);
+
 extern int lnd_fire(struct lndstr *);
+extern int lnd_sabo(struct lndstr *, short *);
 extern double lnd_fire_range(struct lndstr *);
 
 /* src/lib/subs/lndsub.c */
@@ -174,6 +179,7 @@ extern double lnd_mobcost(struct lndstr *, struct sctstr *);
 
 extern double attack_val(int, struct lndstr *);
 extern double defense_val(struct lndstr *);
+extern int lnd_reaction_range(struct lndstr *);
 extern void lnd_print(struct ulist *, char *);
 extern void lnd_delete(struct ulist *, char *);
 extern int lnd_take_casualty(int, struct ulist *, int);
@@ -181,9 +187,6 @@ extern void lnd_submil(struct lndstr *, int);
 extern void lnd_takemob(struct emp_qelem *, double);
 extern int lnd_spyval(struct lndstr *);
 extern void intelligence_report(int, struct lndstr *, int, char *);
-extern int count_sect_units(struct sctstr *);
-extern void count_units(struct shpstr *);
-extern void lnd_count_units(struct lndstr *);
 extern void lnd_mar(struct emp_qelem *, double *, double *, int *, natid);
 extern int lnd_hardtarget(struct lndstr *);
 extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);