extern void agecontact(struct natstr *np);
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 grant_btus(struct natstr *, int);
extern int nstr_exec(struct nscstr *, int, void *);
/* src/lib/common/nstreval.c */
extern struct valstr *nstr_mksymval(struct valstr *, struct castr *, int);
-extern struct valstr *nstr_exec_val(struct valstr *, natid, void *, enum nsc_type);
+extern struct valstr *nstr_exec_val(struct valstr *, natid, void *,
+ enum nsc_type);
extern int nstr_promote(int);
extern char *symbol_by_value(int, struct symbol *);
/* src/lib/global/nsc.c */
extern int want_to_abandon(struct sctstr *, i_type, int, struct lndstr *);
extern int would_abandon(struct sctstr *, i_type, int, struct lndstr *);
extern int nav_map(int, int, int);
-extern int do_unit_move(struct emp_qelem *land_list, int *together,
- double *minmob, double *maxmob);
+extern int do_unit_move(struct emp_qelem *, int *, double *, double *);
extern int count_pop(int);
extern int scuttle_tradeship(struct shpstr *, int);
-extern void resnoise(struct sctstr *sptr, int public_amt, char *name,
- int old, int new);
+extern void resnoise(struct sctstr *, int, char *, int, int);
extern int line_of_sight(char **rad, int ax, int ay, int bx, int by);
extern void plane_sona(struct emp_qelem *, int, int, struct shiplist **);
extern char *prsub(struct shpstr *);
extern void shp_set_tech(struct shpstr *, int);
/* snxtitem.c */
extern int snxtitem(struct nstr_item *, int, char *, char *);
-extern void snxtitem_area(struct nstr_item *, int,
- struct range *);
+extern void snxtitem_area(struct nstr_item *, int, struct range *);
extern void snxtitem_dist(struct nstr_item *, int, int, int, int);
extern void snxtitem_xy(struct nstr_item *, int, coord, coord);
extern void snxtitem_all(struct nstr_item *, int);
/* nav_ship.c */
extern int nav_ship(struct shpstr *);
/* nav_util.c */
-extern int load_it(struct shpstr *, struct sctstr *,
- int);
+extern int load_it(struct shpstr *, struct sctstr *, int);
extern void unload_it(struct shpstr *);
/* nxtitemp.c */
extern void *nxtitemp(struct nstr_item *);
* which individual events are active.
*/
static int
-w32_select(int nfds, fd_set *rdfd, fd_set *wrfd, fd_set *errfd, struct timeval* time)
+w32_select(int nfds, fd_set *rdfd, fd_set *wrfd, fd_set *errfd,
+ struct timeval *time)
{
HANDLE handles[3];
SOCKET sock;
pr(".\n");
return RET_FAIL;
}
- snprintf(filename, sizeof(filename), "%s/%s", infodir,
- last);
+ snprintf(filename, sizeof(filename), "%s/%s", infodir, last);
fp = fopen(filename, "r");
if (fp == NULL) {
pr("Error reading info file for %s\n", name);
while ((dp = readdir(info_dp))) {
if (dp->d_name[0] == '.')
continue;
- snprintf(filename, sizeof(filename), "%s/%s", infodir,
- dp->d_name);
+ snprintf(filename, sizeof(filename), "%s/%s", infodir, dp->d_name);
fp = fopen(filename, "r");
alreadyhit = 0;
nll = nlhl = 0;
pr(".\n");
return RET_FAIL;
}
- snprintf(filename, sizeof(filename), "%s/%s",
- infodir, last);
+ snprintf(filename, sizeof(filename), "%s/%s", infodir, last);
fp = fopen(filename, "rb");
if (fp == NULL) {
pr("Error reading info file for %s\n", name);
return RET_FAIL;
}
n = atoi(cp);
- if ((n < 0) || !getship(n, &target_ship) ||
- !target_ship.shp_own) {
+ if ((n < 0) || !getship(n, &target_ship) || !target_ship.shp_own) {
pr("Bad ship number!\n");
return RET_FAIL;
}
continue;
ontarget = target.lnd_item[ip->i_uid];
if (ontarget == 0 && amt < 0) {
- pr("No %s on %s\n",
- ip->i_name, prland(&target));
+ pr("No %s on %s\n", ip->i_name, prland(&target));
continue;
}
lbase = &lchr[(int)target.lnd_type];
pr("%d%% eff %s at %s has %d civilian%s & %d military\n",
sect.sct_effic,
sect.sct_type == SCT_CAPIT ? "capital" : "mountain capital",
- xyas(sect.sct_x, sect.sct_y, cnum), civ, splur(civ),
- mil);
+ xyas(sect.sct_x, sect.sct_y, cnum), civ, splur(civ), mil);
}
}
pr(" The treasury has $%.2f", (double)natp->nat_money);
else
lnd_mar(ulist, minmob, maxmob, together, player->cnum);
if (QEMPTY(ulist)) {
- pr("No %s left\n",
- type == EF_SHIP ? "ships" : "lands");
+ pr("No %s left\n", type == EF_SHIP ? "ships" : "lands");
if (type == EF_SHIP && strlen(pathtaken) > 1) {
pathtaken[strlen(pathtaken) - 1] = '\0';
pr("Path taken: %s\n", pathtaken);
else
lnd_mar(ulist, minmob, maxmob, together, player->cnum);
if (QEMPTY(ulist)) {
- pr("No %s left\n",
- type == EF_SHIP ? "ships" : "lands");
+ pr("No %s left\n", type == EF_SHIP ? "ships" : "lands");
if (type == EF_SHIP && strlen(pathtaken) > 1) {
pathtaken[strlen(pathtaken) - 1] = '\0';
pr("Path taken: %s\n", pathtaken);
i1 = whatitem(player->argp[5], "Commodity? ");
if (!i1)
return RET_FAIL;
- p1 = getstarg(player->argp[6], "Amount? ",
- buf);
+ p1 = getstarg(player->argp[6], "Amount? ", buf);
if (!p1)
return RET_SYN;
if (!check_ship_ok(&ship))
i1 = whatitem(player->argp[5], "Commodity? ");
if (!i1)
return RET_FAIL;
- p1 = getstarg(player->argp[6], "Amount? ",
- buf);
+ p1 = getstarg(player->argp[6], "Amount? ", buf);
if (!p1)
return RET_SYN;
if (!check_ship_ok(&ship))
tech = WORLD_Y / 2.0;
if (tech > WORLD_X / 4.0)
tech = WORLD_X / 4.0;
- radmap(item.gen.x, item.gen.y, item.gen.effic,
- (int)tech, tf);
+ radmap(item.gen.x, item.gen.y, item.gen.effic, (int)tech, tf);
}
break;
default:
pr("The current time is %19.19s.\n\n", ctime(&now));
if (next && update_window) {
- pr("The next update window starts at %19.19s.\n",
- ctime(&next));
+ pr("The next update window starts at %19.19s.\n", ctime(&next));
stop = next + update_window;
pr("The next update window stops at %19.19s.\n", ctime(&stop));
}
case UPD_DEMAND_SCHED:
pr("Demand updates occur at update CHECK times.\n");
if (next) {
- pr("The next update check is at %19.19s.\n",
- ctime(&next));
+ pr("The next update check is at %19.19s.\n", ctime(&next));
}
pr("Demand updates require %d country(s) to want one.\n",
update_wantmin);
if (land.lnd_own != player->cnum)
wu(0, land.lnd_own,
"%s upgraded by %s to tech %d, at a cost of %d\n",
- prland(&land), cname(player->cnum), land.lnd_tech,
- cost);
+ prland(&land), cname(player->cnum), land.lnd_tech, cost);
}
if (n == 0) {
pr("No land units\n");
if (ship.shp_own != player->cnum)
wu(0, ship.shp_own,
"%s upgraded by %s to tech %d, at a cost of %d\n",
- prship(&ship), cname(player->cnum), ship.shp_tech,
- cost);
+ prship(&ship), cname(player->cnum), ship.shp_tech, cost);
}
if (n == 0) {
pr("No ships\n");
if (plane.pln_own != player->cnum)
wu(0, plane.pln_own,
"%s upgraded by %s to tech %d, at a cost of %d\n",
- prplane(&plane), cname(player->cnum), plane.pln_tech,
- cost);
+ prplane(&plane), cname(player->cnum), plane.pln_tech, cost);
}
if (n == 0) {
pr("No planes.\n");
lineno = 1;
res = xundump(fp, ep->file, &lineno, ep->uid);
if (res >= 0 && getc(fp) != EOF) {
- fprintf(stderr, "%s: Junk after the table\n",
- ep->file);
+ fprintf(stderr, "%s: Junk after the table\n", ep->file);
res = EF_BAD;
}
fclose(fp);
* string in path. Return 0 on success, -1 on error.
*/
static int
-best_path(struct sctstr *from, struct sctstr *to, char *path,
- int mob_type)
+best_path(struct sctstr *from, struct sctstr *to, char *path, int mob_type)
{
static struct bestp *mybestpath;
struct as_data *adp;
{
int i = find_update(t, sched);
if (t == sched[i])
- memmove(sched + i, sched + i + 1,
- (n - 1 - i) * sizeof(*sched));
+ memmove(sched + i, sched + i + 1, (n - 1 - i) * sizeof(*sched));
return i;
}
static int land_board_abort(struct combat *off, struct combat *def);
static int ask_off(int combat_mode, struct combat *off,
struct combat *def);
-static void get_dlist(struct combat *def, struct emp_qelem *list, int a_spy,
+static void get_dlist(struct combat *def, struct emp_qelem *, int a_spy,
int *d_spyp);
static int get_ototal(int combat_mode, struct combat *off,
struct emp_qelem *olist, double osupport, int check);
} else if (com->type == EF_SHIP) {
return prbuf("%s%s %s(#%d)",
inon ? inon == 1 ? "on " : "onto " : "",
- com->shp_mcp->m_name, com->shp_name,
- com->shp_uid);
+ com->shp_mcp->m_name, com->shp_name, com->shp_uid);
} else if (com->type == EF_LAND) {
return prbuf("%s%s #%d",
inon ? inon == 1 ? "on " : "onto " : "",
return att_combat_init(com, EF_BAD);
}
if (opt_MARKET) {
- if (isdef && player->owner &&
- ontradingblock(EF_SHIP, &ship)) {
+ if (isdef && player->owner && ontradingblock(EF_SHIP, &ship)) {
pr("%s is on the trading block.\n", prcom(0, com));
return att_combat_init(com, EF_BAD);
}
mil);
com->troops = mil;
} else { /* attacker */
- if (owner != player->cnum && getrel(getnatp(owner), player->cnum) != ALLIED) {
+ if (owner != player->cnum
+ && getrel(getnatp(owner), player->cnum) != ALLIED) {
/* must be EF_SECTOR */
if (com->mil)
pr("WARNING: Your %d mil in %s were destroyed because %s just took the sector!\n",
if (!trechk(player->cnum, def->own, LNDATT))
return abort_attack();
}
- pr("%s is about %d%% efficient and has approximately %d mil on board.\n", prcom(0, def), roundintby((int)def->eff, 10), roundintby(def->troops, 10));
+ pr("%s is about %d%% efficient and has approximately %d mil on board.\n",
+ prcom(0, def), roundintby((int)def->eff, 10),
+ roundintby(def->troops, 10));
}
/* Ok, everything is fine */
return 0;
left = commdamage(num_mil, dam, I_MILIT);
if (left < num_mil) {
if (left) {
- pr("%d of the mil you were moving were destroyed!\nOnly %d mil made it to %s\n", num_mil - left, left, xyas(def->x, def->y, player->cnum));
+ pr("%d of the mil you were moving were destroyed!\n"
+ "Only %d mil made it to %s\n",
+ num_mil - left, left,
+ xyas(def->x, def->y, player->cnum));
} else {
pr("All of the mil you were moving were destroyed!\n");
}
}
if (prev_own != own)
- lost_and_found(EF_SECTOR, prev_own, own,
- 0, sp->sct_x, sp->sct_y);
+ lost_and_found(EF_SECTOR, prev_own, own, 0, sp->sct_x, sp->sct_y);
}
void
}
void
-snxtitem_dist(struct nstr_item *np, int type, int cx, int cy,
- int dist)
+snxtitem_dist(struct nstr_item *np, int type, int cx, int cy, int dist)
{
memset(np, 0, sizeof(*np));
xydist_range(cx, cy, dist, &np->range);
}
sprintf(tmp_filename, "%s.tmp", annfil);
if ((tmpfp = fopen(tmp_filename, "wb")) == NULL) {
- logerror("can't open telegram file %s for writing",
- tmp_filename);
+ logerror("can't open telegram file %s for writing", tmp_filename);
if (fclose(annfp) != 0)
logerror("can't close telegram file %s", annfil);
return;
copy_file = 0;
}
if (fclose(tmpfp) != 0) {
- logerror("can't close temporary telegram file %s",
- tmp_filename);
+ logerror("can't close temporary telegram file %s", tmp_filename);
copy_file = 0;
}
#if defined(_WIN32)
* Truncate any extra people that may be around
*/
static void
-trunc_people(struct sctstr *sp, struct natstr *np,
- short *vec)
+trunc_people(struct sctstr *sp, struct natstr *np, short *vec)
{
int maxpop = max_pop(np->nat_level[NAT_RLEV], sp);
*/
int
plague_people(struct natstr *np, short *vec,
- int *pstage, int *ptime,
- int etus)
+ int *pstage, int *ptime, int etus)
{
int stage;
double plg_num;
if (sp->sct_own == target)
wu(0, target, " body count: troops: %d, rebels: %d\n", mc, cc);
else
- wu(0, target,
- " rebels murder %d military\n", mc);
+ wu(0, target, " rebels murder %d military\n", mc);
nreport(actor, N_FREEDOM_FIGHT, victim, 1);
}
if (sp->sct_own != victim)
}
neweff = n;
*cost += work_cost;
- if (!n && IS_BIG_CITY(old_type) &&
- !IS_BIG_CITY(*desig)) {
+ if (!n && IS_BIG_CITY(old_type) && !IS_BIG_CITY(*desig)) {
// FIXME use trunc_people() and total_work()
int maxpop = max_population(np->nat_level[NAT_RLEV], *desig, n);
if (vec[I_CIVIL] > maxpop)
/* Fallout is calculated here. */
static void
-meltitems(int etus, int fallout, int own, short *vec, int type, int x, int y,
- int uid)
+meltitems(int etus, int fallout, int own, short *vec,
+ int type, int x, int y, int uid)
{
i_type n;
int melt;
return;
if (etus > 24)
etus = 24;
- meltitems(etus, sp->sct_fallout, sp->sct_own, sp->sct_item, EF_SECTOR,
- sp->sct_x, sp->sct_y, 0);
+ meltitems(etus, sp->sct_fallout, sp->sct_own, sp->sct_item,
+ EF_SECTOR, sp->sct_x, sp->sct_y, 0);
for (i = 0; NULL != (lp = getlandp(i)); i++) {
if (!lp->lnd_own)
continue;
if (lp->lnd_x != sp->sct_x || lp->lnd_y != sp->sct_y)
continue;
- meltitems(etus, sp->sct_fallout, lp->lnd_own, lp->lnd_item, EF_LAND,
- lp->lnd_x, lp->lnd_y, lp->lnd_uid);
+ meltitems(etus, sp->sct_fallout, lp->lnd_own, lp->lnd_item,
+ EF_LAND, lp->lnd_x, lp->lnd_y, lp->lnd_uid);
}
for (i = 0; NULL != (spp = getshipp(i)); i++) {
if (!spp->shp_own)
continue;
if (mchr[(int)spp->shp_type].m_flags & M_SUB)
continue;
- meltitems(etus, sp->sct_fallout, spp->shp_own, spp->shp_item, EF_SHIP,
- spp->shp_x, spp->shp_y, spp->shp_uid);
+ meltitems(etus, sp->sct_fallout, spp->shp_own, spp->shp_item,
+ EF_SHIP, spp->shp_x, spp->shp_y, spp->shp_uid);
}
}
SERVICE_DESCRIPTION sdBuf;
if (config_file != NULL)
- snprintf(&program_name[strlen(program_name)], _MAX_PATH-strlen(program_name), " -e %s",
- config_file);
+ snprintf(&program_name[strlen(program_name)],
+ _MAX_PATH - strlen(program_name),
+ " -e %s", config_file);
if (service_name == NULL)
service_name = DEFAULT_SERVICE_NAME;
/* silently ignore operands for backward compatibility */
#if defined(_WIN32)
- if ((!daemonize || flags || config_file != NULL) &&
- remove_service_set) {
+ if ((!daemonize || flags || config_file != NULL)
+ && remove_service_set) {
fprintf(stderr, "Can't use -p, -s, -d or -e with either "
"-u or -U options\n");
exit(EXIT_FAILURE);
}
if ((!daemonize || flags) && install_service_set) {
- fprintf(stderr, "Can't use -d, -p or -s with either "
- "-i or -I options\n");
+ fprintf(stderr,
+ "Can't use -d, -p or -s with either -i or -I options\n");
exit(EXIT_FAILURE);
}
if (install_service_set && remove_service_set) {
- fprintf(stderr, "Can't use both -u or -U and -i or -I "
- "options\n");
+ fprintf(stderr, "Can't use both -u or -U and -i or -I options\n");
exit(EXIT_FAILURE);
}
stacksize = 100000 +
/* finish_sects */ WORLD_X * WORLD_Y * (2 * sizeof(double) +
sizeof(char *));
- update_thread = empth_create(update_sched, stacksize, 0,
- "Update", dp);
+ update_thread = empth_create(update_sched, stacksize, 0, "Update", dp);
if (!update_thread)
exit_nomem();
}
}
}
if (AIRPORT_MARKER)
- printf("\n\nEach continent is marked by a \"*\" on the map (to distinguish them from\nthe islands). You can redesignate these airfields to wilderness sectors\none at a time, each time you add a new country to the game.\n");
+ printf("\n\nEach continent is marked by a \"*\" on the map (to distinguish them from\n"
+ "the islands). You can redesignate these airfields to wilderness sectors\n"
+ "one at a time, each time you add a new country to the game.\n");
}
static int