Delete dead code, fix indentation, spelling, obvious warning

avoidance, doc fixes.  No functional changes.
This commit is contained in:
Markus Armbruster 2004-02-27 20:13:28 +00:00
parent f5e49a830c
commit d2e0c8224b
11 changed files with 23 additions and 24 deletions

View file

@ -53,7 +53,7 @@ struct lndstr {
short lnd_uid; /* unit id (land unit) */ short lnd_uid; /* unit id (land unit) */
coord lnd_x; /* x location in abs coords */ coord lnd_x; /* x location in abs coords */
coord lnd_y; /* y location in abs coords */ coord lnd_y; /* y location in abs coords */
s_char lnd_type; /* ship type */ s_char lnd_type; /* index in lchr[] */
s_char lnd_effic; /* 0% to 100% */ s_char lnd_effic; /* 0% to 100% */
s_char lnd_mobil; /* mobility units made int for RS/6000 */ s_char lnd_mobil; /* mobility units made int for RS/6000 */
short lnd_sell; /* pointer to trade file */ short lnd_sell; /* pointer to trade file */

View file

@ -76,7 +76,7 @@ struct mob_acc_globals {
#define RESOLVE_IPADDRESS /* resolve ip addresses into hostnames */ #define RESOLVE_IPADDRESS /* resolve ip addresses into hostnames */
#endif #endif
typedef u_char natid; /* also change NSC_NATID in nsc.h */ typedef u_char natid; /* NSC_NATID must match this */
#if defined(__linux__ ) || defined(__osf__) #if defined(__linux__ ) || defined(__osf__)
#define POSIXSIGNALS 1 #define POSIXSIGNALS 1
@ -98,7 +98,7 @@ typedef char s_char; /* change to signed char for aix */
#else #else
typedef signed char s_char; typedef signed char s_char;
#endif /* !aix && !sgi */ #endif /* !aix && !sgi */
typedef short coord; /* also change NSC_COORD in nsc.h */ typedef short coord;
/* /*
* watch it; your compiler might not like this. * watch it; your compiler might not like this.
* If you think this is bogus, look at /usr/include/struct.h * If you think this is bogus, look at /usr/include/struct.h

View file

@ -115,7 +115,7 @@ struct nstr_item {
#define NSC_SHORT (3<<18) /* pointer to short */ #define NSC_SHORT (3<<18) /* pointer to short */
#define NSC_USHORT (4<<18) /* pointer to unsigned short */ #define NSC_USHORT (4<<18) /* pointer to unsigned short */
#define NSC_INT (5<<18) /* pointer to int */ #define NSC_INT (5<<18) /* pointer to int */
#define NSC_LONG (6<<18) /* pointer to long */ #define NSC_LONG (6<<18) /* pointer to long */
#define NSC_XCOORD (7<<18) /* pointer to coord that needs x conversion */ #define NSC_XCOORD (7<<18) /* pointer to coord that needs x conversion */
#define NSC_YCOORD (8<<18) /* pointer to coord that needs y conversion */ #define NSC_YCOORD (8<<18) /* pointer to coord that needs y conversion */
#define NSC_FLOAT (9<<18) /* pointer to float */ #define NSC_FLOAT (9<<18) /* pointer to float */
@ -134,7 +134,6 @@ struct castr {
long ca_code; /* encoded form */ long ca_code; /* encoded form */
s_char *ca_name; /* name used for matches */ s_char *ca_name; /* name used for matches */
u_short ca_len; /* Used for arrays */ u_short ca_len; /* Used for arrays */
long ca_edv; /* which commands is this field visible to? */
}; };
/* variables using the above */ /* variables using the above */
@ -152,7 +151,6 @@ extern struct castr trade_ca[];
extern struct castr loan_ca[]; extern struct castr loan_ca[];
extern struct castr genitem_ca[]; extern struct castr genitem_ca[];
extern struct castr map_ca[]; extern struct castr map_ca[];
extern struct castr bmp_ca[];
extern struct castr lost_ca[]; extern struct castr lost_ca[];
extern struct castr commodity_ca[]; extern struct castr commodity_ca[];

View file

@ -51,7 +51,7 @@ struct plnstr {
short pln_uid; /* plane unit id */ short pln_uid; /* plane unit id */
coord pln_x; /* plane x-y */ coord pln_x; /* plane x-y */
coord pln_y; coord pln_y;
s_char pln_type; /* fighter, bomber, etc */ s_char pln_type; /* index in plchr[] */
s_char pln_effic; /* actually "training" */ s_char pln_effic; /* actually "training" */
s_char pln_mobil; /* plane mobility */ s_char pln_mobil; /* plane mobility */
short pln_sell; /* index into trade file */ short pln_sell; /* index into trade file */

View file

@ -72,7 +72,7 @@ struct shpstr {
short shp_uid; /* unit id (ship #) */ short shp_uid; /* unit id (ship #) */
coord shp_x; /* x location in abs coords */ coord shp_x; /* x location in abs coords */
coord shp_y; /* y location in abs coords */ coord shp_y; /* y location in abs coords */
s_char shp_type; /* ship type */ s_char shp_type; /* index in mchr[] */
s_char shp_effic; /* 0% to 100% */ s_char shp_effic; /* 0% to 100% */
s_char shp_mobil; /* mobility units */ s_char shp_mobil; /* mobility units */
short shp_sell; /* pointer to trade file */ short shp_sell; /* pointer to trade file */

View file

@ -360,7 +360,7 @@ resbenefit(natid who, int good)
} }
} }
extern void void
resnoise(struct sctstr *sptr, int public_amt, s_char *name, int old, resnoise(struct sctstr *sptr, int public_amt, s_char *name, int old,
int new) int new)
{ {

View file

@ -62,7 +62,7 @@ tele(void)
logerror("tele: typed_wu failed to #%d", to); logerror("tele: typed_wu failed to #%d", to);
} else if (*player->argp[0] == 'p') { } else if (*player->argp[0] == 'p') {
if (getele("your Gracious Deity", buf) <= 0) { if (getele("your Gracious Deity", buf) <= 0) {
pr("Prayor aborted\n"); pr("Prayer aborted\n");
return RET_OK; return RET_OK;
} }
pr("\n"); pr("\n");

View file

@ -70,10 +70,10 @@ upgr(void)
case 'L': case 'L':
return lupgr(); return lupgr();
default: default:
pr("Ships, land units or planes only!\n"); break;
return RET_SYN;
} }
return RET_OK; pr("Ships, land units or planes only!\n");
return RET_SYN;
} }
static int static int

View file

@ -73,9 +73,10 @@ nstr_exec(struct nscstr *conds, register int ncond, void *ptr, int type)
lhs = decode(player->cnum, nsc->fld1, ptr, type); lhs = decode(player->cnum, nsc->fld1, ptr, type);
op = oper; op = oper;
if ((op == '<' && lhs >= rhs) || if ((op == '<' && lhs >= rhs)
(op == '=' && lhs != rhs) || || (op == '=' && lhs != rhs)
(op == '>' && lhs <= rhs) || (op == '#' && lhs == rhs)) || (op == '>' && lhs <= rhs)
|| (op == '#' && lhs == rhs))
return 0; return 0;
} }
return 1; return 1;

View file

@ -43,8 +43,8 @@
* 2 = update only bmap with force * 2 = update only bmap with force
*/ */
static int static int do_map_set(natid cnum, s_char *map, coord x, coord y,
do_map_set(natid cnum, s_char *map, coord x, coord y, s_char t, int force, int sync); s_char t, int force, int sync);
int int
map_set(natid cnum, coord x, coord y, s_char t, int only_bmap) map_set(natid cnum, coord x, coord y, s_char t, int only_bmap)

View file

@ -113,14 +113,15 @@ encode(register s_char *str, long int *val, int type)
return 0; return 0;
} }
if (isdigit(*str) || ((*str == '-') && isdigit(str[1]))) { if (isdigit(*str) || ((*str == '-') && isdigit(str[1]))) {
#ifdef BIT16ONLY
/* XXX silently truncate to 16 bit int */
*val = atoi(str) & 0xffff;
#else
*val = atoi(str); *val = atoi(str);
#endif /* BIT16ONLY */
return 2; return 2;
} }
/*
* FIXME This accepts the first match found, even if there are
* more matches in other tables, i.e. it quietly accepts ambiguous
* matches (matches in multiple tables), and fails to prefer an
* exact match to partial match in an earlier table.
*/
if ((i = typematch(str, type)) >= 0) { if ((i = typematch(str, type)) >= 0) {
*val = i; *val = i;
return 1; return 1;
@ -148,7 +149,6 @@ encode(register s_char *str, long int *val, int type)
if (i >= 0) { if (i >= 0) {
*val = var_ca[i].ca_code & ~NSC_ROUND; *val = var_ca[i].ca_code & ~NSC_ROUND;
return legal_val(str, *val); return legal_val(str, *val);
return 1;
} }
if (i == M_NOTUNIQUE) { if (i == M_NOTUNIQUE) {
pr("%s -- ambiguous commodity selector\n", str); pr("%s -- ambiguous commodity selector\n", str);