]> git.pond.sub.org Git - empserver/blobdiff - include/sect.h
Update copyright notice.
[empserver] / include / sect.h
index 5f186910c6849fa555c41ec251fbb8c99ef95be3..a45044c154ecf698331733b0a213b18995635e27 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2000, Dave Pare, Jeff Bailey, Thomas Ruschak,
+ *  Copyright (C) 1986-2004, Dave Pare, Jeff Bailey, Thomas Ruschak,
  *                           Ken Stevens, Steve McClure
  *
  *  This program is free software; you can redistribute it and/or modify
@@ -37,6 +37,7 @@
 #ifndef _SECT_H_
 #define _SECT_H_
 
+#include "item.h"
 #include "var.h"
 
 /* The order of the following elements is there to match up with genitem */
@@ -71,13 +72,14 @@ struct sctstr {
     natid sct_oldown;          /* old owner of sector (for liberation) */
     u_char sct_updated;                /* Has this sect been updated? */
     u_char sct_off;            /* Should this sector produce? */
-    u_short sct_item[I_MAX+1]; /* amount of items stored here */
-    u_short sct_del[I_MAX+1];  /* delivieries */
-    u_short sct_dist[I_MAX+1]; /* distribution thresholds */
-    u_short sct_mines;         /* number of mines */
+    short sct_item[I_MAX+1];   /* amount of items stored here */
+    short sct_del[I_MAX+1];    /* delivieries */
+    short sct_dist[I_MAX+1];   /* distribution thresholds */
+    short sct_mines;           /* number of mines */
     u_short sct_pstage;                /* plague stage */
     u_short sct_ptime;         /* how many etus remain in this stage */
-    u_short sct_che;           /* che combo */
+    u_char sct_che;            /* number of guerrillas */
+    natid sct_che_target;      /* nation targeted by che */
     u_short sct_fallout;
     time_t sct_access;         /* Last time mob was updated (MOB_ACCESS) */
     u_char sct_road;           /* Road value of a sector */
@@ -88,10 +90,10 @@ struct sctstr {
 
 struct dchrstr {
     int d_mnem;                        /* map symbol */
-    int d_prd;                 /* product vtype */
+    int d_prd;                 /* product type */
     int d_mcst;                        /* movement cost */
     int d_flg;                 /* movement cost */
-    int d_pkg;                 /* type of packaging in these sects */
+    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 */
@@ -102,11 +104,6 @@ struct dchrstr {
     s_char *d_name;            /* full name of sector type */
 };
 
-#define        NPKG    0               /* no special packaging */
-#define        WPKG    1               /* "warehouse" packaging */
-#define        UPKG    2               /* "urban" packaging */
-#define        BPKG    3               /* "bank" packaging */
-
 /* for d_flg */
 #define        NAVOK   1               /* ships can always navigate */
 #define        NAV_02  2               /* requires 2% effic to navigate */
@@ -153,22 +150,26 @@ struct dchrstr {
 #define        SCT_MAXDEF      34      /* highest sector type in header files */
 
 #define getsect(x, y, p) \
-       ef_read(EF_SECTOR, sctoff((int) x, (int) y), (caddr_t)p)
+       ef_read(EF_SECTOR, sctoff((x), (y)), (p))
 #define putsect(p) \
-       ef_write(EF_SECTOR, sctoff((int) (p)->sct_x, \
-               (int) (p)->sct_y), (caddr_t)p)
+       ef_write(EF_SECTOR, sctoff((p)->sct_x, (p)->sct_y), (p))
 #define getsectp(x, y) \
-       (struct sctstr *) ef_ptr(EF_SECTOR, sctoff((int)x, (int)y))
+       (struct sctstr *)ef_ptr(EF_SECTOR, sctoff((x), (y)))
 #define getsectid(id) \
-       (struct sctstr *) ef_ptr(EF_SECTOR, id)
+       (struct sctstr *)ef_ptr(EF_SECTOR, id)
 
 /* things relating to sectors */
 extern int sctoff(coord x, coord y);
 
-extern int sct_maxno;
 extern struct dchrstr dchr[];
 extern struct dchrstr bigcity_dchr;
 
+/* Minimal efficiency of sectors that can be knocked down (bridges) */
+#define SCT_MINEFF 20
+
+/* Work required for building */
+#define SCT_BLD_WORK(lcm, hcm) ((lcm) + 2 * (hcm))
+
 #define MIN_MOBCOST  0.001     /* lowest cost a sector can have to move into */
 #define FORTEFF 5              /* forts must be 5% efficient to fire. */
 
@@ -183,6 +184,15 @@ extern struct dchrstr bigcity_dchr;
 /* Sector flags */
 #define MOVE_IN_PROGRESS       bit(0)  /* move in progress */
 
+/* maximum item amount, must fit into sct_item[], sct_del[], sct_dist[] */
+#define ITEM_MAX 9999
+/* maximum number of mines, must fit into struct sctstr member sct_mines */
+#define MINES_MAX 65535
+/* maximum number of che, must fit into struct sctstr member sct_che */
+#define CHE_MAX 255
+/* maximum fallout, must fit into struct sctstr member sct_fallout */
+#define FALLOUT_MAX 9999
+
 /* Each cost is per point of efficency */
 struct sctintrins {
     char *in_name;