/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2006, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
*
* ---
*
- * 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.
*
* ---
*
* land.h: Definitions for land units
*
* Known contributors to this file:
- * Thomas Rushack, 1992
+ * Thomas Ruschak, 1992
* Ken Stevens, 1995
* Steve McClure, 1998
*/
-#ifndef _LAND_H_
-#define _LAND_H_
+#ifndef LAND_H
+#define LAND_H
#include "sect.h"
#include "ship.h"
#include "nsc.h"
#include "retreat.h"
+#define N_MAXLAND 30
#define LAND_MINEFF 10
#define LAND_MINFIREEFF 40 /* arty must be this effic to fire */
-#define MAXLNDV 14
#define LND_MINMOBCOST 0.200
struct lndstr {
+ /* initial part must match struct genitem */
short ef_type;
natid lnd_own; /* owner's country num */
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; /* ship type */
+ 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 */
- short lnd_sell; /* pointer to trade file */
short lnd_tech; /* tech level ship was built at */
s_char lnd_army; /* group membership */
coord lnd_opx, lnd_opy; /* Op sector coords */
short lnd_mission; /* mission code */
short lnd_radius; /* mission radius */
- s_char lnd_flags; /* unit flags */
+ /* end of part matching struct genitem */
+ s_char lnd_flags; /* unit flags (unused) */
short lnd_ship; /* pointer to transporting ship */
s_char lnd_harden; /* for missiles */
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? */
int lnd_rflags; /* When do I retreat? */
- s_char lnd_rpath[RET_LEN]; /* retreat path */
+ 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) */
- s_char lnd_nv; /* current number of variables */
- u_char lnd_vtype[MAXLNDV];
- u_short lnd_vamt[MAXLNDV];
+ 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;
time_t lnd_access; /* Last time mob was updated (MOB_ACCESS) */
time_t lnd_timestamp; /* Last time this unit was touched */
};
-#define LND_NOTANY bit(0) /* Just a placeholder, not used */
-
struct lchrstr {
- u_char l_nv; /* number of variables it can hold */
- u_char l_vtype[MAXCHRNV];
- u_short l_vamt[MAXCHRNV];
- s_char *l_name; /* full name of type of land unit */
+ short l_item[I_MAX+1]; /* load limit */
+ 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 */
};
/* 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 */
#define LND_FU(b, t) (b)
#define LND_XPL(b, t) (b)
#define LND_MXL(b, t) (b)
-#define LND_COST(b, t) ((b) * (1.0 + (sqrt((double)(t)) / 100.0)))
+
+/* Work required for building 100% */
+#define LND_BLD_WORK(lcm, hcm) (20 + (lcm) + 2 * (hcm))
/* 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, (caddr_t)p)
+ ef_read(EF_LAND, n, p)
#define putland(n, p) \
- ef_write(EF_LAND, n, (caddr_t)p)
+ ef_write(EF_LAND, n, p)
#define getlandp(n) \
(struct lndstr *) ef_ptr(EF_LAND, n)
-extern struct lchrstr lchr[];
-extern int lnd_maxno;
+extern struct lchrstr lchr[N_MAXLAND + 1];
struct llist {
struct emp_qelem queue; /* list of units */
int supplied;
};
+enum {
+ LND_AIROPS_EFF = 50 /* min. efficiency for air ops */
+};
+
/* src/lib/subs/lndsub.c */
extern void lnd_sweep(struct emp_qelem *, int, int, natid);
extern int lnd_interdict(struct emp_qelem *, coord, coord, 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);
+extern int lnd_support(natid, natid, coord, coord, int);
extern int lnd_can_attack(struct lndstr *);
extern int lnd_fortify (struct lndstr *lp, int hard_amt);
+extern void lnd_set_tech(struct lndstr *, int);
-#endif /* _LAND_H_ */
+#endif