(I_NONE, I_CIVIL, I_MILIT, I_SHELL, I_GUN, I_PETROL, I_IRON, I_DUST,
I_BAR, I_FOOD, I_OIL, I_LCM, I_HCM, I_UW, I_RAD, I_MAX): Turn macros into enumeration constants. (i_type): New. Use where appropriate. No functional changes, except that I_NONE is now catched properly in a few places.
This commit is contained in:
parent
308430e751
commit
d30942632b
38 changed files with 143 additions and 134 deletions
|
@ -33,8 +33,8 @@
|
|||
|
||||
void fill_update_array(int *bp, struct sctstr *sp);
|
||||
int *get_wp(int *bp, struct sctstr *sp, int cm);
|
||||
int gt_bg_nmbr(int *bp, struct sctstr *sp, int comm);
|
||||
void pt_bg_nmbr(int *bp, struct sctstr *sp, int comm, int amount);
|
||||
int gt_bg_nmbr(int *bp, struct sctstr *sp, i_type comm);
|
||||
void pt_bg_nmbr(int *bp, struct sctstr *sp, i_type comm, int amount);
|
||||
void get_materials(struct sctstr *sp, int *bp, int *mvec, int check);
|
||||
|
||||
extern long money[MAXNOC];
|
||||
|
|
|
@ -40,7 +40,7 @@ struct comstr {
|
|||
short ef_type;
|
||||
natid com_owner;
|
||||
short com_uid;
|
||||
int com_type;
|
||||
i_type com_type;
|
||||
int com_amount;
|
||||
float com_price;
|
||||
int com_maxbidder;
|
||||
|
|
|
@ -46,9 +46,28 @@ enum {
|
|||
NUMPKG = BPKG + 1
|
||||
};
|
||||
|
||||
typedef enum {
|
||||
I_NONE,
|
||||
I_CIVIL,
|
||||
I_MILIT,
|
||||
I_SHELL,
|
||||
I_GUN,
|
||||
I_PETROL,
|
||||
I_IRON,
|
||||
I_DUST,
|
||||
I_BAR,
|
||||
I_FOOD,
|
||||
I_OIL,
|
||||
I_LCM,
|
||||
I_HCM,
|
||||
I_UW,
|
||||
I_RAD,
|
||||
I_MAX = I_RAD
|
||||
} ATTRIBUTE((packed)) i_type;
|
||||
|
||||
struct ichrstr {
|
||||
int i_mnem; /* usually the initial letter */
|
||||
int i_vtype; /* var type */
|
||||
i_type i_vtype; /* var type */
|
||||
int i_value; /* mortgage value */
|
||||
int i_sell; /* can this be sold? */
|
||||
int i_lbs; /* how hard to move */
|
||||
|
|
|
@ -65,6 +65,14 @@ typedef enum {
|
|||
} nsc_type;
|
||||
typedef char packed_nsc_type;
|
||||
|
||||
/* Return nsc_type for a signed integer with the same size as TYPE. */
|
||||
#define NSC_SITYPE(type) \
|
||||
(sizeof(type) == 1 ? NSC_CHAR \
|
||||
: sizeof(type) == sizeof(short) ? NSC_SHORT \
|
||||
: sizeof(type) == sizeof(int) ? NSC_INT \
|
||||
: sizeof(type) == sizeof(long) ? NSC_LONG \
|
||||
: 1/0)
|
||||
|
||||
/* Value category */
|
||||
typedef enum {
|
||||
NSC_NOCAT,
|
||||
|
|
|
@ -41,9 +41,9 @@
|
|||
enum { MAXPRCON = 3 };
|
||||
|
||||
struct pchrstr {
|
||||
u_char p_ctype[MAXPRCON]; /* constituent types */
|
||||
i_type p_ctype[MAXPRCON]; /* constituent types */
|
||||
u_short p_camt[MAXPRCON]; /* constituent amounts */
|
||||
int p_type; /* product item type, or I_NONE if level */
|
||||
i_type p_type; /* product item type, or I_NONE if level */
|
||||
int p_level; /* level index (NAT_?LEV), or -1 if item */
|
||||
int p_cost; /* dollars / product unit */
|
||||
int p_nrndx; /* index into sect of natural resource */
|
||||
|
|
|
@ -65,9 +65,9 @@ extern int check_market(void);
|
|||
extern void set_coastal(struct sctstr *);
|
||||
extern int sendmessage(struct natstr *, struct natstr *, char *, int);
|
||||
extern void gift(int, int, s_char *, int, s_char *);
|
||||
extern int display_mark(int, int);
|
||||
extern int want_to_abandon(struct sctstr *, int, int, struct lndstr *);
|
||||
extern int would_abandon(struct sctstr *, int, int, struct lndstr *);
|
||||
extern int display_mark(i_type, int);
|
||||
extern int want_to_abandon(struct sctstr *, i_type, int, struct lndstr *);
|
||||
extern int would_abandon(struct sctstr *, i_type, int, struct lndstr *);
|
||||
extern int nav_map(int, int, int);
|
||||
extern int count_pop(register int);
|
||||
extern int scuttle_tradeship(struct shpstr *, int);
|
||||
|
@ -102,7 +102,7 @@ extern void planedamage(struct plnstr *, int);
|
|||
extern int nukedamage(struct nchrstr *, int, int);
|
||||
extern int effdamage(register int, int);
|
||||
extern void item_damage(int, short *);
|
||||
extern int commdamage(register int, int, int);
|
||||
extern int commdamage(int, int, i_type);
|
||||
/* check.c */
|
||||
extern int check_sect_ok(struct sctstr *);
|
||||
extern int check_ship_ok(struct shpstr *);
|
||||
|
@ -511,9 +511,9 @@ extern int snxtitem(register struct nstr_item *, int, s_char *);
|
|||
extern int snxtsct(register struct nstr_sect *, s_char *);
|
||||
/* supply.c */
|
||||
extern void resupply_all(struct lndstr *);
|
||||
extern void resupply_commod(struct lndstr *, int);
|
||||
extern int supply_commod(int, int, int, int, int);
|
||||
extern int try_supply_commod(int, int, int, int, int);
|
||||
extern void resupply_commod(struct lndstr *, i_type);
|
||||
extern int supply_commod(int, int, int, i_type, int);
|
||||
extern int try_supply_commod(int, int, int, i_type, int);
|
||||
extern int has_supply(struct lndstr *);
|
||||
extern int use_supply(struct lndstr *);
|
||||
/* takeover.c */
|
||||
|
@ -578,10 +578,10 @@ extern void prod_nat(int);
|
|||
extern int nav_ship(register struct shpstr *);
|
||||
/* nav_util.c */
|
||||
extern int check_nav(struct sctstr *);
|
||||
extern int load_it(register struct shpstr *, register struct sctstr *,
|
||||
extern int load_it(struct shpstr *, struct sctstr *,
|
||||
int);
|
||||
extern void unload_it(register struct shpstr *);
|
||||
extern void auto_fuel_ship(register struct shpstr *);
|
||||
extern void unload_it(struct shpstr *);
|
||||
extern void auto_fuel_ship(struct shpstr *);
|
||||
/* nxtitemp.c */
|
||||
extern s_char *nxtitemp(struct nstr_item *, int);
|
||||
/* nxtsctp.c */
|
||||
|
|
|
@ -82,8 +82,8 @@ struct shpstr {
|
|||
short shp_glim;
|
||||
coord shp_destx[2]; /* location for ship destination */
|
||||
coord shp_desty[2];
|
||||
s_char shp_tstart[TMAX]; /* what goods to pick up at start point */
|
||||
s_char shp_tend[TMAX]; /* what goods to pick up at end point */
|
||||
i_type shp_tstart[TMAX]; /* what goods to pick up at start point */
|
||||
i_type shp_tend[TMAX]; /* what goods to pick up at end point */
|
||||
short shp_lstart[TMAX]; /* How much do we pick up at the start */
|
||||
short shp_lend[TMAX]; /* How much do we pick up at the end */
|
||||
u_char shp_autonav; /* autonavigation flags */
|
||||
|
|
|
@ -40,21 +40,4 @@
|
|||
#define PLG_INCUBATE 3
|
||||
#define PLG_EXPOSED 4
|
||||
|
||||
#define I_NONE 0
|
||||
#define I_CIVIL 1
|
||||
#define I_MILIT 2
|
||||
#define I_SHELL 3
|
||||
#define I_GUN 4
|
||||
#define I_PETROL 5
|
||||
#define I_IRON 6
|
||||
#define I_DUST 7
|
||||
#define I_BAR 8
|
||||
#define I_FOOD 9
|
||||
#define I_OIL 10
|
||||
#define I_LCM 11
|
||||
#define I_HCM 12
|
||||
#define I_UW 13
|
||||
#define I_RAD 14
|
||||
#define I_MAX 14
|
||||
|
||||
#endif /* _VAR_H_ */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue