Coding style fixes, mostly indentation and whitespace
This commit is contained in:
parent
8a0d117d45
commit
373651359e
47 changed files with 131 additions and 130 deletions
|
@ -192,7 +192,7 @@ extern int lnd_hardtarget(struct lndstr *);
|
||||||
extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);
|
extern int lnd_mar_one_sector(struct emp_qelem *, int, natid, int);
|
||||||
extern int lnd_support(natid, natid, coord, coord, int);
|
extern int lnd_support(natid, natid, coord, coord, int);
|
||||||
extern int lnd_can_attack(struct lndstr *);
|
extern int lnd_can_attack(struct lndstr *);
|
||||||
extern int lnd_fortify (struct lndstr *lp, int hard_amt);
|
extern int lnd_fortify(struct lndstr *lp, int hard_amt);
|
||||||
extern void lnd_set_tech(struct lndstr *, int);
|
extern void lnd_set_tech(struct lndstr *, int);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -47,7 +47,7 @@ struct loststr {
|
||||||
natid lost_owner; /* Who lost it */
|
natid lost_owner; /* Who lost it */
|
||||||
/* end of part matching struct empobj */
|
/* end of part matching struct empobj */
|
||||||
short lost_type; /* Type of thing (ship, plane, nuke, land, sector) */
|
short lost_type; /* Type of thing (ship, plane, nuke, land, sector) */
|
||||||
int lost_id; /* uid of lost thing (0 for sector)*/
|
int lost_id; /* uid of lost thing (0 for sector) */
|
||||||
coord lost_x;
|
coord lost_x;
|
||||||
coord lost_y;
|
coord lost_y;
|
||||||
};
|
};
|
||||||
|
|
|
@ -61,17 +61,17 @@ struct lwpProc *lwpCreate(int prio, void (*)(void *), int size,
|
||||||
int flags, char *name,
|
int flags, char *name,
|
||||||
int argc, char **argv, void *ud);
|
int argc, char **argv, void *ud);
|
||||||
void lwpExit(void);
|
void lwpExit(void);
|
||||||
void lwpTerminate(struct lwpProc * p);
|
void lwpTerminate(struct lwpProc *);
|
||||||
void lwpYield(void);
|
void lwpYield(void);
|
||||||
int lwpSleepFd(int fd, int flags, struct timeval *timeout);
|
int lwpSleepFd(int fd, int flags, struct timeval *timeout);
|
||||||
int lwpSleepUntil(time_t until);
|
int lwpSleepUntil(time_t until);
|
||||||
void lwpWakeup(struct lwpProc *);
|
void lwpWakeup(struct lwpProc *);
|
||||||
int lwpSigWait(sigset_t *set, int *sig);
|
int lwpSigWait(sigset_t *set, int *sig);
|
||||||
void *lwpGetUD(struct lwpProc * p);
|
void *lwpGetUD(struct lwpProc *);
|
||||||
void lwpSetUD(struct lwpProc * p, char *ud);
|
void lwpSetUD(struct lwpProc *, char *ud);
|
||||||
int lwpSetPriority(int prio);
|
int lwpSetPriority(int prio);
|
||||||
char *lwpName(struct lwpProc * p);
|
char *lwpName(struct lwpProc *);
|
||||||
void lwpSetName(struct lwpProc * p, char *name);
|
void lwpSetName(struct lwpProc *, char *name);
|
||||||
|
|
||||||
struct lwp_rwlock *lwp_rwlock_create(char *);
|
struct lwp_rwlock *lwp_rwlock_create(char *);
|
||||||
void lwp_rwlock_destroy(struct lwp_rwlock *);
|
void lwp_rwlock_destroy(struct lwp_rwlock *);
|
||||||
|
|
|
@ -183,7 +183,7 @@ extern int influx(struct natstr *np);
|
||||||
extern struct natstr *nat_reset(struct natstr *, enum nat_status, coord, coord);
|
extern struct natstr *nat_reset(struct natstr *, enum nat_status, coord, coord);
|
||||||
extern int check_nat_name(char *cname);
|
extern int check_nat_name(char *cname);
|
||||||
|
|
||||||
extern int grant_btus(struct natstr *, int );
|
extern int grant_btus(struct natstr *, int);
|
||||||
|
|
||||||
/* nation flags */
|
/* nation flags */
|
||||||
#define NF_INFORM bit(0) /* Inform me of telegrams right away */
|
#define NF_INFORM bit(0) /* Inform me of telegrams right away */
|
||||||
|
|
|
@ -286,7 +286,7 @@ extern struct symbol sector_navigation[];
|
||||||
|
|
||||||
/* src/lib/subs/nstr.c */
|
/* src/lib/subs/nstr.c */
|
||||||
extern int nstr_comp(struct nscstr *np, int len, int type, char *str);
|
extern int nstr_comp(struct nscstr *np, int len, int type, char *str);
|
||||||
extern char *nstr_comp_val(char *, struct valstr*, int);
|
extern char *nstr_comp_val(char *, struct valstr *, int);
|
||||||
extern int nstr_exec(struct nscstr *, int, void *);
|
extern int nstr_exec(struct nscstr *, int, void *);
|
||||||
/* src/lib/common/nstreval.c */
|
/* src/lib/common/nstreval.c */
|
||||||
extern struct valstr *nstr_mksymval(struct valstr *, struct castr *, int);
|
extern struct valstr *nstr_mksymval(struct valstr *, struct castr *, int);
|
||||||
|
|
|
@ -112,7 +112,7 @@ servercmd(int code, char *arg, int len)
|
||||||
break;
|
break;
|
||||||
case C_INFORM:
|
case C_INFORM:
|
||||||
if (arg[0] != '\n') {
|
if (arg[0] != '\n') {
|
||||||
snprintf(teles, sizeof(teles), "(%.*s) ", len -1, arg);
|
snprintf(teles, sizeof(teles), "(%.*s) ", len - 1, arg);
|
||||||
if (!redir_fp) {
|
if (!redir_fp) {
|
||||||
putchar('\07');
|
putchar('\07');
|
||||||
prompt(code, the_prompt, teles);
|
prompt(code, the_prompt, teles);
|
||||||
|
|
|
@ -386,7 +386,7 @@ pr_ship(struct shpstr *ship)
|
||||||
pr("Fleet <F>: %.1s\n", &ship->shp_fleet);
|
pr("Fleet <F>: %.1s\n", &ship->shp_fleet);
|
||||||
pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
|
pr("Retreat path <R>: '%s'\t\tRetreat Flags <W>: %d\n",
|
||||||
ship->shp_rpath, ship->shp_rflags);
|
ship->shp_rpath, ship->shp_rflags);
|
||||||
pr("Plague Stage <a>: %d\t\t",ship->shp_pstage);
|
pr("Plague Stage <a>: %d\t\t", ship->shp_pstage);
|
||||||
pr("Plague Time <b>: %d\n", ship->shp_ptime);
|
pr("Plague Time <b>: %d\n", ship->shp_ptime);
|
||||||
pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
|
pr("civ mil uw food shl gun pet irn dst oil lcm hcm rad\n");
|
||||||
pr(" c m u f s g p i d o l h r\n");
|
pr(" c m u f s g p i d o l h r\n");
|
||||||
|
|
|
@ -82,7 +82,7 @@ fort(void)
|
||||||
if (hard_amt <= 0)
|
if (hard_amt <= 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (lnd_fortify (&land, hard_amt) <= 0) {
|
if (lnd_fortify(&land, hard_amt) <= 0) {
|
||||||
pr("%s can't be fortified%s\n", prland(&land),
|
pr("%s can't be fortified%s\n", prland(&land),
|
||||||
land.lnd_harden >= land_mob_max ? " any further" : "");
|
land.lnd_harden >= land_mob_max ? " any further" : "");
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -412,7 +412,7 @@ apro(void)
|
||||||
lhitlim = 100;
|
lhitlim = 100;
|
||||||
}
|
}
|
||||||
|
|
||||||
snprintf(filename, sizeof(filename), "%s\\*",infodir);
|
snprintf(filename, sizeof(filename), "%s\\*", infodir);
|
||||||
hDir = FindFirstFile(filename, &fData);
|
hDir = FindFirstFile(filename, &fData);
|
||||||
if (hDir == INVALID_HANDLE_VALUE) {
|
if (hDir == INVALID_HANDLE_VALUE) {
|
||||||
if (GetLastError() == ERROR_PATH_NOT_FOUND) {
|
if (GetLastError() == ERROR_PATH_NOT_FOUND) {
|
||||||
|
|
|
@ -109,7 +109,7 @@ landmine(void)
|
||||||
continue;
|
continue;
|
||||||
if (land.lnd_ship >= 0 || land.lnd_land >= 0) {
|
if (land.lnd_ship >= 0 || land.lnd_land >= 0) {
|
||||||
pr("%s is on a %s\n", prland(&land),
|
pr("%s is on a %s\n", prland(&land),
|
||||||
land. lnd_ship >= 0 ? "ship" : "land unit");
|
land.lnd_ship >= 0 ? "ship" : "land unit");
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (land.lnd_mobil < 1) {
|
if (land.lnd_mobil < 1) {
|
||||||
|
|
|
@ -125,8 +125,8 @@ do_unit_move(struct emp_qelem *ulist, int *together,
|
||||||
}
|
}
|
||||||
if (!skip)
|
if (!skip)
|
||||||
nav_map(leader->x, leader->y,
|
nav_map(leader->x, leader->y,
|
||||||
type == EF_SHIP ?
|
type == EF_SHIP
|
||||||
!(mchr[(int)leader->type].m_flags & M_SUB) : 1);
|
? !(mchr[(int)leader->type].m_flags & M_SUB) : 1);
|
||||||
else
|
else
|
||||||
skip = 0;
|
skip = 0;
|
||||||
sprintf(prompt, "<%.1f:%.1f: %s> ", *maxmob,
|
sprintf(prompt, "<%.1f:%.1f: %s> ", *maxmob,
|
||||||
|
|
|
@ -58,7 +58,7 @@ swaps(void)
|
||||||
!getsect(sectb.sct_x, sectb.sct_y, §b))
|
!getsect(sectb.sct_x, sectb.sct_y, §b))
|
||||||
return RET_SYN;
|
return RET_SYN;
|
||||||
print_res(§b);
|
print_res(§b);
|
||||||
if (!confirm ("Are you sure these are the two sectors you wish to swap? "))
|
if (!confirm("Are you sure these are the two sectors you wish to swap? "))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
if (!check_sect_ok(§a) || !check_sect_ok(§b))
|
if (!check_sect_ok(§a) || !check_sect_ok(§b))
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
|
|
|
@ -255,4 +255,3 @@ tran_nmap(coord curx, coord cury, char *arg)
|
||||||
{
|
{
|
||||||
return display_region_map(0, EF_NUKE, curx, cury, arg);
|
return display_region_map(0, EF_NUKE, curx, cury, arg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ vers(void)
|
||||||
pr("Fallout decays by %.0f%% per update\n",
|
pr("Fallout decays by %.0f%% per update\n",
|
||||||
100.0 - (decay_per_etu + 6.0) * fallout_spread * MIN(24, etu_per_update) * 100.0);
|
100.0 - (decay_per_etu + 6.0) * fallout_spread * MIN(24, etu_per_update) * 100.0);
|
||||||
pr("\n");
|
pr("\n");
|
||||||
pr ("Damage to\t\t\tSpills to\n");
|
pr("Damage to\t\t\tSpills to\n");
|
||||||
pr("\t Sector People Mater. Ships Planes LandU.\n");
|
pr("\t Sector People Mater. Ships Planes LandU.\n");
|
||||||
pr("Sector\t\t --\t%3.0f%%\t100%%\t 0%%\t%3.0f%%\t%3.0f%%\n",
|
pr("Sector\t\t --\t%3.0f%%\t100%%\t 0%%\t%3.0f%%\t%3.0f%%\n",
|
||||||
people_damage * 100.0, unit_damage / 0.07, unit_damage * 100.0);
|
people_damage * 100.0, unit_damage / 0.07, unit_damage * 100.0);
|
||||||
|
|
|
@ -117,7 +117,8 @@ weekday(char *str, int *wday)
|
||||||
*/
|
*/
|
||||||
static char *day_name[7] = {
|
static char *day_name[7] = {
|
||||||
"sunday", "monday", "tuesday", "wednesday",
|
"sunday", "monday", "tuesday", "wednesday",
|
||||||
"thursday", "friday", "saturday" };
|
"thursday", "friday", "saturday"
|
||||||
|
};
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (; isspace(*str); ++str) ;
|
for (; isspace(*str); ++str) ;
|
||||||
|
|
|
@ -84,7 +84,9 @@ mineq(char *a, char *b)
|
||||||
/* find common prefix: */
|
/* find common prefix: */
|
||||||
for (i = 0; a[i] != 0 && a[i] == b[i]; i++) ;
|
for (i = 0; a[i] != 0 && a[i] == b[i]; i++) ;
|
||||||
|
|
||||||
if (a[i] != 0) return ME_MISMATCH;
|
if (a[i] != 0)
|
||||||
if (b[i] == 0 || b[i] == ' ') return ME_EXACT;
|
return ME_MISMATCH;
|
||||||
|
if (b[i] == 0 || b[i] == ' ')
|
||||||
|
return ME_EXACT;
|
||||||
return ME_PARTIAL;
|
return ME_PARTIAL;
|
||||||
}
|
}
|
||||||
|
|
|
@ -288,7 +288,7 @@ xdcolhdr(struct xdstr *xd, struct castr ca[])
|
||||||
n = ca[i].ca_type != NSC_STRINGY ? ca[i].ca_len : 0;
|
n = ca[i].ca_type != NSC_STRINGY ? ca[i].ca_len : 0;
|
||||||
if (n) {
|
if (n) {
|
||||||
for (j = 0; j < n; j++) {
|
for (j = 0; j < n; j++) {
|
||||||
xd->pr("%s%s(%d)",sep, ca[i].ca_name, j);
|
xd->pr("%s%s(%d)", sep, ca[i].ca_name, j);
|
||||||
sep = " ";
|
sep = " ";
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -64,5 +64,5 @@ signed char dirindex[] = {
|
||||||
|
|
||||||
/* must agree with dirch[] and DIR_ defines */
|
/* must agree with dirch[] and DIR_ defines */
|
||||||
char *routech[] = {
|
char *routech[] = {
|
||||||
" ", " /", " >"," \\","/ ","< ","\\ "
|
" ", " /", " >", " \\", "/ ", "< ", "\\ "
|
||||||
};
|
};
|
||||||
|
|
|
@ -101,7 +101,7 @@ struct symbol meta_type[] = {
|
||||||
{NSC_HIDDEN, "d"},
|
{NSC_HIDDEN, "d"},
|
||||||
{NSC_TIME, "d"},
|
{NSC_TIME, "d"},
|
||||||
{NSC_FLOAT, "g"},
|
{NSC_FLOAT, "g"},
|
||||||
{NSC_STRINGY,"c"},
|
{NSC_STRINGY, "c"},
|
||||||
{NSC_NOTYPE, NULL}
|
{NSC_NOTYPE, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -79,7 +79,7 @@ player_new(int s)
|
||||||
return NULL;
|
return NULL;
|
||||||
memset(lp, 0, sizeof(struct player));
|
memset(lp, 0, sizeof(struct player));
|
||||||
idle_timeout.tv_sec = max_idle * 60;
|
idle_timeout.tv_sec = max_idle * 60;
|
||||||
idle_timeout.tv_usec = 0 ;
|
idle_timeout.tv_usec = 0;
|
||||||
if (s >= 0) {
|
if (s >= 0) {
|
||||||
/* real player, not dummy created by update and market update */
|
/* real player, not dummy created by update and market update */
|
||||||
lp->iop = io_open(s, IO_READ | IO_WRITE, IO_BUFSIZE, idle_timeout);
|
lp->iop = io_open(s, IO_READ | IO_WRITE, IO_BUFSIZE, idle_timeout);
|
||||||
|
|
|
@ -101,7 +101,7 @@ struct cmndstr player_coms[] = {
|
||||||
0, edit, C_MOD, GOD},
|
0, edit, C_MOD, GOD},
|
||||||
{"enable", 0, enab, C_MOD, GOD},
|
{"enable", 0, enab, C_MOD, GOD},
|
||||||
{"enlist <SECTS> <NUM>", 2, enli, C_MOD, NORM + MONEY + CAP},
|
{"enlist <SECTS> <NUM>", 2, enli, C_MOD, NORM + MONEY + CAP},
|
||||||
{"execute <INPUT FILE>", 0, execute, 0, VIS + EXEC },
|
{"execute <INPUT FILE>", 0, execute, 0, VIS + EXEC},
|
||||||
{"explore <c|m> <SECT> <NUM> <PATH|DESTINATION>",
|
{"explore <c|m> <SECT> <NUM> <PATH|DESTINATION>",
|
||||||
1, explore, C_MOD, NORM + MONEY + CAP},
|
1, explore, C_MOD, NORM + MONEY + CAP},
|
||||||
{"financial", 0, fina, 0, NORM},
|
{"financial", 0, fina, 0, NORM},
|
||||||
|
|
|
@ -199,8 +199,10 @@ static int
|
||||||
strnncmp(char *s1, size_t sz1, char *s2, size_t sz2)
|
strnncmp(char *s1, size_t sz1, char *s2, size_t sz2)
|
||||||
{
|
{
|
||||||
int res;
|
int res;
|
||||||
if (sz1 == sz2) return strncmp(s1, s2, sz2);
|
if (sz1 == sz2)
|
||||||
if (sz1 < sz2) return -strnncmp(s2, sz2, s1, sz1);
|
return strncmp(s1, s2, sz2);
|
||||||
|
if (sz1 < sz2)
|
||||||
|
return -strnncmp(s2, sz2, s1, sz1);
|
||||||
res = strncmp(s1, s2, sz2);
|
res = strncmp(s1, s2, sz2);
|
||||||
return res ? res : s1[sz2];
|
return res ? res : s1[sz2];
|
||||||
}
|
}
|
||||||
|
@ -278,7 +280,8 @@ nstr_parse_val(char *str, struct valstr *val)
|
||||||
val->val_cat = NSC_VAL;
|
val->val_cat = NSC_VAL;
|
||||||
val->val_as.str.base = str + 1;
|
val->val_as.str.base = str + 1;
|
||||||
val->val_as.str.maxsz = tail - (str + 1);
|
val->val_as.str.maxsz = tail - (str + 1);
|
||||||
if (*tail) ++tail;
|
if (*tail)
|
||||||
|
++tail;
|
||||||
/* FIXME else unclosed string */
|
/* FIXME else unclosed string */
|
||||||
return tail;
|
return tail;
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,7 +110,7 @@ getpath(char *buf, char *arg, coord x, coord y, int onlyown,
|
||||||
|
|
||||||
getsect(x, y, §);
|
getsect(x, y, §);
|
||||||
|
|
||||||
more:
|
more:
|
||||||
while (*p) {
|
while (*p) {
|
||||||
if (sarg_xy(p, &dx, &dy)) {
|
if (sarg_xy(p, &dx, &dy)) {
|
||||||
bp = NULL;
|
bp = NULL;
|
||||||
|
|
|
@ -619,8 +619,7 @@ ufindpfx(char *s, int n)
|
||||||
{
|
{
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
|
||||||
while (n && s[i])
|
while (n && s[i]) {
|
||||||
{
|
|
||||||
if ((s[i++] & 0xc0) == 0xc0)
|
if ((s[i++] & 0xc0) == 0xc0)
|
||||||
while ((s[i] & 0xc0) == 0x80)
|
while ((s[i] & 0xc0) == 0x80)
|
||||||
i++;
|
i++;
|
||||||
|
|
|
@ -686,7 +686,7 @@ fmttime2822(time_t t)
|
||||||
(time->tm_isdst ? tzi.DaylightBias : tzi.StandardBias));
|
(time->tm_isdst ? tzi.DaylightBias : tzi.StandardBias));
|
||||||
|
|
||||||
nn = _snprintf(buf + n, sizeof(buf) - n, " %+03d%02d",
|
nn = _snprintf(buf + n, sizeof(buf) - n, " %+03d%02d",
|
||||||
time_offset/60, abs(time_offset) % 60);
|
time_offset / 60, abs(time_offset) % 60);
|
||||||
if (CANT_HAPPEN(nn <= 0 || nn + n >= sizeof(buf)))
|
if (CANT_HAPPEN(nn <= 0 || nn + n >= sizeof(buf)))
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -627,8 +627,7 @@ shp_fort_interdiction(struct emp_qelem *list, coord newx, coord newy,
|
||||||
mpr(victim, "Incoming fire does %d damage!\n", dam);
|
mpr(victim, "Incoming fire does %d damage!\n", dam);
|
||||||
#if 0
|
#if 0
|
||||||
mpr(victim, "%s fires at you for %d!\n",
|
mpr(victim, "%s fires at you for %d!\n",
|
||||||
xyas(fsect.sct_x,fsect.sct_y,victim),
|
xyas(fsect.sct_x, fsect.sct_y, victim), dam);
|
||||||
dam);
|
|
||||||
#endif
|
#endif
|
||||||
wu(0, fsect.sct_own,
|
wu(0, fsect.sct_own,
|
||||||
"%s fires at %s ships in %s for %d!\n",
|
"%s fires at %s ships in %s for %d!\n",
|
||||||
|
|
|
@ -346,7 +346,7 @@ guerrilla(struct sctstr *sp)
|
||||||
uw -= n;
|
uw -= n;
|
||||||
sp->sct_item[I_UW] = uw;
|
sp->sct_item[I_UW] = uw;
|
||||||
}
|
}
|
||||||
domove:
|
domove:
|
||||||
if (move && che > 0) {
|
if (move && che > 0) {
|
||||||
struct sctstr *nicest_sp = NULL;
|
struct sctstr *nicest_sp = NULL;
|
||||||
if (convert)
|
if (convert)
|
||||||
|
|
|
@ -85,8 +85,7 @@ w32_set_winsock_errno(void)
|
||||||
WSASetLastError(0);
|
WSASetLastError(0);
|
||||||
|
|
||||||
/* Map some WSAE* errors to the runtime library's error codes. */
|
/* Map some WSAE* errors to the runtime library's error codes. */
|
||||||
switch (err)
|
switch (err) {
|
||||||
{
|
|
||||||
case WSA_INVALID_HANDLE:
|
case WSA_INVALID_HANDLE:
|
||||||
errno = EBADF;
|
errno = EBADF;
|
||||||
break;
|
break;
|
||||||
|
@ -284,8 +283,7 @@ fcntl(int fd, int cmd, ...)
|
||||||
unsigned long nonblocking;
|
unsigned long nonblocking;
|
||||||
SOCKET sock;
|
SOCKET sock;
|
||||||
|
|
||||||
switch (cmd)
|
switch (cmd) {
|
||||||
{
|
|
||||||
case F_GETFL:
|
case F_GETFL:
|
||||||
return 0;
|
return 0;
|
||||||
case F_SETFL:
|
case F_SETFL:
|
||||||
|
|
|
@ -1167,7 +1167,7 @@ write_newcap_script(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
qprint(const char * const fmt, ...)
|
qprint(const char *const fmt, ...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue