/* Types of combat for use by attack routines */
#define A_DEFEND 0
-#define A_ATTACK 1
-#define A_ASSAULT 2
-#define A_PARA 3
+#define A_ATTACK 1
+#define A_ASSAULT 2
+#define A_PARA 3
#define A_BOARD 4
#define A_LBOARD 5
#ifndef DISTRIBUTE_H
#define DISTRIBUTE_H
-#define IMPORT 0
-#define EXPORT 1
+#define IMPORT 0
+#define EXPORT 1
#endif
#if defined(EMP_CONFIG_C_OUTPUT)
-#define EMPCFONLYC(fvname, vname, vtype, ctype, flags, descr) \
+#define EMPCFONLYC(fvname, vname, vtype, ctype, flags, descr) \
{ (fvname), (ctype), &(vname), (flags), (descr) },
-#define EMPCFBOTH(fvname, vname, vtype, ctype, flags, descr) \
+#define EMPCFBOTH(fvname, vname, vtype, ctype, flags, descr) \
{ (fvname), (ctype), &(vname), (flags), (descr) },
#elif defined(EMP_CONFIG_H_OUTPUT)
-#define EMPCFONLYC(fvname, vname, vtype, ctype, flags, descr)
-#define EMPCFBOTH(fvname, vname, vtype, ctype, flags, descr) \
+#define EMPCFONLYC(fvname, vname, vtype, ctype, flags, descr)
+#define EMPCFBOTH(fvname, vname, vtype, ctype, flags, descr) \
extern vtype vname;
#endif /* EMP_CONFIG_C_OUTPUT || EMP_CONFIG_H_OUTPUT */
#define EMPIO_H
#include <sys/time.h>
-#define IO_READ 0x1
+#define IO_READ 0x1
#define IO_WRITE 0x2
-#define IO_EOF 0x10
+#define IO_EOF 0x10
#define IO_ERROR 0x40
#define IO_BUFSIZE 4096
};
/* Land unit ability flags */
-#define L_ENGINEER bit(1) /* Do engineering things */
-#define L_SUPPLY bit(2) /* supply other units/sects */
-#define L_SECURITY bit(3) /* anti-terrorist troops */
-#define L_LIGHT bit(4) /* can go on ships */
-#define L_MARINE bit(5) /* marine units, good at assaulting */
-#define L_RECON bit(6) /* recon units, good at spying */
+#define L_ENGINEER bit(1) /* Do engineering things */
+#define L_SUPPLY bit(2) /* supply other units/sects */
+#define L_SECURITY bit(3) /* anti-terrorist troops */
+#define L_LIGHT bit(4) /* can go on ships */
+#define L_MARINE bit(5) /* marine units, good at assaulting */
+#define L_RECON bit(6) /* recon units, good at spying */
#define L_RADAR bit(7) /* radar unit */
#define L_ASSAULT bit(8) /* can assault */
#define L_FLAK bit(9) /* flak unit */
#include <time.h>
#include "types.h"
-#define MAXLOAN 100000
+#define MAXLOAN 100000
#define SECS_PER_DAY (60*60*24)
struct lonstr {
#endif
#ifndef bit
-#define bit(x) (1<<(x))
+#define bit(x) (1<<(x))
#endif
#define minutes(x) (60*(x))
void exit_nomem(void) ATTRIBUTE((noreturn));
/* return codes from command routines */
-#define RET_OK 0 /* command completed sucessfully */
-#define RET_FAIL 1 /* command completed unsucessfully [?] */
-#define RET_SYN 2 /* syntax error in command */
+#define RET_OK 0 /* command completed sucessfully */
+#define RET_FAIL 1 /* command completed unsucessfully [?] */
+#define RET_SYN 2 /* syntax error in command */
extern char *getstarg(char *input, char *prompt, char buf[]);
extern char *getstring(char *prompt, char buf[]);
#ifndef MISSION_H
#define MISSION_H
-#define MI_NONE 0
-#define MI_INTERDICT 1
-#define MI_SUPPORT 2
-#define MI_RESERVE 3
+#define MI_NONE 0
+#define MI_INTERDICT 1
+#define MI_SUPPORT 2
+#define MI_RESERVE 3
#define MI_ESCORT 4
#define MI_SINTERDICT 5 /* sub interdiction */
#define MI_AIR_DEFENSE 6
#define NATID_BAD 255
-#define MAXNOR 50 /* max # realms */
+#define MAXNOR 50 /* max # realms */
/* Nation status */
enum nat_status {
};
/* nation relation codes */
-#define AT_WAR 0
+#define AT_WAR 0
#define SITZKRIEG 1
#define MOBILIZATION 2
-#define HOSTILE 3
-#define NEUTRAL 4
+#define HOSTILE 3
+#define NEUTRAL 4
#define FRIENDLY 5
-#define ALLIED 6
+#define ALLIED 6
/* nation reject codes */
-#define REJ_TELE bit(0) /* dont allow telegrams to be sent */
-#define REJ_TREA bit(1) /* dont allow treaties to be offered */
-#define REJ_ANNO bit(2) /* don't receive announcements */
-#define REJ_LOAN bit(3) /* don't allow loans to be offered */
-
-#define NAT_TLEV 0
-#define NAT_RLEV 1
-#define NAT_ELEV 2
-#define NAT_HLEV 3
+#define REJ_TELE bit(0) /* dont allow telegrams to be sent */
+#define REJ_TREA bit(1) /* dont allow treaties to be offered */
+#define REJ_ANNO bit(2) /* don't receive announcements */
+#define REJ_LOAN bit(3) /* don't allow loans to be offered */
+
+#define NAT_TLEV 0
+#define NAT_RLEV 1
+#define NAT_ELEV 2
+#define NAT_HLEV 3
/*
* Number of updates contact lasts for various ways of making contact.
time_t nws_when; /* time of action */
};
-#define NUM_RPTS 2 /* number of story alternates */
+#define NUM_RPTS 2 /* number of story alternates */
struct rptstr {
signed char r_uid;
};
/* news verbs */
-#define N_WON_SECT 1
-#define N_SCT_LOSE 2
-#define N_SPY_SHOT 3
-#define N_SENT_TEL 4
-#define N_SIGN_TRE 5
-#define N_MAKE_LOAN 6
-#define N_REPAY_LOAN 7
-#define N_MAKE_SALE 8
-#define N_OVFLY_SECT 9
-#define N_SCT_SHELL 10
-#define N_SHP_SHELL 11
-#define N_TOOK_UNOCC 12
-#define N_TORP_SHIP 13
-#define N_FIRE_BACK 14
-#define N_BROKE_SANCT 15
-#define N_SCT_BOMB 16
-#define N_SHP_BOMB 17
-#define N_BOARD_SHIP 18
-#define N_SHP_LOSE 19
+#define N_WON_SECT 1
+#define N_SCT_LOSE 2
+#define N_SPY_SHOT 3
+#define N_SENT_TEL 4
+#define N_SIGN_TRE 5
+#define N_MAKE_LOAN 6
+#define N_REPAY_LOAN 7
+#define N_MAKE_SALE 8
+#define N_OVFLY_SECT 9
+#define N_SCT_SHELL 10
+#define N_SHP_SHELL 11
+#define N_TOOK_UNOCC 12
+#define N_TORP_SHIP 13
+#define N_FIRE_BACK 14
+#define N_BROKE_SANCT 15
+#define N_SCT_BOMB 16
+#define N_SHP_BOMB 17
+#define N_BOARD_SHIP 18
+#define N_SHP_LOSE 19
/* unused 20 */
-#define N_SEIZE_SECT 21
-#define N_HONOR_TRE 22
-#define N_VIOL_TRE 23
+#define N_SEIZE_SECT 21
+#define N_HONOR_TRE 22
+#define N_VIOL_TRE 23
/* unused 24 */
-#define N_HIT_MINE 25
-#define N_DECL_ALLY 26
+#define N_HIT_MINE 25
+#define N_DECL_ALLY 26
/* unused 27 */
-#define N_DECL_WAR 28
-#define N_DIS_ALLY 29
-#define N_DIS_WAR 30
-#define N_OUT_PLAGUE 31
-#define N_DIE_PLAGUE 32
-#define N_NAME_CHNG 33
-#define N_DIE_FAMINE 34
+#define N_DECL_WAR 28
+#define N_DIS_ALLY 29
+#define N_DIS_WAR 30
+#define N_OUT_PLAGUE 31
+#define N_DIE_PLAGUE 32
+#define N_NAME_CHNG 33
+#define N_DIE_FAMINE 34
/* unused 35 */
-#define N_DOWN_PLANE 36
-#define N_NUKE 37
+#define N_DOWN_PLANE 36
+#define N_NUKE 37
#define N_FREEDOM_FIGHT 38
#define N_SHOOT_CIV 39
#define N_LAUNCH 40
#define N_HURTS 44
#define N_TAKE 45
#define N_NUKE_STOP 46
-#define N_SCT_MISS 47
-#define N_SHP_MISS 48
+#define N_SCT_MISS 47
+#define N_SHP_MISS 48
#define N_TRADE 49
#define N_PIRATE_TRADE 50
#define N_PIRATE_KEEP 51
-#define N_SHIP_TORP 52
+#define N_SHIP_TORP 52
#define N_SUB_BOMB 53
/* unused 54 */
#define N_UNIT_BOMB 55
-#define N_LHIT_MINE 56
-#define N_FIRE_F_ATTACK 57
-#define N_FIRE_L_ATTACK 58
-#define N_FIRE_S_ATTACK 59
+#define N_LHIT_MINE 56
+#define N_FIRE_F_ATTACK 57
+#define N_FIRE_L_ATTACK 58
+#define N_FIRE_S_ATTACK 59
#define N_SACK_CAP 60
#define N_UP_FRIENDLY 61
#define N_DOWN_FRIENDLY 62
#define N_WELCH_DEAL 80
#define N_LND_LOSE 81
#define N_BOARD_LAND 82
-#define N_MAX_VERB 82
+#define N_MAX_VERB 82
#define N_NOTUSED 0
#define N_FOR 1
#define N_HOME 9
#define N_SPY 10
#define N_TELE 11
-#define N_MAX_PAGE 11
+#define N_MAX_PAGE 11
#define getnews(n, p) ef_read(EF_NEWS, (n), (p))
#define putnews(n, p) ef_write(EF_NEWS, (n), (p))
#include <time.h>
#include "types.h"
-#define N_MAXNUKE 20
-#define MIN_DRNUKE_CONST 0.001
+#define N_MAXNUKE 20
+#define MIN_DRNUKE_CONST 0.001
struct nukstr {
/* initial part must match struct empobj */
signed char n_type; /* index in nchr[] */
};
-#define N_NEUT bit(0) /* Neutron bomb (low damage, high fallout) */
+#define N_NEUT bit(0) /* Neutron bomb (low damage, high fallout) */
#define getnuke(n, p) ef_read(EF_NUKE, (n), (p))
#define putnuke(n, p) ef_write(EF_NUKE, (n), (p))
extern char dflt_econfig[];
/* Game parameters, can be set in econfig */
-#define EMP_CONFIG_H_OUTPUT
+#define EMP_CONFIG_H_OUTPUT
#include "econfig-spec.h"
#undef EMP_CONFIG_H_OUTPUT
#include "types.h"
/* direction indices */
-#define DIR_STOP 0
-#define DIR_UR 1
-#define DIR_R 2
-#define DIR_DR 3
-#define DIR_DL 4
-#define DIR_L 5
-#define DIR_UL 6
-#define DIR_VIEW 7
-#define DIR_MAP 8
-#define DIR_FIRST 1
-#define DIR_LAST 6
+#define DIR_STOP 0
+#define DIR_UR 1
+#define DIR_R 2
+#define DIR_DR 3
+#define DIR_DL 4
+#define DIR_L 5
+#define DIR_UL 6
+#define DIR_VIEW 7
+#define DIR_MAP 8
+#define DIR_FIRST 1
+#define DIR_LAST 6
enum p_mode { /* How to find path to destination */
P_NONE, /* don't */
#ifndef PLAGUE_H
#define PLAGUE_H
-#define PLG_HEALTHY 0
-#define PLG_DYING 1
-#define PLG_INFECT 2
-#define PLG_INCUBATE 3
-#define PLG_EXPOSED 4
+#define PLG_HEALTHY 0
+#define PLG_DYING 1
+#define PLG_INFECT 2
+#define PLG_INCUBATE 3
+#define PLG_EXPOSED 4
#endif
#include "types.h"
#define PLN_TYPE_MAX 46
-#define PLANE_MINEFF 10
+#define PLANE_MINEFF 10
struct plnstr {
/* initial part must match struct empobj */
float pln_theta; /* position in orbital sine wave */
};
-#define PLN_LAUNCHED bit(0) /* Flying (satellite: in orbit) */
-#define PLN_SYNCHRONOUS bit(1) /* A satellite in geo-synchronous orbit */
-#define PLN_AIRBURST bit(2) /* Airburst the nuke we're armed with */
+#define PLN_LAUNCHED bit(0) /* Flying (satellite: in orbit) */
+#define PLN_SYNCHRONOUS bit(1) /* A satellite in geo-synchronous orbit */
+#define PLN_AIRBURST bit(2) /* Airburst the nuke we're armed with */
struct plchrstr {
char *pl_name; /* full name of type of plane */
#define NORM (bit(2) | VIS)
#define GOD (bit(3) | NORM | VIS)
#define EXEC bit(5)
-#define CAP bit(6)
-#define MONEY bit(7)
+#define CAP bit(6)
+#define MONEY bit(7)
enum player_sleep {
PLAYER_SLEEP_NEVER, PLAYER_SLEEP_ON_INPUT, PLAYER_SLEEP_FREELY
*/
#define CLIENTPROTO 2
-#define C_CMDOK 0x0
-#define C_DATA 0x1
-#define C_INIT 0x2
-#define C_EXIT 0x3
+#define C_CMDOK 0x0
+#define C_DATA 0x1
+#define C_INIT 0x2
+#define C_EXIT 0x3
#define C_FLUSH 0x4
-#define C_NOECHO 0x5
+#define C_NOECHO 0x5
#define C_PROMPT 0x6
-#define C_ABORT 0x7
+#define C_ABORT 0x7
#define C_REDIR 0x8
#define C_PIPE 0x9
-#define C_CMDERR 0xA
-#define C_BADCMD 0xB
+#define C_CMDERR 0xA
+#define C_BADCMD 0xB
#define C_EXECUTE 0xC
#define C_FLASH 0xD
#define C_INFORM 0xE
#ifndef QUEUE_H
#define QUEUE_H
-#define QEMPTY(p) ((p)->q_forw == (p))
+#define QEMPTY(p) ((p)->q_forw == (p))
struct emp_qelem {
struct emp_qelem *q_forw;
#ifndef RETREAT_H
#define RETREAT_H
-#define MAX_RETREAT 2 /* Max number of sectors you can retreat */
-#define RET_LEN 10
+#define MAX_RETREAT 2 /* Max number of sectors you can retreat */
+#define RET_LEN 10
/* Retreat conditions */
-#define RET_GROUP 1 /* Whole group retreats */
-#define RET_INJURED 2 /* Retreat when damaged at all */
-#define RET_TORPED 4 /* Retreat when torped */
-#define RET_SONARED 8 /* Retreat when sonared */
-#define RET_HELPLESS 16 /* Retreat when fired upon from beyond range */
-#define RET_BOMBED 32 /* Retreat when bombed */
-#define RET_DCHRGED 64 /* Retreat when depth-charged */
-#define RET_BOARDED 128 /* Retreat when unsuccessfully boarded */
+#define RET_GROUP 1 /* Whole group retreats */
+#define RET_INJURED 2 /* Retreat when damaged at all */
+#define RET_TORPED 4 /* Retreat when torped */
+#define RET_SONARED 8 /* Retreat when sonared */
+#define RET_HELPLESS 16 /* Retreat when fired upon from beyond range */
+#define RET_BOMBED 32 /* Retreat when bombed */
+#define RET_DCHRGED 64 /* Retreat when depth-charged */
+#define RET_BOARDED 128 /* Retreat when unsuccessfully boarded */
#endif
/* sector types (must agree with order in dchr, empglb.c) */
-#define SCT_WATER 0 /* basics */
-#define SCT_MOUNT 1
-#define SCT_SANCT 2
-#define SCT_WASTE 3
-#define SCT_RURAL 4
-#define SCT_CAPIT 5
-#define SCT_URAN 6
-#define SCT_PARK 7
-#define SCT_ARMSF 8 /* industries */
-#define SCT_AMMOF 9
-#define SCT_MINE 10
-#define SCT_GMINE 11
-#define SCT_HARBR 12
-#define SCT_WAREH 13
-#define SCT_AIRPT 14
-#define SCT_AGRI 15
-#define SCT_OIL 16
-#define SCT_LIGHT 17
-#define SCT_HEAVY 18
-#define SCT_FORTR 19 /* military/scientific */
-#define SCT_TECH 20
-#define SCT_RSRCH 21
-#define SCT_NUKE 22
-#define SCT_LIBR 23
-#define SCT_HIWAY 24 /* communications */
-#define SCT_RADAR 25
-#define SCT_HEADQ 26 /* headquarters */
-#define SCT_BHEAD 27 /* Bridge head */
-#define SCT_BSPAN 28 /* Bridge span */
-#define SCT_BANK 29 /* financial */
-#define SCT_REFINE 30 /* refinery */
+#define SCT_WATER 0 /* basics */
+#define SCT_MOUNT 1
+#define SCT_SANCT 2
+#define SCT_WASTE 3
+#define SCT_RURAL 4
+#define SCT_CAPIT 5
+#define SCT_URAN 6
+#define SCT_PARK 7
+#define SCT_ARMSF 8 /* industries */
+#define SCT_AMMOF 9
+#define SCT_MINE 10
+#define SCT_GMINE 11
+#define SCT_HARBR 12
+#define SCT_WAREH 13
+#define SCT_AIRPT 14
+#define SCT_AGRI 15
+#define SCT_OIL 16
+#define SCT_LIGHT 17
+#define SCT_HEAVY 18
+#define SCT_FORTR 19 /* military/scientific */
+#define SCT_TECH 20
+#define SCT_RSRCH 21
+#define SCT_NUKE 22
+#define SCT_LIBR 23
+#define SCT_HIWAY 24 /* communications */
+#define SCT_RADAR 25
+#define SCT_HEADQ 26 /* headquarters */
+#define SCT_BHEAD 27 /* Bridge head */
+#define SCT_BSPAN 28 /* Bridge span */
+#define SCT_BANK 29 /* financial */
+#define SCT_REFINE 30 /* refinery */
#define SCT_ENLIST 31 /* enlistment center */
#define SCT_PLAINS 32 /* plains sector */
#define SCT_BTOWER 33 /* Bridge tower */
#include "types.h"
#define SHP_TYPE_MAX 46
-#define SHIP_MINEFF 20
+#define SHIP_MINEFF 20
/* bit masks for the autonav mode flags */
#define MAXSHPPATH 28
-#define MAXSHPNAMLEN 24
+#define MAXSHPNAMLEN 24
struct shpstr {
/* initial part must match struct empobj */
#include <time.h>
#include "types.h"
-#define MAXTELSIZE 1024 /* doesn't apply to TEL_UPDATE */
+#define MAXTELSIZE 1024 /* doesn't apply to TEL_UPDATE */
#define TEL_NORM 0 /* normal */
#define TEL_ANNOUNCE 1 /* announcement */
#define TS_SIGNED AGREE_SIGNED
/* treaty clauses */
-#define LNDATT bit(0) /* no attacks on land units */
-#define SEAATT bit(1) /* no attacks on ships */
-#define SEAFIR bit(2) /* no shelling ships */
-#define LANATT bit(3) /* no attacks on sectors */
-#define LANFIR bit(4) /* no shelling sectors */
-#define NEWSHP bit(5) /* no new ships */
-#define NEWNUK bit(6) /* no new nuclear weapons */
-#define NEWPLN bit(7) /* no new planes */
+#define LNDATT bit(0) /* no attacks on land units */
+#define SEAATT bit(1) /* no attacks on ships */
+#define SEAFIR bit(2) /* no shelling ships */
+#define LANATT bit(3) /* no attacks on sectors */
+#define LANFIR bit(4) /* no shelling sectors */
+#define NEWSHP bit(5) /* no new ships */
+#define NEWNUK bit(6) /* no new nuclear weapons */
+#define NEWPLN bit(7) /* no new planes */
#define NEWLND bit(8) /* no new land units */
-#define TRTENL bit(9) /* no enlistment */
+#define TRTENL bit(9) /* no enlistment */
#define SUBFIR bit(10) /* no depth-charging submarines */
#define gettre(n, p) ef_read(EF_TREATY, (n), (p))
int flags;
struct as_node *back;
};
-#define AS_TRIED 1 /* we've tried this node before */
+#define AS_TRIED 1 /* we've tried this node before */
/*
* Linked list of nodes, used internally by A* algorithm.
/*
* Some cheezy allocation macros.
*/
-#define AS_NEW_ARRAY(p, type, n, err) \
+#define AS_NEW_ARRAY(p, type, n, err) \
(p) = (type *)calloc((n), sizeof(*(p))); \
if ((p) == NULL) \
return err; \
-#define AS_NEW(p, type, err) \
+#define AS_NEW(p, type, err) \
AS_NEW_ARRAY((p), type, 1, err);
-#define AS_NEW_MALLOC(p, type, err) \
+#define AS_NEW_MALLOC(p, type, err) \
(p) = (type *)malloc(sizeof(type)); \
if ((p) == NULL) \
return err; \
#include "optlist.h"
#include "ship.h"
-#define TSIZE 200
+#define TSIZE 200
struct coast {
struct coast *c_next;
/*
* The values 1 and -1 are important below, don't change them.
*/
-#define LOAD 1
-#define UNLOAD -1
+#define LOAD 1
+#define UNLOAD -1
static int load_plane_ship(struct sctstr *sectp, struct shpstr *sp,
int noisy, int load_unload, int *nshipsp);
#include "optlist.h"
#include "plane.h"
-#define TSIZE 200
+#define TSIZE 200
struct sky {
struct sky *s_next;
#include "sect.h"
#include "xy.h"
-#define BP_ASHASHSIZE 128 /* A* queue hash table size */
-#define BP_NEIGHBORS 6 /* max number of neighbors */
+#define BP_ASHASHSIZE 128 /* A* queue hash table size */
+#define BP_NEIGHBORS 6 /* max number of neighbors */
struct bestp {
int sctcache_hits;
/* econfig keys */
static int emp_config_dummy;
struct keymatch configkeys[] = {
-#define EMP_CONFIG_C_OUTPUT
+#define EMP_CONFIG_C_OUTPUT
#include "econfig-spec.h"
#undef EMP_CONFIG_C_OUTPUT
};
#include "sect.h"
#include "ship.h"
-#define NOISY 1
+#define NOISY 1
static int sb(natid, natid, struct sctstr *, coord, coord, int, int);
#include "update.h"
#ifndef PI
-#define PI 3.14159265358979323846
+#define PI 3.14159265358979323846
#endif
void
int leader;
signed char real_q;
/* defines for the real_q member */
-#define LEADER_VIRTUAL 0
-#define LEADER_REAL 1
-#define LEADER_WRONGSECT 2
+#define LEADER_VIRTUAL 0
+#define LEADER_REAL 1
+#define LEADER_WRONGSECT 2
coord x, y;
natid own;
unsigned maxmoves;