short lnd_ship; /* pointer to transporting ship */
s_char lnd_harden; /* for missiles */
short lnd_retreat; /* retreat percentage */
- u_char lnd_fuel; /* How much fuel do we have */
- u_char lnd_nxlight; /* How many xlight planes on board? */
+ unsigned char lnd_fuel; /* How much fuel do we have */
+ unsigned char lnd_nxlight; /* How many xlight planes on board? */
int lnd_rflags; /* When do I retreat? */
char lnd_rpath[RET_LEN]; /* retreat path */
- u_char lnd_rad_max; /* max radius for this unit */
- u_char lnd_scar; /* how experienced the unit is (not used) */
+ unsigned char lnd_rad_max; /* max radius for this unit */
+ unsigned char lnd_scar; /* how experienced the unit is (not used) */
short lnd_item[I_MAX+1]; /* amount of items on board */
short lnd_pstage; /* plague stage */
short lnd_ptime; /* how many etus remain in this stage */
short lnd_land; /* pointer to transporting unit */
- u_char lnd_nland;
+ unsigned char lnd_nland;
time_t lnd_access; /* Last time mob was updated (MOB_ACCESS) */
float lnd_att; /* attack multiplier */
float lnd_def; /* defense multiplier */
int lnd_dam; /* # of guns firing */
int lnd_ammo; /* firing ammu used per shot */
int lnd_aaf; /* aa fire */
- u_char lnd_fuelc; /* fuel capacity */
- u_char lnd_fuelu; /* fuel used per 10 mob */
- u_char lnd_maxlight; /* maximum number of xlight planes */
- u_char lnd_maxland; /* maximum number of units */
+ unsigned char lnd_fuelc; /* fuel capacity */
+ unsigned char lnd_fuelu; /* fuel used per 10 mob */
+ unsigned char lnd_maxlight; /* maximum number of xlight planes */
+ unsigned char lnd_maxland; /* maximum number of units */
time_t lnd_timestamp; /* Last time this unit was touched */
};
int l_dam; /* # of guns firing */
int l_ammo; /* firing ammu used per shot */
int l_aaf; /* aa fire */
- u_char l_fuelc; /* fuel capacity */
- u_char l_fuelu; /* fuel used per 10 mob */
- u_char l_nxlight; /* maximum number of xlight planes */
- u_char l_nland; /* maximum number of units */
+ unsigned char l_fuelc; /* fuel capacity */
+ unsigned char l_fuelu; /* fuel used per 10 mob */
+ unsigned char l_nxlight; /* maximum number of xlight planes */
+ unsigned char l_nland; /* maximum number of units */
signed char l_type; /* index in lchr[] */
long l_flags; /* what special things can this unit do */
};
#define MIN(a,b) ((a) < (b) ? (a) : (b))
#if defined(_WIN32)
-typedef unsigned char u_char;
-typedef unsigned short u_short;
-typedef unsigned int u_int;
typedef long ssize_t;
/* integral mismatch, due to misuse of sector short */
#define RESOLVE_IPADDRESS /* resolve ip addresses into hostnames */
#endif
-typedef u_char natid; /* NSC_NATID must match this */
+typedef unsigned char natid; /* NSC_NATID must match this */
/*
* TODO s_char has to go. Use plain char for characters and strings,
coord nat_xorg, nat_yorg; /* origin location in abs coords */
s_char nat_dayno; /* day of the year mod 128 */
s_char nat_update; /* Want an update or not. */
- u_char nat_missed; /* How many updates missed */
- u_short nat_tgms; /* # of telegrams to be announced */
- u_short nat_ann; /* # of annos pending */
- u_short nat_minused; /* number of minutes used today */
+ unsigned char nat_missed; /* How many updates missed */
+ unsigned short nat_tgms; /* # of telegrams to be announced */
+ unsigned short nat_ann; /* # of annos pending */
+ unsigned short nat_minused; /* number of minutes used today */
short nat_btu; /* bureaucratic time units */
long nat_reserve; /* military reserves */
long nat_money; /* moola */
short pln_mission; /* mission code */
short pln_radius; /* mission radius */
/* end of part matching struct genitem */
- u_char pln_range; /* total distance, not radius */
- u_char pln_range_max; /* max range for this plane */
+ unsigned char pln_range; /* total distance, not radius */
+ unsigned char pln_range_max; /* max range for this plane */
short pln_ship; /* pointer to carrier */
short pln_land; /* pointer to carrier */
int pln_att; /* plane air-air attack/defense values */
struct pchrstr {
int p_uid;
i_type p_ctype[MAXPRCON]; /* constituent types */
- u_short p_camt[MAXPRCON]; /* constituent amounts */
+ unsigned short p_camt[MAXPRCON]; /* constituent amounts */
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 */
extern int roundintby(int, int);
extern int scthash(register int, register int, int);
extern int tcp_listen(char *, char *, size_t *);
-/* plur.c */
extern s_char *numstr(s_char buf[], int n);
+/* plur.c */
extern s_char *esplur(int n);
extern s_char *splur(int n);
extern s_char *iesplur(int n);
extern int sb(natid, natid, struct sctstr *, coord, coord, int, int);
extern int shipdef(natid, natid, coord, coord);
/* getbit.c */
-extern int emp_getbit(int, int, u_char *);
-extern void emp_setbit(int, int, u_char *);
-extern void emp_setbitmap(int, int, u_char *, int *);
-extern void bitinit2(struct nstr_sect *, u_char *, int);
+extern int emp_getbit(int, int, unsigned char *);
+extern void emp_setbit(int, int, unsigned char *);
+extern void emp_setbitmap(int, int, unsigned char *, int *);
+extern void bitinit2(struct nstr_sect *, unsigned char *, int);
/* getele.c */
extern int getele(char *, char *);
/* land.c */
coord sct_x; /* x coord of sector */
coord sct_y; /* y coord of sector */
/* end of part matching struct genitem */
- u_char sct_type; /* sector type */
- u_char sct_effic; /* 0% to 100% */
+ unsigned char sct_type; /* sector type */
+ unsigned char sct_effic; /* 0% to 100% */
short sct_mobil; /* mobility units */
- u_char sct_loyal; /* updates until civilans "converted" */
- u_char sct_terr; /* territory 0 id # of sector */
- u_char sct_terr1; /* territory 1 id # of sector */
- u_char sct_terr2; /* territory 2 id # of sector */
- u_char sct_terr3; /* territory 3 id # of sector */
+ 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 */
coord sct_dist_x; /* Dist sector */
coord sct_dist_y;
short sct_avail; /* available workforce for "other things" */
short sct_flags; /* temporary flags */
short sct_fill; /* gunk */
- u_char sct_work; /* pct of civ actually working */
- u_char sct_coastal; /* is this a coastal sector? */
- u_char sct_newtype; /* for changing designations */
- u_char sct_min; /* ease of mining ore */
- u_char sct_gmin; /* amount of gold ore */
- u_char sct_fertil; /* fertility of soil */
- u_char sct_oil; /* oil content */
- u_char sct_uran; /* uranium ore content */
+ unsigned char sct_work; /* pct of civ actually working */
+ unsigned char sct_coastal; /* is this a coastal sector? */
+ unsigned char sct_newtype; /* for changing designations */
+ unsigned char sct_min; /* ease of mining ore */
+ unsigned char sct_gmin; /* amount of gold ore */
+ unsigned char sct_fertil; /* fertility of soil */
+ unsigned char sct_oil; /* oil content */
+ unsigned char sct_uran; /* uranium ore content */
natid sct_oldown; /* old owner of sector (for liberation) */
- u_char sct_updated; /* Has this sect been updated? */
- u_char sct_off; /* Should this sector produce? */
+ unsigned char sct_updated; /* Has this sect been updated? */
+ unsigned char sct_off; /* Should this sector produce? */
short sct_item[I_MAX+1]; /* amount of items stored here */
short sct_del[I_MAX+1]; /* delivieries */
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 */
- u_char sct_che; /* number of guerrillas */
+ unsigned char sct_che; /* number of guerrillas */
natid sct_che_target; /* nation targeted by che */
- u_short sct_fallout;
+ unsigned short sct_fallout;
time_t sct_access; /* Last time mob was updated (MOB_ACCESS) */
- u_char sct_road; /* Road value of a sector */
- u_char sct_rail; /* Rail value of a sector */
- u_char sct_defense; /* Defensive value of a sector */
+ unsigned char sct_road; /* Road value of a sector */
+ unsigned char sct_rail; /* Rail value of a sector */
+ unsigned char sct_defense; /* Defensive value of a sector */
time_t sct_timestamp; /* Last time this sector was written to */
};
char d_mnem; /* map symbol */
int d_prd; /* product type */
int d_mcst; /* movement cost */
- d_navigation d_nav; /* navigation capability */
+ d_navigation d_nav; /* navigation capability */
i_packing d_pkg; /* type of packaging in these sects */
float d_ostr; /* offensive strength */
float d_dstr; /* defensive strength */
/* Each cost is per point of efficency */
struct sctintrins {
char *in_name;
- u_char in_lcms;
- u_char in_hcms;
- u_char in_dcost;
- u_char in_mcost;
+ unsigned char in_lcms;
+ unsigned char in_hcms;
+ unsigned char in_dcost;
+ unsigned char in_mcost;
};
extern struct sctintrins intrchr[INT_DEF + 2];
short shp_mission; /* mission code */
short shp_radius; /* mission radius */
/* end of part matching struct genitem */
- u_char shp_nplane; /* number of planes on board */
- u_char shp_nland; /* number of land units on board */
+ unsigned char shp_nplane; /* number of planes on board */
+ unsigned char shp_nland; /* number of land units on board */
short shp_armor;
short shp_speed;
short shp_visib;
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 */
+ unsigned char shp_autonav; /* autonavigation flags */
short shp_item[I_MAX+1]; /* amount of items on board */
short shp_pstage; /* plague stage */
short shp_ptime; /* how many etus remain in this stage */
time_t shp_access; /* Last time mob was updated (MOB_ACCESS) */
time_t shp_timestamp; /* Last time this ship was touched. */
- u_char shp_mobquota; /* mobility quota */
+ unsigned char shp_mobquota; /* mobility quota */
char shp_path[MAXSHPPATH];
short shp_follow;
char shp_name[MAXSHPNAMLEN]; /* name set with the "name" command */
- u_char shp_fuel; /* How much fuel do we have */
- u_char shp_nchoppers; /* How many choppers on board? */
- u_char shp_nxlight; /* How many xlight planes on board? */
+ unsigned char shp_fuel; /* How much fuel do we have */
+ unsigned char shp_nchoppers; /* How many choppers on board? */
+ unsigned char shp_nxlight; /* How many xlight planes on board? */
coord shp_orig_x;
coord shp_orig_y; /* Where we were built */
natid shp_orig_own; /* Who built us */
int m_vrnge; /* how well it can see */
int m_frnge; /* how far it can fire */
int m_glim; /* how many guns it can fire */
- u_char m_nxlight; /* maximum number of xlight planes */
- u_char m_nchoppers; /* maximum number of choppers */
- u_char m_fuelc; /* fuel capacity */
- u_char m_fuelu; /* fuel used per 10 mob */
+ unsigned char m_nxlight; /* maximum number of xlight planes */
+ unsigned char m_nchoppers; /* maximum number of choppers */
+ unsigned char m_fuelc; /* fuel capacity */
+ unsigned char m_fuelu; /* fuel used per 10 mob */
char *m_name; /* full name of type of ship */
int m_tech; /* tech required to build */
int m_cost; /* how much it costs to build */
long m_flags; /* what special things can this ship do */
- u_char m_nplanes; /* maximum number of planes this ship holds */
- u_char m_nland; /* maximum number of units this ship holds */
+ unsigned char m_nplanes; /* maximum number of planes this ship holds */
+ unsigned char m_nland; /* maximum number of units this ship holds */
signed char m_type; /* index in mchr[] */
};
case 'e':
new = errcheck(arg, 0, 100);
noise(sect, 1, "Efficiency", (int)sect->sct_effic, new);
- sect->sct_effic = (u_char)new;
+ sect->sct_effic = (unsigned char)new;
break;
case 'm':
new = errcheck(arg, -127, 255);
case 'i':
new = errcheck(arg, 0, 127);
noise(sect, 1, "Iron ore content", (int)sect->sct_min, new);
- sect->sct_min = (u_char)new;
+ sect->sct_min = (unsigned char)new;
break;
case 'g':
new = errcheck(arg, 0, 127);
noise(sect, 1, "Gold content", (int)sect->sct_gmin, new);
- sect->sct_gmin = (u_char)new;
+ sect->sct_gmin = (unsigned char)new;
break;
case 'f':
new = errcheck(arg, 0, 127);
noise(sect, 1, "Fertility", (int)sect->sct_fertil, new);
- sect->sct_fertil = (u_char)new;
+ sect->sct_fertil = (unsigned char)new;
break;
case 'c':
new = errcheck(arg, 0, 127);
noise(sect, 1, "Oil content", (int)sect->sct_oil, new);
- sect->sct_oil = (u_char)new;
+ sect->sct_oil = (unsigned char)new;
break;
case 'u':
new = errcheck(arg, 0, 127);
noise(sect, 1, "Uranium content", (int)sect->sct_uran, new);
- sect->sct_uran = (u_char)new;
+ sect->sct_uran = (unsigned char)new;
break;
case 'w':
new = errcheck(arg, 0, 100);
noise(sect, 1, "Workforce percentage", (int)sect->sct_work, new);
- sect->sct_work = (u_char)new;
+ sect->sct_work = (unsigned char)new;
break;
case 'l':
new = errcheck(arg, 0, 127);
pr("Loyalty of %s changed from %d to %d%%\n",
xyas(sect->sct_x, sect->sct_y, player->cnum),
sect->sct_loyal, new);
- sect->sct_loyal = (u_char)new;
+ sect->sct_loyal = (unsigned char)new;
break;
case 'x':
old = sect->sct_che;
plane->pln_def = (s_char)arg;
break;
case 'r':
- plane->pln_range = (u_char)arg;
+ plane->pln_range = (unsigned char)arg;
break;
case 's':
plane->pln_ship = arg;
int x, y;
int civ;
int mil;
- u_char *bitmap;
+ unsigned char *bitmap;
int changed = 0;
if (!snxtitem(&ni, EF_SHIP, player->argp[1]))
int x, y;
int civ;
int mil;
- u_char *bitmap;
+ unsigned char *bitmap;
int changed = 0;
if (!snxtitem(&ni, EF_LAND, player->argp[1]))
continue;
if (item.sect.sct_type != SCT_FORTR)
continue;
- if (item.sect.sct_effic < ((u_char)FORTEFF)) {
+ if (item.sect.sct_effic < FORTEFF) {
pr("Fort not efficient enough to fire!\n");
continue;
}
int i;
/* Note this is not re-entrant anyway, so we keep the buffers
around */
- static u_char *bitmap = NULL;
+ static unsigned char *bitmap = NULL;
static s_char *wmapbuf = NULL;
static s_char **wmap = NULL;
s_char what[64];
int used; /* production w/infinite workforce */
i_type it;
i_type vtype;
- u_char *resource;
+ unsigned char *resource;
s_char maxc[MAXPRCON][10];
s_char use[MAXPRCON][10];
int lcms, hcms;
int type;
int eff;
int maxpop;
- u_char otype;
+ int otype;
if (!snxtsct(&nstr, player->argp[1]))
return RET_SYN;
goto is_enlist;
if (pp->p_nrndx != 0) {
unit_work++;
- resource = (u_char *)§ + pp->p_nrndx;
+ resource = (unsigned char *)§ + pp->p_nrndx;
p_e = (*resource * p_e) / 100.0;
}
/*
if (sect.sct_own != 0)
resnoise(§, 1, "Iron ore content",
(int)sect.sct_min, amt);
- sect.sct_min = (u_char)amt;
+ sect.sct_min = (unsigned char)amt;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Gold content",
(int)sect.sct_gmin, amt);
- sect.sct_gmin = (u_char)amt;
+ sect.sct_gmin = (unsigned char)amt;
putsect(§);
}
break;
amt = 0;
if (sect.sct_own != 0)
resnoise(§, 1, "Oil content", (int)sect.sct_oil, amt);
- sect.sct_oil = (u_char)amt;
+ sect.sct_oil = (unsigned char)amt;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Fertility content",
(int)sect.sct_fertil, amt);
- sect.sct_fertil = (u_char)amt;
+ sect.sct_fertil = (unsigned char)amt;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Uranium content",
(int)sect.sct_uran, amt);
- sect.sct_uran = (u_char)amt;
+ sect.sct_uran = (unsigned char)amt;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Iron ore content",
(int)sect.sct_min, current);
- sect.sct_min = (u_char)current;
+ sect.sct_min = (unsigned char)current;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Gold content",
(int)sect.sct_gmin, current);
- sect.sct_gmin = (u_char)current;
+ sect.sct_gmin = (unsigned char)current;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Oil content",
(int)sect.sct_oil, current);
- sect.sct_oil = (u_char)current;
+ sect.sct_oil = (unsigned char)current;
putsect(§);
}
break;
current = 100;
pr("Efficiency in %s changed to %d.\n",
xyas(sect.sct_x, sect.sct_y, player->cnum), current);
- sect.sct_effic = (u_char)current;
+ sect.sct_effic = (unsigned char)current;
putsect(§);
}
break;
current = 100;
pr("Work in %s changed to %d.\n",
xyas(sect.sct_x, sect.sct_y, player->cnum), current);
- sect.sct_work = (u_char)current;
+ sect.sct_work = (unsigned char)current;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Fertility content",
(int)sect.sct_fertil, current);
- sect.sct_fertil = (u_char)current;
+ sect.sct_fertil = (unsigned char)current;
putsect(§);
}
break;
if (sect.sct_own != 0)
resnoise(§, 1, "Uranium content",
(int)sect.sct_uran, current);
- sect.sct_uran = (u_char)current;
+ sect.sct_uran = (unsigned char)current;
putsect(§);
}
break;
#include "optlist.h"
static int bmnxtsct(struct nstr_sect *);
-static s_char map_char(u_char type, natid own, int owner_or_god);
+static s_char map_char(unsigned char type, natid own, int owner_or_god);
int
draw_map(int bmap, s_char origin, int map_flags, struct nstr_sect *nsp)
int i;
/* Note this is not re-entrant anyway, so we keep the buffers
around */
- static u_char *bitmap = NULL;
+ static unsigned char *bitmap = NULL;
static s_char *wmapbuf = NULL;
static s_char **wmap = NULL;
* If OWNER_OR_GOD, the map is for the sector's owner or a deity.
*/
static s_char
-map_char(u_char type, natid own, int owner_or_god)
+map_char(unsigned char type, natid own, int owner_or_god)
{
if (type > SCT_MAXDEF) {
logerror("bad sector type %d\n", type);
#define fldoff(str, fld) offsetof(struct str, fld)
-#define NSC_IELT(name, pfx, sfx, base, itype) \
-{NSC_SHORT, 0, 0, ((base) + (itype)*sizeof(u_short)), \
+#define NSC_IELT(name, pfx, sfx, base, itype) \
+{NSC_SHORT, 0, 0, ((base) + (itype)*sizeof(unsigned short)), \
sizeof(sfx) == 1 ? name : pfx sfx, EF_BAD}
#define NSC_IVEC(base, sfx) \
#define GCFy(y) ((y + WORLD_Y) % WORLD_Y)
int
-emp_getbit(int x, int y, u_char *bitmap)
+emp_getbit(int x, int y, unsigned char *bitmap)
{
int id;
}
void
-emp_setbit(int x, int y, u_char *bitmap)
+emp_setbit(int x, int y, unsigned char *bitmap)
{
register int id;
}
void
-emp_setbitmap(register int x, register int y, register u_char *bitmap,
- int *bitmaps)
+emp_setbitmap(int x, int y, unsigned char *bitmap, int *bitmaps)
{
register int *mp;
register int id;
}
void
-bitinit2(struct nstr_sect *np, u_char *bitmap, int country)
+bitinit2(struct nstr_sect *np, unsigned char *bitmap, int country)
{
struct sctstr sect;
int eff;
struct pchrstr *product;
double p_e;
double prodeff;
- u_char *resource;
+ unsigned char *resource;
double output;
int actual;
int unit_work;
p_e = neweff / 100.0;
if (product->p_nrndx != 0) {
unit_work++;
- resource = (u_char *)sp + product->p_nrndx;
+ resource = (unsigned char *)sp + product->p_nrndx;
p_e = (*resource * p_e) / 100.0;
}
/*
int work_cost = 0;
int buildeff_work = *workp / 2;
int n, hcms, lcms, neweff;
- u_char old_type = *desig;
+ unsigned char old_type = *desig;
*cost = 0;
neweff = sp->sct_effic;
int max_oil;
int max_food;
struct pchrstr *product;
- u_char *resource;
+ unsigned char *resource;
int dep;
int n;
int mult;
if (sp->shp_item[I_OIL] + oil_gained > max_oil)
oil_gained = max_oil - sp->shp_item[I_OIL];
if (product->p_nrdep != 0 && oil_gained > 0) {
- resource = (u_char *)sectp + product->p_nrndx;
+ resource = (unsigned char *)sectp + product->p_nrndx;
if (*resource * 100 < product->p_nrdep * oil_gained)
oil_gained = *resource * 100 / product->p_nrdep;
dep = roundavg(oil_gained * product->p_nrdep / 100.0);
# indent needs to know type names do to a proper job.
# Type names located with grep typedef, then extracted by hand:
-types="coord empth_sem_t empth_t i_packing i_type loc_Sem_t loc_Thread_t natid ns_seltype nsc_cat nsc_flags nsc_type packed_nsc_cat packed_nsc_type s_char stkalign_t u_char u_int u_short"
+types="coord empth_sem_t empth_t i_packing i_type loc_Sem_t loc_Thread_t natid ns_seltype nsc_cat nsc_flags nsc_type packed_nsc_cat packed_nsc_type s_char stkalign_t"
opts="-kr -cdw -cp8 -ncs -psl -ss"
for t in $types