]> git.pond.sub.org Git - empserver/blobdiff - include/land.h
retreat: Rewrite automatic retreat code to fix its many bugs
[empserver] / include / land.h
index 8767d6b518551f6f14423edd17a075166bb60827..7c1aa3b9b2d6b7ed9bc1d92524cd213015b5e252 100644 (file)
@@ -1,11 +1,11 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2010, Dave Pare, Jeff Bailey, Thomas Ruschak,
- *                           Ken Stevens, Steve McClure
+ *  Copyright (C) 1986-2015, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *                Ken Stevens, Steve McClure, Markus Armbruster
  *
- *  This program is free software; you can redistribute it and/or modify
+ *  Empire is free software: you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
- *  the Free Software Foundation; either version 2 of the License, or
+ *  the Free Software Foundation, either version 3 of the License, or
  *  (at your option) any later version.
  *
  *  This program is distributed in the hope that it will be useful,
@@ -14,8 +14,7 @@
  *  GNU General Public License for more details.
  *
  *  You should have received a copy of the GNU General Public License
- *  along with this program; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
+ *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
  *
  *  ---
  *
@@ -31,7 +30,7 @@
  *     Thomas Ruschak, 1992
  *     Ken Stevens, 1995
  *     Steve McClure, 1998
- *     Markus Armbruster, 2004-2009
+ *     Markus Armbruster, 2004-2015
  */
 
 #ifndef LAND_H
@@ -39,7 +38,6 @@
 
 #include <time.h>
 #include "item.h"
-#include "queue.h"
 #include "retreat.h"
 #include "types.h"
 
@@ -102,10 +100,10 @@ struct lchrstr {
     int l_dam;                 /* # of guns firing */
     int l_ammo;                        /* firing ammu used per shot */
     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 */
     signed char l_type;                /* index in lchr[] */
-    long l_flags;              /* what special things can this unit do */
 };
 
 /* Land unit ability flags */
@@ -118,9 +116,9 @@ struct lchrstr {
 #define L_RADAR                bit(7)  /* radar unit */
 #define L_ASSAULT      bit(8)  /* can assault */
 #define L_FLAK         bit(9)  /* flak unit */
-#define L_SPY           bit(10)        /* spy unit - way cool */
-#define L_TRAIN         bit(11)        /* train unit - neato */
-#define L_HEAVY         bit(12)        /* heavy unit - can't go on trains */
+#define L_SPY          bit(10) /* spy unit - way cool */
+#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))
@@ -138,6 +136,12 @@ 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);
@@ -169,10 +173,13 @@ extern int lnd_sabo(struct lndstr *, short *);
 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 *);
@@ -180,16 +187,20 @@ 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 void lnd_print(natid, 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 void intelligence_report(int, struct lndstr *, int, char *);
-extern void lnd_mar(struct emp_qelem *, double *, double *, int *, natid);
+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);