]> git.pond.sub.org Git - empserver/blobdiff - include/land.h
(lnd_mobtype): New.
[empserver] / include / land.h
index 461e6e0cf99e8e132ca523b34952fa42d2ee2f28..e3648f0c9aec73469ef6df397730077745146cb0 100644 (file)
@@ -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.
  *
  *  ---
  *
@@ -54,30 +54,31 @@ struct lndstr {
     short lnd_uid;             /* unit id (land unit) */
     coord lnd_x;               /* x location in abs coords */
     coord lnd_y;               /* y location in abs coords */
-    s_char lnd_type;           /* index in lchr[] */
-    s_char lnd_effic;          /* 0% to 100% */
-    s_char lnd_mobil;          /* mobility units made int for RS/6000 */
+    signed char lnd_type;      /* index in lchr[] */
+    signed char lnd_effic;     /* 0% to 100% */
+    signed char lnd_mobil;     /* mobility units */
+    unsigned char lnd_off;     /* repairs stopped? */
     short lnd_tech;            /* tech level ship was built at */
-    s_char lnd_army;           /* group membership */
+    char lnd_army;             /* group membership */
     coord lnd_opx, lnd_opy;    /* Op sector coords */
     short lnd_mission;         /* mission code */
     short lnd_radius;          /* mission radius */
     /* end of part matching struct genitem */
-    s_char lnd_flags;          /* unit flags (unused) */
+    signed char lnd_flags;     /* unit flags (unused) */
     short lnd_ship;            /* pointer to transporting ship */
-    s_char lnd_harden;         /* for missiles */
+    signed char lnd_harden;    /* fortification */
     short lnd_retreat;         /* retreat percentage */
-    u_char lnd_fuel;           /* How much fuel do we have */
-    u_char lnd_nxlight;                /* How many xlight planes on board? */
+    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 */
-    u_char lnd_rad_max;                /* max radius for this unit */
-    u_char lnd_scar;           /* how experienced the unit is (not used) */
+    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 */
-    u_char lnd_nland;
+    unsigned char lnd_nland;
     time_t lnd_access;         /* Last time mob was updated (MOB_ACCESS) */
     float lnd_att;             /* attack multiplier */
     float lnd_def;             /* defense multiplier */
@@ -91,10 +92,10 @@ struct lndstr {
     int lnd_dam;               /* # of guns firing */
     int lnd_ammo;              /* firing ammu used per shot */
     int lnd_aaf;               /* aa fire */
-    u_char lnd_fuelc;          /* fuel capacity */
-    u_char lnd_fuelu;          /* fuel used per 10 mob */
-    u_char lnd_maxlight;       /* maximum number of xlight planes */
-    u_char lnd_maxland;                /* maximum number of units */
+    unsigned char lnd_fuelc;   /* fuel capacity */
+    unsigned char lnd_fuelu;   /* fuel used per 10 mob */
+    unsigned char lnd_maxlight;        /* maximum number of xlight planes */
+    unsigned char lnd_maxland; /* maximum number of units */
     time_t lnd_timestamp;      /* Last time this unit was touched */
 };
 
@@ -104,8 +105,8 @@ struct lchrstr {
     int l_lcm;                 /* units of lcm to build */
     int l_hcm;                 /* units of hcm to build */
     int l_mil;                 /* how many mil it takes to build */
-    int l_gun;                 /* how many guns it takes to build */
-    int l_shell;               /* how many shells it takes to build */
+    int l_gun;                 /* how many guns it takes to build (unused) */
+    int l_shell;               /* #shells it takes to build (unused) */
     int l_tech;                        /* tech required to build */
     int l_cost;                        /* how much it costs to build */
     float l_att;               /* attack multiplier */
@@ -120,15 +121,15 @@ struct lchrstr {
     int l_dam;                 /* # of guns firing */
     int l_ammo;                        /* firing ammu used per shot */
     int l_aaf;                 /* aa fire */
-    u_char l_fuelc;            /* fuel capacity */
-    u_char l_fuelu;            /* fuel used per 10 mob */
-    u_char l_nxlight;          /* maximum number of xlight planes */
-    u_char l_mxland;           /* maximum number of units */
+    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[] */
     long l_flags;              /* what special things can this unit do */
 };
 
 /* Land unit ability flags */
-#define        L_XLIGHT        bit(0)  /* Hold xlight planes */
 #define        L_ENGINEER      bit(1)  /* Do engineering things */
 #define        L_SUPPLY        bit(2)  /* supply other units/sects */
 #define        L_SECURITY      bit(3)  /* anti-terrorist troops */
@@ -142,27 +143,27 @@ struct lchrstr {
 #define L_TRAIN         bit(11)        /* train unit - neato */
 #define L_HEAVY         bit(12)        /* heavy unit - can't go on trains */
 
-#define LND_ATTDEF(b, t) (((b) * (1.0 + ((sqrt((double)(t)) / 100.0) * 4.0))) \
-                                                 > 127 ? 127 : \
-                                                 ((b) * (1.0 + ((sqrt((double)(t)) / 100.0) * 4.0))))
-#define LND_SPD(b, t) ((b * (1.0 + ((sqrt((double)t) / 100.0) * 2.1))) > 127\
-                      ? 127 : (b * (1.0 + ((sqrt((double)t) / 100.0) * 2.1))))
-#define LND_VUL(b, t) ((b * (1.0 - ((sqrt((double)t) / 100.0) * 1.1))) < 0\
-                      ? 0 : (b * (1.0 - ((sqrt((double)t) / 100.0) * 1.1))))
+#define LND_ATTDEF(b, t) (((b) * (1.0 + ((sqrt((t)) / 100.0) * 4.0)))  \
+                         > 127 ? 127 :                                 \
+                         ((b) * (1.0 + ((sqrt((t)) / 100.0) * 4.0))))
+#define LND_SPD(b, t) ((b * (1.0 + ((sqrt(t) / 100.0) * 2.1))) > 127   \
+                      ? 127 : (b * (1.0 + ((sqrt(t) / 100.0) * 2.1))))
+#define LND_VUL(b, t) ((b * (1.0 - ((sqrt(t) / 100.0) * 1.1))) < 0     \
+                      ? 0 : (b * (1.0 - ((sqrt(t) / 100.0) * 1.1))))
 #define LND_VIS(b, t) (b)
 #define LND_SPY(b, t) (b)
 #define LND_RAD(b, t) (b)
