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
|
@ -49,22 +49,22 @@ enum {
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
I_NONE = -1,
|
I_NONE = -1,
|
||||||
I_CIVIL,
|
I_CIVIL,
|
||||||
I_MILIT,
|
I_MILIT,
|
||||||
I_SHELL,
|
I_SHELL,
|
||||||
I_GUN,
|
I_GUN,
|
||||||
I_PETROL,
|
I_PETROL,
|
||||||
I_IRON,
|
I_IRON,
|
||||||
I_DUST,
|
I_DUST,
|
||||||
I_BAR,
|
I_BAR,
|
||||||
I_FOOD,
|
I_FOOD,
|
||||||
I_OIL,
|
I_OIL,
|
||||||
I_LCM,
|
I_LCM,
|
||||||
I_HCM,
|
I_HCM,
|
||||||
I_UW,
|
I_UW,
|
||||||
I_RAD,
|
I_RAD,
|
||||||
I_MAX = I_RAD
|
I_MAX = I_RAD
|
||||||
} ATTRIBUTE((packed)) i_type;
|
} ATTRIBUTE((packed)) i_type;
|
||||||
|
|
||||||
struct ichrstr {
|
struct ichrstr {
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -85,9 +85,9 @@ cens(void)
|
||||||
n = sect.sct_dist[I_FOOD] % 1000;
|
n = sect.sct_dist[I_FOOD] % 1000;
|
||||||
pr("%c ", n == 0 ? '.' : '0' + (n / 100));
|
pr("%c ", n == 0 ? '.' : '0' + (n / 100));
|
||||||
if (sect.sct_own != sect.sct_oldown)
|
if (sect.sct_own != sect.sct_oldown)
|
||||||
pr("%3d", sect.sct_oldown);
|
pr("%3d", sect.sct_oldown);
|
||||||
else
|
else
|
||||||
pr(" ");
|
pr(" ");
|
||||||
|
|
||||||
pr("%5d", sect.sct_item[I_CIVIL]);
|
pr("%5d", sect.sct_item[I_CIVIL]);
|
||||||
pr("%5d", sect.sct_item[I_MILIT]);
|
pr("%5d", sect.sct_item[I_MILIT]);
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -320,7 +320,7 @@ info(void)
|
||||||
default:
|
default:
|
||||||
pr("Error reading info dir\n");
|
pr("Error reading info dir\n");
|
||||||
logerror("Error (%lu) reading info dir(%s)\\file(%s)",
|
logerror("Error (%lu) reading info dir(%s)\\file(%s)",
|
||||||
GetLastError(), infodir, filename);
|
GetLastError(), infodir, filename);
|
||||||
}
|
}
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -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) {
|
||||||
|
@ -421,7 +421,7 @@ apro(void)
|
||||||
} else {
|
} else {
|
||||||
pr("Error reading info dir\n");
|
pr("Error reading info dir\n");
|
||||||
logerror("Error (%lu) reading info dir(%s)\\file(%s)",
|
logerror("Error (%lu) reading info dir(%s)\\file(%s)",
|
||||||
GetLastError(), infodir, filename);
|
GetLastError(), infodir, filename);
|
||||||
}
|
}
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
|
@ -446,7 +446,7 @@ apro(void)
|
||||||
(fData.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE) ||
|
(fData.dwFileAttributes == FILE_ATTRIBUTE_ARCHIVE) ||
|
||||||
(fData.dwFileAttributes == FILE_ATTRIBUTE_READONLY))) {
|
(fData.dwFileAttributes == FILE_ATTRIBUTE_READONLY))) {
|
||||||
snprintf(filename, sizeof(filename), "%s\\%s", infodir,
|
snprintf(filename, sizeof(filename), "%s\\%s", infodir,
|
||||||
fData.cFileName);
|
fData.cFileName);
|
||||||
fp = fopen(filename, "rb");
|
fp = fopen(filename, "rb");
|
||||||
alreadyhit = 0;
|
alreadyhit = 0;
|
||||||
nll = nlhl = 0;
|
nll = nlhl = 0;
|
||||||
|
|
|
@ -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,
|
||||||
|
@ -171,7 +171,7 @@ do_unit_move(struct emp_qelem *ulist, int *together,
|
||||||
if (dir >= 0) {
|
if (dir >= 0) {
|
||||||
if (type == EF_SHIP) {
|
if (type == EF_SHIP) {
|
||||||
stopping |= shp_nav_one_sector(ulist, dir,
|
stopping |= shp_nav_one_sector(ulist, dir,
|
||||||
player->cnum, *together);
|
player->cnum, *together);
|
||||||
if (stopping != 2) {
|
if (stopping != 2) {
|
||||||
*pt++ = dirch[dir];
|
*pt++ = dirch[dir];
|
||||||
*pt = '\0';
|
*pt = '\0';
|
||||||
|
@ -179,7 +179,7 @@ do_unit_move(struct emp_qelem *ulist, int *together,
|
||||||
} else
|
} else
|
||||||
stopping |=
|
stopping |=
|
||||||
lnd_mar_one_sector(ulist, dir, player->cnum,
|
lnd_mar_one_sector(ulist, dir, player->cnum,
|
||||||
*together);
|
*together);
|
||||||
cp++;
|
cp++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
|
@ -81,8 +81,8 @@ para(void)
|
||||||
pr("range to target is %d\n", ap_to_target);
|
pr("range to target is %d\n", ap_to_target);
|
||||||
if (target.sct_own == player->cnum) {
|
if (target.sct_own == player->cnum) {
|
||||||
pr("You can't air-assault your own sector!\n");
|
pr("You can't air-assault your own sector!\n");
|
||||||
return RET_FAIL;
|
return RET_FAIL;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* select planes within range
|
* select planes within range
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -264,7 +264,7 @@ pdump(void)
|
||||||
case 19:
|
case 19:
|
||||||
pr(pln_is_in_orbit(&plane)
|
pr(pln_is_in_orbit(&plane)
|
||||||
&& (plane.pln_flags & PLN_SYNCHRONOUS)
|
&& (plane.pln_flags & PLN_SYNCHRONOUS)
|
||||||
? " Y" : " N");
|
? " Y" : " N");
|
||||||
break;
|
break;
|
||||||
case 20:
|
case 20:
|
||||||
if (getnuke(nuk_on_plane(&plane), &nuke)) {
|
if (getnuke(nuk_on_plane(&plane), &nuke)) {
|
||||||
|
|
|
@ -102,7 +102,7 @@ radar(int type)
|
||||||
if (mchr[(int)item.ship.shp_type].m_flags & M_SONAR)
|
if (mchr[(int)item.ship.shp_type].m_flags & M_SONAR)
|
||||||
tf = techfact(item.ship.shp_tech, 1.0);
|
tf = techfact(item.ship.shp_tech, 1.0);
|
||||||
tech = techfact(item.ship.shp_tech,
|
tech = techfact(item.ship.shp_tech,
|
||||||
mchr[(int)item.ship.shp_type].m_vrnge);
|
mchr[(int)item.ship.shp_type].m_vrnge);
|
||||||
} else {
|
} else {
|
||||||
if (!(lchr[(int)item.land.lnd_type].l_flags & L_RADAR)) {
|
if (!(lchr[(int)item.land.lnd_type].l_flags & L_RADAR)) {
|
||||||
pr("%s can't use radar!\n", prland(&item.land));
|
pr("%s can't use radar!\n", prland(&item.land));
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -403,7 +403,7 @@ check_trade(void)
|
||||||
"The bidding is over & you bought %s #%d from %s for $%.2f\n",
|
"The bidding is over & you bought %s #%d from %s for $%.2f\n",
|
||||||
trade_nameof(&trade, &tg), saveid, cname(trade.trd_owner),
|
trade_nameof(&trade, &tg), saveid, cname(trade.trd_owner),
|
||||||
price);
|
price);
|
||||||
}
|
}
|
||||||
return RET_OK;
|
return RET_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -40,8 +40,8 @@
|
||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
UPGR_COST = 15, /* how much avail and money to charge */
|
UPGR_COST = 15, /* how much avail and money to charge */
|
||||||
UPGR_EFF = 35 /* efficiency reduction */
|
UPGR_EFF = 35 /* efficiency reduction */
|
||||||
};
|
};
|
||||||
|
|
||||||
static int lupgr(void);
|
static int lupgr(void);
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -81,7 +81,7 @@ zdon(void)
|
||||||
if (*p == 'y' || *p == 'Y') {
|
if (*p == 'y' || *p == 'Y') {
|
||||||
checking = 0;
|
checking = 0;
|
||||||
wantupd = 1;
|
wantupd = 1;
|
||||||
} else if (*p == 'n' || *p == 'N') {
|
} else if (*p == 'n' || *p == 'N') {
|
||||||
checking = 0;
|
checking = 0;
|
||||||
wantupd = 0;
|
wantupd = 0;
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -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) ;
|
||||||
|
|
|
@ -211,21 +211,21 @@ struct castr dchr_ca[] = {
|
||||||
};
|
};
|
||||||
|
|
||||||
#define NSC_GENITEM(ef_type, ef_chr) \
|
#define NSC_GENITEM(ef_type, ef_chr) \
|
||||||
{"uid", empobjoff(uid), NSC_INT, 0, NULL, ef_type, 0}, \
|
{"uid", empobjoff(uid), NSC_INT, 0, NULL, ef_type, 0}, \
|
||||||
{"timestamp", empobjoff(timestamp), NSC_TIME, 0, NULL, EF_BAD, NSC_EXTRA}, \
|
{"timestamp", empobjoff(timestamp), NSC_TIME, 0, NULL, EF_BAD, NSC_EXTRA}, \
|
||||||
{"owner", empobjoff(own), NSC_NATID, 0, NULL, EF_NATION, 0}, \
|
{"owner", empobjoff(own), NSC_NATID, 0, NULL, EF_NATION, 0}, \
|
||||||
{"xloc", empobjoff(x), NSC_XCOORD, 0, NULL, EF_BAD, 0}, \
|
{"xloc", empobjoff(x), NSC_XCOORD, 0, NULL, EF_BAD, 0}, \
|
||||||
{"yloc", empobjoff(y), NSC_YCOORD, 0, NULL, EF_BAD, 0}, \
|
{"yloc", empobjoff(y), NSC_YCOORD, 0, NULL, EF_BAD, 0}, \
|
||||||
{"type", empobjoff(type), NSC_CHAR, 0, NULL, ef_chr, 0}, \
|
{"type", empobjoff(type), NSC_CHAR, 0, NULL, ef_chr, 0}, \
|
||||||
{"effic", empobjoff(effic), NSC_CHAR, 0, NULL, EF_BAD, 0}, \
|
{"effic", empobjoff(effic), NSC_CHAR, 0, NULL, EF_BAD, 0}, \
|
||||||
{"mobil", empobjoff(mobil), NSC_CHAR , 0, NULL, EF_BAD, 0}, \
|
{"mobil", empobjoff(mobil), NSC_CHAR , 0, NULL, EF_BAD, 0}, \
|
||||||
{"off", empobjoff(off), NSC_UCHAR , 0, NULL, EF_BAD, 0}, \
|
{"off", empobjoff(off), NSC_UCHAR , 0, NULL, EF_BAD, 0}, \
|
||||||
{"tech", empobjoff(tech), NSC_SHORT, 0, NULL, EF_BAD, 0}, \
|
{"tech", empobjoff(tech), NSC_SHORT, 0, NULL, EF_BAD, 0}, \
|
||||||
{"group", empobjoff(group), NSC_STRINGY, 1, NULL, EF_BAD, NSC_EXTRA}, \
|
{"group", empobjoff(group), NSC_STRINGY, 1, NULL, EF_BAD, NSC_EXTRA}, \
|
||||||
{"opx", empobjoff(opx), NSC_XCOORD, 0, NULL, EF_BAD, 0}, \
|
{"opx", empobjoff(opx), NSC_XCOORD, 0, NULL, EF_BAD, 0}, \
|
||||||
{"opy", empobjoff(opy), NSC_YCOORD, 0, NULL, EF_BAD, 0}, \
|
{"opy", empobjoff(opy), NSC_YCOORD, 0, NULL, EF_BAD, 0}, \
|
||||||
{"mission", empobjoff(mission), NSC_SHORT, 0, NULL, EF_MISSIONS, 0}, \
|
{"mission", empobjoff(mission), NSC_SHORT, 0, NULL, EF_MISSIONS, 0}, \
|
||||||
{"radius", empobjoff(radius), NSC_SHORT, 0, NULL, EF_BAD, 0}
|
{"radius", empobjoff(radius), NSC_SHORT, 0, NULL, EF_BAD, 0}
|
||||||
|
|
||||||
struct castr ship_ca[] = {
|
struct castr ship_ca[] = {
|
||||||
#define CURSTR struct shpstr
|
#define CURSTR struct shpstr
|
||||||
|
@ -482,7 +482,7 @@ struct castr news_ca[] = {
|
||||||
|
|
||||||
struct castr lost_ca[] = {
|
struct castr lost_ca[] = {
|
||||||
#define CURSTR struct loststr
|
#define CURSTR struct loststr
|
||||||
/* no need for uid as long as it's not referenced from other tables */
|
/* no need for uid as long as it's not referenced from other tables */
|
||||||
{"timestamp", fldoff(lost_timestamp), NSC_TIME, 0, NULL,
|
{"timestamp", fldoff(lost_timestamp), NSC_TIME, 0, NULL,
|
||||||
EF_BAD, 0},
|
EF_BAD, 0},
|
||||||
{"owner", fldoff(lost_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
|
{"owner", fldoff(lost_owner), NSC_NATID, 0, NULL, EF_NATION, 0},
|
||||||
|
|
|
@ -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 {
|
||||||
|
|
|
@ -349,7 +349,7 @@ deffld(int fldno, char *name, int idx)
|
||||||
int res;
|
int res;
|
||||||
|
|
||||||
res = stmtch(name, ca, offsetof(struct castr, ca_name),
|
res = stmtch(name, ca, offsetof(struct castr, ca_name),
|
||||||
sizeof(struct castr));
|
sizeof(struct castr));
|
||||||
if (res < 0)
|
if (res < 0)
|
||||||
return gripe("Header %s of field %d is %s", name, fldno + 1,
|
return gripe("Header %s of field %d is %s", name, fldno + 1,
|
||||||
res == M_NOTUNIQUE ? "ambiguous" : "unknown");
|
res == M_NOTUNIQUE ? "ambiguous" : "unknown");
|
||||||
|
@ -851,7 +851,7 @@ xufooter(FILE *fp, struct castr ca[], int recs)
|
||||||
|
|
||||||
res = -1;
|
res = -1;
|
||||||
if (human) {
|
if (human) {
|
||||||
if (fscanf(fp, "config%n", &res) != 0 || res < 0)
|
if (fscanf(fp, "config%n", &res) != 0 || res < 0)
|
||||||
return gripe("Malformed table footer");
|
return gripe("Malformed table footer");
|
||||||
} else {
|
} else {
|
||||||
if (fscanf(fp, "%d", &n) != 1)
|
if (fscanf(fp, "%d", &n) != 1)
|
||||||
|
|
|
@ -439,7 +439,7 @@ empth_rwlock_wrlock(empth_rwlock_t *rwlock)
|
||||||
empth_status("waiting for wrlock %s", rwlock->name);
|
empth_status("waiting for wrlock %s", rwlock->name);
|
||||||
pthread_cond_wait(&rwlock->can_write, &mtx_ctxsw);
|
pthread_cond_wait(&rwlock->can_write, &mtx_ctxsw);
|
||||||
empth_status("got wrlock %s %d %d",
|
empth_status("got wrlock %s %d %d",
|
||||||
rwlock->name, rwlock->nread, rwlock->nwrite);
|
rwlock->name, rwlock->nread, rwlock->nwrite);
|
||||||
empth_restorectx();
|
empth_restorectx();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -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[] = {
|
||||||
" ", " /", " >"," \\","/ ","< ","\\ "
|
" ", " /", " >", " \\", "/ ", "< ", "\\ "
|
||||||
};
|
};
|
||||||
|
|
|
@ -87,7 +87,7 @@ struct symbol meta_flags[] = {
|
||||||
{0, NULL}
|
{0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct symbol meta_type[] = {
|
struct symbol meta_type[] = {
|
||||||
{NSC_LONG, "d"},
|
{NSC_LONG, "d"},
|
||||||
{NSC_DOUBLE, "g"},
|
{NSC_DOUBLE, "g"},
|
||||||
{NSC_STRING, "s"},
|
{NSC_STRING, "s"},
|
||||||
|
@ -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}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -150,7 +150,7 @@ struct symbol nation_relations[] = {
|
||||||
|
|
||||||
struct symbol nation_status[] = {
|
struct symbol nation_status[] = {
|
||||||
{STAT_UNUSED, "unused"},
|
{STAT_UNUSED, "unused"},
|
||||||
{STAT_NEW, "new"},
|
{STAT_NEW, "new"},
|
||||||
{STAT_VIS, "visitor"},
|
{STAT_VIS, "visitor"},
|
||||||
{STAT_SANCT, "sanctuary"},
|
{STAT_SANCT, "sanctuary"},
|
||||||
{STAT_ACTIVE, "active"},
|
{STAT_ACTIVE, "active"},
|
||||||
|
|
|
@ -76,10 +76,10 @@ player_new(int s)
|
||||||
|
|
||||||
lp = malloc(sizeof(struct player));
|
lp = malloc(sizeof(struct player));
|
||||||
if (!lp)
|
if (!lp)
|
||||||
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);
|
||||||
|
|
|
@ -167,7 +167,7 @@ disable_coms(void)
|
||||||
cmd = comtch(name, player_coms, -1);
|
cmd = comtch(name, player_coms, -1);
|
||||||
if (cmd < 0) {
|
if (cmd < 0) {
|
||||||
logerror("Warning: not disabling %s command %s\n",
|
logerror("Warning: not disabling %s command %s\n",
|
||||||
cmd == M_NOTUNIQUE ? "ambiguous" : "unknown", name);
|
cmd == M_NOTUNIQUE ? "ambiguous" : "unknown", name);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
player_coms[cmd].c_permit |= GOD;
|
player_coms[cmd].c_permit |= GOD;
|
||||||
|
@ -219,7 +219,7 @@ update_timeused(time_t now)
|
||||||
void
|
void
|
||||||
enforce_minimum_session_time(void)
|
enforce_minimum_session_time(void)
|
||||||
{
|
{
|
||||||
struct natstr *natp = getnatp(player->cnum);
|
struct natstr *natp = getnatp(player->cnum);
|
||||||
|
|
||||||
time_t dt = natp->nat_last_logout - natp->nat_last_login;
|
time_t dt = natp->nat_last_logout - natp->nat_last_login;
|
||||||
if (dt > seconds_since_midnight(natp->nat_last_logout))
|
if (dt > seconds_since_midnight(natp->nat_last_logout))
|
||||||
|
|
|
@ -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},
|
||||||
|
|
|
@ -508,7 +508,7 @@ perform_mission_ship(int dam, struct shpstr *sp, coord x, coord y,
|
||||||
}
|
}
|
||||||
if (mcp->m_flags & M_SUB) {
|
if (mcp->m_flags & M_SUB) {
|
||||||
if (!targeting_ships)
|
if (!targeting_ships)
|
||||||
return dam; /* subs interdict only ships */
|
return dam; /* subs interdict only ships */
|
||||||
range = roundrange(torprange(sp));
|
range = roundrange(torprange(sp));
|
||||||
if (md > range)
|
if (md > range)
|
||||||
return dam;
|
return dam;
|
||||||
|
|
|
@ -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;
|
||||||
}
|
}
|
||||||
|
@ -353,7 +356,7 @@ static int
|
||||||
nstr_is_name_of_ca(struct valstr *val, struct castr *ca, int idx)
|
nstr_is_name_of_ca(struct valstr *val, struct castr *ca, int idx)
|
||||||
{
|
{
|
||||||
if (CANT_HAPPEN(val->val_cat != NSC_ID && idx >= 0))
|
if (CANT_HAPPEN(val->val_cat != NSC_ID && idx >= 0))
|
||||||
return 0;
|
return 0;
|
||||||
return idx >= 0 && strlen(ca[idx].ca_name) == val->val_as.str.maxsz;
|
return idx >= 0 && strlen(ca[idx].ca_name) == val->val_as.str.maxsz;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -487,11 +490,11 @@ nstr_optype(enum nsc_type lft, enum nsc_type rgt)
|
||||||
lft = nstr_promote(lft);
|
lft = nstr_promote(lft);
|
||||||
rgt = nstr_promote(rgt);
|
rgt = nstr_promote(rgt);
|
||||||
if (lft == rgt)
|
if (lft == rgt)
|
||||||
return lft;
|
return lft;
|
||||||
if (lft == NSC_DOUBLE && rgt == NSC_LONG)
|
if (lft == NSC_DOUBLE && rgt == NSC_LONG)
|
||||||
return NSC_DOUBLE;
|
return NSC_DOUBLE;
|
||||||
if (rgt == NSC_DOUBLE && lft == NSC_LONG)
|
if (rgt == NSC_DOUBLE && lft == NSC_LONG)
|
||||||
return NSC_DOUBLE;
|
return NSC_DOUBLE;
|
||||||
return NSC_NOTYPE;
|
return NSC_NOTYPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -544,7 +544,7 @@ copy_ascii_no_funny(char *dst, char *src)
|
||||||
if ((ch < 0x20 && ch != '\t' && ch != '\n') || ch == 0x7f)
|
if ((ch < 0x20 && ch != '\t' && ch != '\n') || ch == 0x7f)
|
||||||
; /* ignore funny control */
|
; /* ignore funny control */
|
||||||
else if (ch > 0x7f)
|
else if (ch > 0x7f)
|
||||||
*p++ = '?'; /* replace non-ASCII */
|
*p++ = '?'; /* replace non-ASCII */
|
||||||
else
|
else
|
||||||
*p++ = ch;
|
*p++ = ch;
|
||||||
}
|
}
|
||||||
|
@ -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++;
|
||||||
|
|
|
@ -85,7 +85,7 @@ sarg_xy(char *str, coord *xp, coord *yp)
|
||||||
return 0;
|
return 0;
|
||||||
y = strtoy(str, &str);
|
y = strtoy(str, &str);
|
||||||
if (y < 0 || (*str != 0 && !isspace(*str)))
|
if (y < 0 || (*str != 0 && !isspace(*str)))
|
||||||
return 0;
|
return 0;
|
||||||
if ((x ^ y) & 1)
|
if ((x ^ y) & 1)
|
||||||
return 0;
|
return 0;
|
||||||
np = getnatp(player->cnum);
|
np = getnatp(player->cnum);
|
||||||
|
|
|
@ -605,7 +605,7 @@ show_news(int tlev)
|
||||||
if (rpt[i].r_newspage == N_NOTUSED)
|
if (rpt[i].r_newspage == N_NOTUSED)
|
||||||
continue;
|
continue;
|
||||||
pr("%-2d %-20.20s %4d\n", rpt[i].r_uid,
|
pr("%-2d %-20.20s %4d\n", rpt[i].r_uid,
|
||||||
page_headings[rpt[i].r_newspage].name, rpt[i].r_good_will);
|
page_headings[rpt[i].r_newspage].name, rpt[i].r_good_will);
|
||||||
for (j = 0; j < NUM_RPTS; j++)
|
for (j = 0; j < NUM_RPTS; j++)
|
||||||
pr(" %s\n", rpt[i].r_newstory[j]);
|
pr(" %s\n", rpt[i].r_newstory[j]);
|
||||||
}
|
}
|
||||||
|
@ -686,12 +686,12 @@ 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
|
||||||
size_t n = strftime(buf, sizeof(buf), "%a, %d %b %Y %T %z",
|
size_t n = strftime(buf, sizeof(buf), "%a, %d %b %Y %T %z",
|
||||||
localtime(&t));
|
localtime(&t));
|
||||||
if (CANT_HAPPEN(n == 0))
|
if (CANT_HAPPEN(n == 0))
|
||||||
buf[0] = 0;
|
buf[0] = 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -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",
|
||||||
|
|
|
@ -161,7 +161,7 @@ unit_path(int together, struct empobj *unit, char *buf)
|
||||||
d_sect.sct_x, d_sect.sct_y, player->cnum);
|
d_sect.sct_x, d_sect.sct_y, player->cnum);
|
||||||
if (!cp || unit->mobil <= 0) {
|
if (!cp || unit->mobil <= 0) {
|
||||||
pr("Can't get to '%s' right now.\n",
|
pr("Can't get to '%s' right now.\n",
|
||||||
xyas(d_sect.sct_x, d_sect.sct_y, player->cnum));
|
xyas(d_sect.sct_x, d_sect.sct_y, player->cnum));
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -201,8 +201,8 @@ unit_view(struct emp_qelem *list)
|
||||||
pr("[oil:%d] ", sect.sct_oil);
|
pr("[oil:%d] ", sect.sct_oil);
|
||||||
}
|
}
|
||||||
pr("%s @ %s %d%% %s\n", obj_nameof(&ulp->unit.gen),
|
pr("%s @ %s %d%% %s\n", obj_nameof(&ulp->unit.gen),
|
||||||
xyas(ulp->unit.gen.x, ulp->unit.gen.y, player->cnum),
|
xyas(ulp->unit.gen.x, ulp->unit.gen.y, player->cnum),
|
||||||
sect.sct_effic, dchr[sect.sct_type].d_name);
|
sect.sct_effic, dchr[sect.sct_type].d_name);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -45,7 +45,7 @@ deliver(struct sctstr *from, struct ichrstr *ip, int dir,
|
||||||
int thresh, int amt_src, int plague, enum i_packing packing)
|
int thresh, int amt_src, int plague, enum i_packing packing)
|
||||||
{
|
{
|
||||||
struct sctstr *to;
|
struct sctstr *to;
|
||||||
i_type vtype; /* item vartype */
|
i_type vtype; /* item vartype */
|
||||||
int amt_moved;
|
int amt_moved;
|
||||||
int amt_dst;
|
int amt_dst;
|
||||||
int mobility;
|
int mobility;
|
||||||
|
|
|
@ -183,8 +183,8 @@ planerepair(struct plnstr *pp, struct natstr *np, struct bp *bp, int etus)
|
||||||
delta = 100 - pp->pln_effic;
|
delta = 100 - pp->pln_effic;
|
||||||
|
|
||||||
memset(mvec, 0, sizeof(mvec));
|
memset(mvec, 0, sizeof(mvec));
|
||||||
mvec[I_MILIT] = pcp->pl_crew;
|
mvec[I_MILIT] = pcp->pl_crew;
|
||||||
mvec[I_LCM] = pcp->pl_lcm;
|
mvec[I_LCM] = pcp->pl_lcm;
|
||||||
mvec[I_HCM] = pcp->pl_hcm;
|
mvec[I_HCM] = pcp->pl_hcm;
|
||||||
build = get_materials(sp, bp, mvec, delta);
|
build = get_materials(sp, bp, mvec, delta);
|
||||||
|
|
||||||
|
|
|
@ -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)
|
||||||
|
|
|
@ -39,9 +39,9 @@
|
||||||
|
|
||||||
struct iovec {
|
struct iovec {
|
||||||
/* Base address of a memory region for input or output. */
|
/* Base address of a memory region for input or output. */
|
||||||
void *iov_base;
|
void *iov_base;
|
||||||
/* The size of the memory pointed to by iov_base. */
|
/* The size of the memory pointed to by iov_base. */
|
||||||
size_t iov_len;
|
size_t iov_len;
|
||||||
};
|
};
|
||||||
|
|
||||||
extern ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
|
extern ssize_t readv(int fd, const struct iovec *iov, int iovcnt);
|
||||||
|
|
|
@ -81,33 +81,32 @@ fd_is_socket(int fd, SOCKET *sockp)
|
||||||
void
|
void
|
||||||
w32_set_winsock_errno(void)
|
w32_set_winsock_errno(void)
|
||||||
{
|
{
|
||||||
int err = WSAGetLastError();
|
int err = WSAGetLastError();
|
||||||
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;
|
||||||
case WSA_NOT_ENOUGH_MEMORY:
|
case WSA_NOT_ENOUGH_MEMORY:
|
||||||
errno = ENOMEM;
|
errno = ENOMEM;
|
||||||
break;
|
break;
|
||||||
case WSA_INVALID_PARAMETER:
|
case WSA_INVALID_PARAMETER:
|
||||||
errno = EINVAL;
|
errno = EINVAL;
|
||||||
break;
|
break;
|
||||||
case WSAEWOULDBLOCK:
|
case WSAEWOULDBLOCK:
|
||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
break;
|
break;
|
||||||
case WSAENAMETOOLONG:
|
case WSAENAMETOOLONG:
|
||||||
errno = ENAMETOOLONG;
|
errno = ENAMETOOLONG;
|
||||||
break;
|
break;
|
||||||
case WSAENOTEMPTY:
|
case WSAENOTEMPTY:
|
||||||
errno = ENOTEMPTY;
|
errno = ENOTEMPTY;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
errno = (err > 10000 && err < 10025) ? err - 10000 : err;
|
errno = (err > 10000 && err < 10025) ? err - 10000 : err;
|
||||||
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