/*
* 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-2020, 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,
* 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/>.
*
* ---
*
* Dave Pare
* Ken Stevens, 1995
* Steve McClure, 1998
- * Markus Armbruster, 2004-2009
+ * Markus Armbruster, 2004-2016
*/
#ifndef SECT_H
#define SECT_H
-#include <time.h>
+#include "file.h"
#include "item.h"
#include "types.h"
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;
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;
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
#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))
-
-/* things relating to sectors */
-extern int sctoff(coord x, coord y);
+#define getsectp(x, y) ((struct sctstr *)ef_ptr(EF_SECTOR, sctoff((x), (y))))
+#define getsectid(id) ((struct sctstr *)ef_ptr(EF_SECTOR, (id)))
extern struct dchrstr dchr[SCT_TYPE_MAX + 2];
#define IS_BIG_CITY(type) (dchr[(type)].d_pkg == UPKG)
#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
/* 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 */
};