-#define LND_FRG(b, t) ((t) ? \
-                                          ((b) * (logx((double)(t), (double)35.0) < 1.0 ? 1.0 : \
-                                                          logx((double)(t), (double)35.0))) : (b))
-#define LND_DAM(b, t) ((t) ? \
-                                          ((b) * (logx((double)(t), (double)60.0) < 1.0 ? 1.0 : \
-                                                          logx((double)(t), (double)60.0))) : (b))
-#define LND_ACC(b, t) ((b * (1.0 - ((sqrt((double)t) / 100.0) * 1.1))) < 0\
-                      ? 0 : (b * (1.0 - ((sqrt((double)t) / 100.0) * 1.1))))
+#define LND_FRG(b, t) ((t) ?                                \
+                      ((b) * (logx((t), 35.0) < 1.0 ? 1.0 : \
+                              logx((t), 35.0))) : (b))
+#define LND_DAM(b, t) ((t) ?                                \
+                      ((b) * (logx((t), 60.0) < 1.0 ? 1.0 : \
+                              logx((t), 60.0))) : (b))
+#define LND_ACC(b, t) ((b * (1.0 - ((sqrt(t) / 100.0) * 1.1))) < 0     \
+                      ? 0 : (b * (1.0 - ((sqrt(t) / 100.0) * 1.1))))
 #define LND_AMM(b, d, t) ((b) ? ((LND_DAM((d), (t)) / 2) + 1) : 0)
-#define LND_AAF(b, t) ((b * (1.0 + ((sqrt((double)t) / 100.0) * 3.0))) > 127\
-                      ? 127 : (b * (1.0 + ((sqrt((double)t) / 100.0) * 3.0))))
+#define LND_AAF(b, t) ((b * (1.0 + ((sqrt(t) / 100.0) * 3.0))) > 127   \
+                      ? 127 : (b * (1.0 + ((sqrt(t) / 100.0) * 3.0))))
 #define LND_FC(b, t)  (b)
 #define LND_FU(b, t)  (b)
 #define LND_XPL(b, t) (b)
@@ -174,12 +175,9 @@ struct lchrstr {
 /* Chance to detect L_SPY unit (percent) */
 #define LND_SPY_DETECT_CHANCE(eff) ((110-(eff))/100.0)
 
-#define getland(n, p) \
-       ef_read(EF_LAND, n, p)
-#define putland(n, p) \
-       ef_write(EF_LAND, n, p)
-#define getlandp(n) \
-       (struct lndstr *) ef_ptr(EF_LAND, n)
+#define getland(n, p) ef_read(EF_LAND, (n), (p))
+#define putland(n, p) ef_write(EF_LAND, (n), (p))
+#define getlandp(n) (struct lndstr *)ef_ptr(EF_LAND, (n))
 
 extern struct lchrstr lchr[N_MAXLAND + 1];
 
@@ -201,28 +199,26 @@ enum {
 extern void lnd_sweep(struct emp_qelem *, int, int, natid);
 extern int lnd_interdict(struct emp_qelem *, coord, coord, natid);
 extern void lnd_sel(struct nstr_item *, struct emp_qelem *);
-extern void lnd_mess(s_char *, struct llist *);
 extern int lnd_check_mines(struct emp_qelem *);
-extern double lnd_mobcost(struct lndstr *, struct sctstr *, int);
-extern s_char *lnd_path(int, struct lndstr *, s_char *);
+extern double lnd_pathcost(struct lndstr *, double);
+extern int lnd_mobtype(struct lndstr *);
+extern double lnd_mobcost(struct lndstr *, struct sctstr *);
+extern char *lnd_path(int, struct lndstr *, char *);
 
 extern int attack_val(int, struct lndstr *);
-extern int total_mil(struct lndstr *);
 extern int defense_val(struct lndstr *);
-extern int lnd_getmil(struct lndstr *);
-extern void lnd_print(struct llist *, s_char *);
-extern void lnd_delete(struct llist *, s_char *);
+extern void lnd_print(struct llist *, char *);
+extern void lnd_delete(struct llist *, char *);
 extern int lnd_take_casualty(int, struct llist *, int);
 extern void lnd_submil(struct lndstr *, int);
 extern void lnd_takemob(struct emp_qelem *, double);
 extern int lnd_spyval(struct lndstr *);
-extern int intelligence_report(int, struct lndstr *, int, s_char *);
+extern int 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 void lnd_put(struct emp_qelem *, natid);
-extern int lnd_hit_mine(struct lndstr *, struct lchrstr *);
 extern void lnd_list(struct emp_qelem *);
 extern int lnd_hardtarget(struct lndstr *);
 extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);