Replace some typedef names by enum tags.
Also get rid of some mildly silly manual packing of enum types.
This commit is contained in:
parent
7ec0f0c0d0
commit
06a0036c63
13 changed files with 39 additions and 41 deletions
|
@ -700,7 +700,7 @@ docountry(char op, int arg, char *p, struct natstr *np)
|
|||
np->nat_yorg = newy;
|
||||
break;
|
||||
case 's':
|
||||
np->nat_stat = (nat_status)errcheck(arg, STAT_UNUSED, STAT_GOD);
|
||||
np->nat_stat = errcheck(arg, STAT_UNUSED, STAT_GOD);
|
||||
break;
|
||||
case 'u':
|
||||
arg = errcheck(arg, 0, m_m_p_d);
|
||||
|
|
|
@ -69,10 +69,10 @@ nstr_mksymval(struct valstr *val, struct castr *ca, int idx)
|
|||
* nstr_coerce_val(VAL, WANT, STR) succeeded.
|
||||
*/
|
||||
struct valstr *
|
||||
nstr_exec_val(struct valstr *val, natid cnum, void *ptr, nsc_type want)
|
||||
nstr_exec_val(struct valstr *val, natid cnum, void *ptr, enum nsc_type want)
|
||||
{
|
||||
char *memb_ptr;
|
||||
nsc_type valtype;
|
||||
enum nsc_type valtype;
|
||||
int idx;
|
||||
struct natstr *natp;
|
||||
|
||||
|
|
|
@ -181,9 +181,10 @@ struct castr dchr_ca[] = {
|
|||
{"peffic", fldoff(d_peffic), NSC_INT, 0, NULL, EF_BAD, 0},
|
||||
{"mob0", fldoff(d_mob0), NSC_FLOAT, 0, NULL, EF_BAD, 0},
|
||||
{"mob1", fldoff(d_mob1), NSC_FLOAT, 0, NULL, EF_BAD, 0},
|
||||
{"nav", fldoff(d_nav), NSC_SITYPE(d_navigation), 0, NULL,
|
||||
{"nav", fldoff(d_nav), NSC_SITYPE(enum d_navigation), 0, NULL,
|
||||
EF_SECTOR_NAVIGATION, 0},
|
||||
{"pkg", fldoff(d_pkg), NSC_SITYPE(i_packing), 0, NULL, EF_PACKING, 0},
|
||||
{"pkg", fldoff(d_pkg), NSC_SITYPE(enum i_packing), 0, NULL,
|
||||
EF_PACKING, 0},
|
||||
{"ostr", fldoff(d_ostr), NSC_FLOAT, 0, NULL, EF_BAD, 0},
|
||||
{"dstr", fldoff(d_dstr), NSC_FLOAT, 0, NULL, EF_BAD, 0},
|
||||
{"value", fldoff(d_value), NSC_INT, 0, NULL, EF_BAD, 0},
|
||||
|
@ -541,7 +542,7 @@ struct castr cou_ca[] = {
|
|||
* necessary for foreign levels.
|
||||
*/
|
||||
{"cnum", fldoff(nat_cnum), NSC_NATID, 0, NULL, EF_NATION, 0},
|
||||
{"stat", fldoff(nat_stat), NSC_SITYPE(nat_status), 0, NULL,
|
||||
{"stat", fldoff(nat_stat), NSC_SITYPE(enum nat_status), 0, NULL,
|
||||
EF_NATION_STATUS, NSC_EXTRA},
|
||||
{"cname", fldoff(nat_cnam), NSC_STRINGY, 20, NULL, EF_BAD, NSC_EXTRA},
|
||||
{"passwd", fldoff(nat_pnam), NSC_STRINGY, 20, NULL,
|
||||
|
|
|
@ -483,10 +483,10 @@ cond_type_mismatch(char *str)
|
|||
* messages if it is a null pointer.
|
||||
*/
|
||||
int
|
||||
nstr_coerce_val(struct valstr *val, nsc_type to, char *str)
|
||||
nstr_coerce_val(struct valstr *val, enum nsc_type to, char *str)
|
||||
{
|
||||
/* FIXME get rid of promotion? */
|
||||
nsc_type from = nstr_promote(val->val_type);
|
||||
enum nsc_type from = nstr_promote(val->val_type);
|
||||
|
||||
if (from == NSC_NOTYPE)
|
||||
return 0;
|
||||
|
|
|
@ -55,7 +55,7 @@
|
|||
*
|
||||
* or 0 for none of the above.
|
||||
*/
|
||||
ns_seltype
|
||||
enum ns_seltype
|
||||
sarg_type(char *str)
|
||||
{
|
||||
int c;
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
|
||||
static int
|
||||
deliver(struct sctstr *from, struct ichrstr *ip, int dir,
|
||||
int thresh, int amt_src, int plague, i_packing packing)
|
||||
int thresh, int amt_src, int plague, enum i_packing packing)
|
||||
{
|
||||
struct sctstr *to;
|
||||
i_type vtype; /* item vartype */
|
||||
|
@ -126,7 +126,7 @@ dodeliver(struct sctstr *sp)
|
|||
int thresh;
|
||||
int dir;
|
||||
int plague;
|
||||
i_packing packing;
|
||||
enum i_packing packing;
|
||||
int n;
|
||||
|
||||
if (sp->sct_mobil <= 0)
|
||||
|
|
|
@ -55,7 +55,7 @@ dodistribute(struct sctstr *sp, int imex, char *path, double dist_i_cost,
|
|||
int thresh;
|
||||
int amt_dist;
|
||||
int amt_sect;
|
||||
i_packing sect_packing, dist_packing;
|
||||
enum i_packing sect_packing, dist_packing;
|
||||
int pack;
|
||||
double mcost;
|
||||
int diff;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue