]> git.pond.sub.org Git - empserver/blobdiff - include/sect.h
ship: Unbreak MOB_ACCESS real-time mobility update for ships
[empserver] / include / sect.h
index 95913c539244c484907987ad10dc80e0aa2702e6..d003bbfe542ee71524115a0b3e30d0a699a568f0 100644 (file)
@@ -1,6 +1,6 @@
 /*
  *  Empire - A multi-player, client/server Internet based war game.
- *  Copyright (C) 1986-2011, 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
  *     Dave Pare
  *     Ken Stevens, 1995
  *     Steve McClure, 1998
- *     Markus Armbruster, 2004-2009
+ *     Markus Armbruster, 2004-2020
  */
 
 
 #ifndef SECT_H
 #define SECT_H
 
-#include <time.h>
+#include "file.h"
 #include "item.h"
 #include "types.h"
 
@@ -57,10 +57,10 @@ struct sctstr {
     unsigned char sct_off;     /* Should this sector produce? */
     /* end of part matching struct empobj */
     unsigned char sct_loyal;   /* updates until civilans "converted" */
-    unsigned char sct_terr;    /* territory 0 id # of sector */
-    unsigned char sct_terr1;   /* territory 1 id # of sector */
-    unsigned char sct_terr2;   /* territory 2 id # of sector */
-    unsigned char sct_terr3;   /* territory 3 id # of sector */
+    unsigned char sct_terr;    /* territory 0 number */
+    unsigned char sct_terr1;   /* territory 1 number */
+    unsigned char sct_terr2;   /* territory 2 number */
+    unsigned char sct_terr3;   /* territory 3 number */
     unsigned char sct_dterr;   /* deity's territory # */
     coord sct_dist_x;          /* Dist sector */
     coord sct_dist_y;
@@ -82,7 +82,7 @@ struct sctstr {
     short sct_dist[I_MAX+1];   /* distribution thresholds */
     short sct_mines;           /* number of mines */
     short sct_pstage;          /* plague stage */
-    short sct_ptime;           /* how many etus remain in this stage */
+    short sct_ptime;           /* how many ETUs remain in this stage */
     unsigned char sct_che;     /* number of guerrillas */
     natid sct_che_target;      /* nation targeted by che */
     unsigned short sct_fallout;
@@ -111,18 +111,20 @@ struct dchrstr {
     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 */
-    int d_cost;                        /* cost to designate the sect */
-    int d_build;               /* cost multiplier for eff */
-    int d_lcms;                        /* lcm's needed per point of eff */
-    int d_hcms;                        /* hcm's needed per point of eff */
+    short d_mat[I_MAX+1];      /* materials to build 100% */
+                               /* only I_LCM and I_HCM non-zero */
+    int d_bwork;               /* work to build 100% */
+    int d_cost;                        /* cost to build 100% */
     int d_maint;               /* maintenance cost per ETU */
     int d_maxpop;              /* maximum population */
+    int d_flags;               /* capability flags */
     char *d_name;              /* full name of sector type */
 };
 
-       /* sector types (must agree with order in dchr, empglb.c) */
+/* Sector capability flags */
+#define D_DEITY                bit(0)  /* Only the deity can designate this */
 
+/* Sector types, must match sect.config */
 #define SCT_WATER      0       /* basics */
 #define SCT_MOUNT      1
 #define SCT_SANCT      2
@@ -158,17 +160,14 @@ struct dchrstr {
 #define SCT_PLAINS     32      /* plains sector */
 #define SCT_BTOWER     33      /* Bridge tower */
 
-#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, (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 getsectp(x, y) ((struct sctstr *)ef_ptr(EF_SECTOR, sctoff((x), (y))))
+#define getsectid(id) ((struct sctstr *)ef_ptr(EF_SECTOR, (id)))
 
-/* things relating to sectors */
-extern int sctoff(coord x, coord y);
+#define DCHR_SZ 64
+extern struct dchrstr dchr[DCHR_SZ];
 
-extern struct dchrstr dchr[SCT_TYPE_MAX + 2];
 #define IS_BIG_CITY(type) (dchr[(type)].d_pkg == UPKG)
 
 /* Minimal efficiency of sectors that can be knocked down (bridges) */
@@ -195,6 +194,7 @@ extern struct dchrstr dchr[SCT_TYPE_MAX + 2];
 #define SCT_LANDMINES(sp) \
     (SCT_MINES_ARE_SEAMINES((sp)) ? 0 : (sp)->sct_mines)
 
+/* Sector infrastructure types, must match infra.config */
 #define INT_ROAD       0
 #define INT_RAIL       1
 #define INT_DEF                2
@@ -216,14 +216,15 @@ extern struct dchrstr dchr[SCT_TYPE_MAX + 2];
 /* Each cost is per point of efficency */
 struct sctintrins {
     char *in_name;
-    unsigned char in_lcms;     /* construction materials */
-    unsigned char in_hcms;
-    unsigned char in_dcost;    /* dollars */
-    unsigned char in_mcost;    /* mobility */
+    short in_mat[I_MAX+1];     /* materials to build 100% */
+                               /* non-zero only for I_LCM and I_HCM */
+    short in_bmobil;           /* mobility to build 100% */
+    int in_cost;               /* cost to build 100% */
     unsigned char in_enable;   /* enabled iff non-zero */
 };
 
-extern struct sctintrins intrchr[INT_DEF + 2];
+#define INTRCHR_SZ INT_DEF + 2
+extern struct sctintrins intrchr[INTRCHR_SZ];
 
 extern int fort_fire(struct sctstr *);
 extern int sct_rail_track(struct sctstr *);