/*
* Empire - A multi-player, client/server Internet based war game.
- * Copyright (C) 1986-2008, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ * Copyright (C) 1986-2009, Dave Pare, Jeff Bailey, Thomas Ruschak,
* Ken Stevens, Steve McClure
*
* This program is free software; you can redistribute it and/or modify
* ---
*
* sect.h: Definitions for things having to do with sectors.
- *
+ *
* Known contributors to this file:
* Dave Pare
* Ken Stevens, 1995
* Steve McClure, 1998
+ * Markus Armbruster, 2004-2008
*/
struct sctstr {
/* initial part must match struct empobj */
short ef_type;
+ short sct_uid; /* equals XYOFFSET(sct_x, sct_y) */
+ unsigned sct_seqno;
+ time_t sct_timestamp; /* Last time this sector was written to */
natid sct_own; /* owner's country num */
- short sct_elev; /* elevation/depth */
coord sct_x; /* x coord of sector */
coord sct_y; /* y coord of sector */
signed char sct_type; /* sector type */
coord sct_dist_y;
short sct_avail; /* available workforce for "other things" */
short sct_flags; /* temporary flags */
- short sct_fill; /* gunk */
+ short sct_elev; /* elevation/depth */
unsigned char sct_work; /* pct of civ actually working */
unsigned char sct_coastal; /* is this a coastal sector? */
signed char sct_newtype; /* for changing designations */
unsigned char sct_road; /* Road value of a sector */
unsigned char sct_rail; /* Rail value of a sector */
unsigned char sct_defense; /* Defensive value of a sector */
- time_t sct_timestamp; /* Last time this sector was written to */
};
-typedef enum {
+enum d_navigation {
NAV_NONE, /* ships can't navigate */
NAVOK, /* ships can always navigate */
NAV_02, /* requires 2% effic to navigate */
NAV_CANAL, /* requires 2% effic to navigate and M_CANAL capability */
NAV_60 /* requires 60% effic to navigate */
-} d_navigation;
+};
struct dchrstr {
unsigned char d_uid;
char d_mnem; /* map symbol */
+ unsigned char d_terrain; /* terrain sector type */
int d_prd; /* product type */
int d_peffic; /* process efficiency, in percent */
float d_mob0, d_mob1; /* movement cost at 0 and 100% eff */
- d_navigation d_nav; /* navigation capability */
- i_packing d_pkg; /* type of packaging in these sects */
+ enum d_navigation d_nav; /* navigation capability */
+ enum i_packing d_pkg; /* type of packaging in these sects */
float d_ostr; /* offensive strength */
float d_dstr; /* defensive strength */
int d_value; /* resale ("collect") value */
#define SCT_TYPE_MAX 38
#define getsect(x, y, p) ef_read(EF_SECTOR, sctoff((x), (y)), (p))
-#define putsect(p) ef_write(EF_SECTOR, sctoff((p)->sct_x, (p)->sct_y), (p))
+#define putsect(p) ef_write(EF_SECTOR, (p)->sct_uid, (p))
#define getsectp(x, y) (struct sctstr *)ef_ptr(EF_SECTOR, sctoff((x), (y)))
#define getsectid(id) (struct sctstr *)ef_ptr(EF_SECTOR, (id))
#define FORTEFF 5 /* forts must be 5% efficient to fire. */
+/* Can trains enter sector SP? */
+#define SCT_HAS_RAIL(sp) \
+ (opt_RAILWAYS ? sct_rail_track((sp)) != 0 \
+ : intrchr[INT_RAIL].in_enable && (sp)->sct_rail != 0)
+
#define MOB_MOVE 0
#define MOB_MARCH 1
#define MOB_RAIL 2
extern struct sctintrins intrchr[INT_DEF + 2];
+extern int fort_fire(struct sctstr *);
+extern int sct_rail_track(struct sctstr *);
+
#endif