/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2013, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2021, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure, Markus Armbruster
*
* Empire is free software: you can redistribute it and/or modify
* Thomas Ruschak, 1992
* Ken Stevens, 1995
* Steve McClure, 1998
- * Markus Armbruster, 2004-2013
+ * Markus Armbruster, 2004-2020
*/
#ifndef LAND_H
#define LAND_H
-#include <time.h>
+#include "file.h"
#include "item.h"
#include "retreat.h"
#include "types.h"
-#define LND_TYPE_MAX 30
#define LAND_MINEFF 10
#define LAND_MINFIREEFF 40 /* arty must be this effic to fire */
signed ef_type: 8;
unsigned lnd_seqno: 12;
unsigned lnd_generation: 12;
- int lnd_uid; /* unit id (land #) */
+ 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 */
short lnd_mission; /* mission code */
short lnd_radius; /* mission radius */
/* end of part matching struct empobj */
- int lnd_ship; /* uid of transporting ship, or -1 */
+ int lnd_ship; /* UID of transporting ship, or -1 */
signed char lnd_harden; /* fortification */
short lnd_retreat; /* retreat percentage */
int lnd_rflags; /* When do I retreat? */
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 */
- int lnd_land; /* uid of transporting land unit, or -1 */
+ short lnd_ptime; /* how many ETUs remain in this stage */
+ int lnd_land; /* UID of transporting land unit, or -1 */
short lnd_access; /* Last tick mob was updated (MOB_ACCESS) */
};
struct lchrstr {
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 (unused) */
- int l_gun; /* how many guns it takes to build (unused) */
- int l_shell; /* #shells it takes to build (unused) */
+ short l_mat[I_MAX+1]; /* materials to build 100% */
+ /* only I_LCM and I_HCM non-zero */
+ int l_bwork; /* work to build 100% */
int l_tech; /* tech required to build */
int l_cost; /* how much it costs to build */
float l_att; /* attack multiplier */
int l_acc; /* firing accuracy */
int l_dam; /* # of guns firing */
int l_ammo; /* firing ammu used per shot */
- int l_aaf; /* aa fire */
+ int l_aaf; /* AA fire */
int l_flags; /* what special things can this unit do */
unsigned char l_nxlight; /* maximum number of xlight planes */
unsigned char l_nland; /* maximum number of units */
#define L_TRAIN bit(11) /* train unit - neato */
#define L_HEAVY bit(12) /* heavy unit - can't go on trains */
-/* 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 putland(n, p) ef_write(EF_LAND, (n), (p))
#define getlandp(n) ((struct lndstr *)ef_ptr(EF_LAND, (n)))
-extern struct lchrstr lchr[LND_TYPE_MAX + 2];
+#define LCHR_SZ 128
+extern struct lchrstr lchr[LCHR_SZ];
enum {
LND_AIROPS_EFF = 50 /* min. efficiency for air ops */
};
+enum lnd_stuck {
+ LND_STUCK_NOT, /* not stuck */
+ LND_STUCK_NO_RAIL, /* land needs rail */
+ LND_STUCK_IMPASSABLE /* sector type not marchable */
+};
+
extern float l_att(struct lchrstr *, int);
extern float l_def(struct lchrstr *, int);
extern int l_vul(struct lchrstr *, int);
extern double lnd_fire_range(struct lndstr *);
/* src/lib/subs/lndsub.c */
-extern void lnd_sweep(struct emp_qelem *, int, int, natid);
+extern int lnd_sweep(struct emp_qelem *, int, int, natid);
extern int lnd_interdict(struct emp_qelem *, coord, coord, natid);
+extern int lnd_may_mar(struct lndstr *, struct lndstr *, char *);
extern void lnd_sel(struct nstr_item *, struct emp_qelem *);
+extern struct ulist *lnd_insque(struct lndstr *, struct emp_qelem *);
extern int lnd_check_mines(struct emp_qelem *);
+extern enum lnd_stuck lnd_check_mar(struct lndstr *, struct sctstr *);
extern double lnd_pathcost(struct lndstr *, double);
extern int lnd_mobtype(struct lndstr *);
extern double lnd_mobcost(struct lndstr *, struct sctstr *);
extern double defense_val(struct lndstr *);
extern int lnd_reaction_range(struct lndstr *);
extern void lnd_print(natid, struct ulist *, char *);
-extern void lnd_delete(struct ulist *);
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 void intelligence_report(int, struct lndstr *, int, char *);
-extern void lnd_mar(struct emp_qelem *, double *, double *, int *, natid);
+extern void intelligence_report(natid, struct lndstr *, int, char *);
+extern void lnd_mar_stay_behind(struct emp_qelem *, natid);
+extern void lnd_mar_put(struct emp_qelem *, natid);
+extern void lnd_put(struct emp_qelem *);
+extern void lnd_put_one(struct ulist *);
extern int lnd_hardtarget(struct lndstr *);
-extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);
+extern int lnd_abandon_askyn(struct emp_qelem *);
+extern int lnd_mar_dir(struct emp_qelem *, int, natid);
+extern int lnd_mar_gauntlet(struct emp_qelem *, int, natid);
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);