Break long lines more tastefully

This commit is contained in:
Markus Armbruster 2010-05-18 22:19:34 +02:00
parent 373651359e
commit 7465574195
28 changed files with 69 additions and 92 deletions

View file

@ -180,7 +180,8 @@ extern void putcontact(struct natstr *np, natid them, int contact);
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);

View file

@ -290,7 +290,8 @@ extern char *nstr_comp_val(char *, struct valstr *, 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 */

View file

@ -62,12 +62,10 @@ extern int display_mark(i_type, int);
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 *);
@ -657,8 +655,7 @@ extern double shp_mobcost(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);
@ -740,8 +737,7 @@ extern void prod_nat(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 *);

View file

@ -183,7 +183,8 @@ sysdep_stdin_init(void)
* 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;

View file

@ -129,8 +129,7 @@ info(void)
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);
@ -210,8 +209,7 @@ apro(void)
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;
@ -357,8 +355,7 @@ info(void)
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);

View file

@ -201,8 +201,7 @@ launch_missile(struct plnstr *pp)
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;
}

View file

@ -106,8 +106,7 @@ ltend(void)
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];

View file

@ -75,8 +75,7 @@ nati(void)
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);

View file

@ -108,8 +108,7 @@ do_unit_move(struct emp_qelem *ulist, int *together,
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);
@ -140,8 +139,7 @@ do_unit_move(struct emp_qelem *ulist, int *together,
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);

View file

@ -198,8 +198,7 @@ orde(void)
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))
@ -218,8 +217,7 @@ orde(void)
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))

View file

@ -121,8 +121,7 @@ radar(int type)
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:

View file

@ -61,8 +61,7 @@ upda(void)
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));
}
@ -74,8 +73,7 @@ upda(void)
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);

View file

@ -146,8 +146,7 @@ lupgr(void)
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");
@ -228,8 +227,7 @@ supgr(void)
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");
@ -317,8 +315,7 @@ pupgr(void)
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");

View file

@ -69,8 +69,7 @@ read_builtin_tables(void)
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);

View file

@ -93,8 +93,7 @@ bp_init(void)
* 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;

View file

@ -340,7 +340,6 @@ delete_update(time_t t, time_t sched[], int n)
{
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;
}

View file

@ -69,7 +69,7 @@ static int board_abort(struct combat *off, struct combat *def);
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);
@ -136,8 +136,7 @@ pr_com(int inon, struct combat *com, natid who)
} 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 " : "",
@ -217,8 +216,7 @@ att_get_combat(struct combat *com, int isdef)
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);
}
@ -287,7 +285,8 @@ att_get_combat(struct combat *com, int isdef)
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",
@ -682,7 +681,9 @@ att_show(struct combat *def)
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;
@ -2486,7 +2487,10 @@ ask_move_in_off(struct combat *off, struct combat *def)
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");
}

View file

@ -90,8 +90,7 @@ sct_prewrite(int id, void *old, void *new)
}
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

View file

@ -147,8 +147,7 @@ snxtitem_area(struct nstr_item *np, int type, struct range *range)
}
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);

View file

@ -72,8 +72,7 @@ delete_old_announcements(void)
}
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;
@ -85,8 +84,7 @@ delete_old_announcements(void)
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)

View file

@ -213,8 +213,7 @@ starve_some(short *vec, i_type whom, int num)
* 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);

View file

@ -144,8 +144,7 @@ infect_people(struct natstr *np, struct sctstr *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;

View file

@ -399,8 +399,7 @@ domove:
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)

View file

@ -78,8 +78,7 @@ upd_buildeff(struct natstr *np, struct sctstr *sp, int *workp,
}
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)
@ -154,8 +153,8 @@ enlist(short *vec, int etu, int *cost)
/* 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;
@ -200,15 +199,15 @@ do_fallout(struct sctstr *sp, int etus)
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)
@ -217,8 +216,8 @@ do_fallout(struct sctstr *sp, int etus)
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);
}
}

View file

@ -44,8 +44,9 @@ install_service(char *program_name, char *service_name, char *config_file)
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;

View file

@ -203,20 +203,19 @@ main(int argc, char **argv)
/* 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);
}

View file

@ -85,8 +85,7 @@ update_init(void)
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();
}

View file

@ -1123,7 +1123,9 @@ output(void)
}
}
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