]> git.pond.sub.org Git - empserver/blobdiff - include/land.h
Get rid of the need to fix up lchr[].
[empserver] / include / land.h
index 3dc5fcf55c46771a2eeeb86d14228f744ddae3db..339cf410c8edf9916f0d5ea1b6053ee89aee60af 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-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
 #ifndef LAND_H
 #define LAND_H
 
-#include "sect.h"
-#include "ship.h"
+#include <time.h>
+#include "item.h"
 #include "queue.h"
-#include "nsc.h"
 #include "retreat.h"
+#include "types.h"
 
-#define N_MAXLAND      30
+#define LND_TYPE_MAX   30
 #define LAND_MINEFF    10
 #define LAND_MINFIREEFF 40     /* arty must be this effic to fire */
-#define LND_MINMOBCOST  0.200
 
 struct lndstr {
-    /* initial part must match struct genitem */
+    /* initial part must match struct empobj */
     short ef_type;
     natid lnd_own;             /* owner's country num */
     short lnd_uid;             /* unit id (land unit) */
@@ -63,7 +62,7 @@ struct lndstr {
     coord lnd_opx, lnd_opy;    /* Op sector coords */
     short lnd_mission;         /* mission code */
     short lnd_radius;          /* mission radius */
-    /* end of part matching struct genitem */
+    /* end of part matching struct empobj */
     signed char lnd_flags;     /* unit flags (unused) */
     short lnd_ship;            /* pointer to transporting ship */
     signed char lnd_harden;    /* fortification */
@@ -79,7 +78,7 @@ struct lndstr {
     short lnd_ptime;           /* how many etus remain in this stage */
     short lnd_land;            /* pointer to transporting unit */
     unsigned char lnd_nland;
-    time_t lnd_access;         /* Last time mob was updated (MOB_ACCESS) */
+    short lnd_access;          /* Last tick mob was updated (MOB_ACCESS) */
     float lnd_att;             /* attack multiplier */
     float lnd_def;             /* defense multiplier */
     int lnd_vul;               /* vulnerability (0-100) */
@@ -104,7 +103,7 @@ struct lchrstr {
     char *l_name;              /* full name of type of land unit */
     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_mil;                 /* how many mil it takes to build (unused) */
     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 */
@@ -161,7 +160,7 @@ struct lchrstr {
                               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_AMM(b, t) (b)
 #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)
@@ -177,19 +176,9 @@ struct lchrstr {
 
 #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 getlandp(n) ((struct lndstr *)ef_ptr(EF_LAND, (n)))
 
-extern struct lchrstr lchr[N_MAXLAND + 1];
-
-struct llist {
-    struct emp_qelem queue;    /* list of units */
-    coord x, y;                        /* x,y it came from */
-    struct lchrstr *lcp;       /* pointer to desc of land unit */
-    struct lndstr land;                /* struct land unit */
-    int eff;
-    double mobil;
-    int supplied;
-};
+extern struct lchrstr lchr[LND_TYPE_MAX + 2];
 
 enum {
     LND_AIROPS_EFF = 50                /* min. efficiency for air ops */
@@ -201,24 +190,22 @@ extern int lnd_interdict(struct emp_qelem *, coord, coord, natid);
 extern void lnd_sel(struct nstr_item *, struct emp_qelem *);
 extern int lnd_check_mines(struct emp_qelem *);
 extern double lnd_pathcost(struct lndstr *, double);
-extern double lnd_mobcost(struct lndstr *, struct sctstr *, int);
-extern char *lnd_path(int, struct lndstr *, char *);
-
-extern int attack_val(int, struct lndstr *);
-extern int defense_val(struct lndstr *);
-extern void lnd_print(struct llist *, char *);
-extern void lnd_delete(struct llist *, char *);
-extern int lnd_take_casualty(int, struct llist *, int);
+extern int lnd_mobtype(struct lndstr *);
+extern double lnd_mobcost(struct lndstr *, struct sctstr *);
+
+extern double attack_val(int, struct lndstr *);
+extern double defense_val(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);
 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, char *);
+extern double 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 void lnd_list(struct emp_qelem *);
 extern int lnd_hardtarget(struct lndstr *);
 extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);
 extern int lnd_support(natid, natid, coord, coord, int);