some reformatting

Replace some
  (foo &&
   bar)
that had crept back into the code with
  (foo
   && bar)
to match the reformatting which took place before 3.6.0.  There are a
couple of lines ending in '||' still present but they look intentional.
isaac64.c has some trailing '|' bit operators that could/should be
moved to the start of the next line but I didn't touch that file.

While in the affected files, I tried to shorten most overly wide lines
(the right margin is supposed to at column 78 and there are quite a
few lines which are 79 characters long, but I left most of those
rather than introduce new line splits).  Also replace a handful of
tabs with spaces.  I was a little surprised not find any trailing
spaces (in the dozen or so files being updated).  I didn't look for
trailing arithmetic or '?'/':' operators which aught to be moved to
the start of the next line.
This commit is contained in:
PatR
2021-12-14 07:43:40 -08:00
parent d0197bd3e7
commit 495cda17b7
13 changed files with 212 additions and 141 deletions

View File

@@ -980,8 +980,8 @@ use_mirror(struct obj *obj)
if (vis)
pline("%s confuses itself!", Monnam(mtmp));
mtmp->mconf = 1;
} else if (monable &&
(mlet == S_NYMPH || mtmp->data == &mons[PM_AMOROUS_DEMON])) {
} else if (monable && (mlet == S_NYMPH
|| mtmp->data == &mons[PM_AMOROUS_DEMON])) {
if (vis) {
char buf[BUFSZ]; /* "She" or "He" */
@@ -1546,8 +1546,8 @@ light_cocktail(struct obj **optr)
*optr = obj;
}
/* getobj callback for object to be rubbed - not selecting a secondary object to
* rub on a gray stone or rub jelly on */
/* getobj callback for object to be rubbed - not selecting a secondary object
to rub on a gray stone or rub jelly on */
static int
rub_ok(struct obj *obj)
{
@@ -3630,12 +3630,12 @@ do_break_wand(struct obj *obj)
? (char *) 0
: "Some holes are quickly filled with %s!");
fillmsg = TRUE;
} else
digactualhole(x, y, BY_OBJECT, (rn2(obj->spe) < 3
|| (!Can_dig_down(&u.uz)
&& !levl[x][y].candig))
? PIT
: HOLE);
} else {
digactualhole(x, y, BY_OBJECT,
(rn2(obj->spe) < 3
|| (!Can_dig_down(&u.uz)
&& !levl[x][y].candig)) ? PIT : HOLE);
}
}
continue;
} else if (obj->otyp == WAN_CREATE_MONSTER) {

View File

@@ -28,8 +28,8 @@ static void openone(int, int, genericptr_t);
static int mfind0(struct monst *, boolean);
static int reveal_terrain_getglyph(int, int, int, unsigned, int, int);
/* wildcard class for clear_stale_map - this used to be used as a getobj() input
* but it's no longer used for that function */
/* wildcard class for clear_stale_map - this used to be used as a getobj()
input but it's no longer used for that function */
#define ALL_CLASSES (MAXOCLASSES + 1)
/* bring hero out from underwater or underground or being engulfed;
@@ -39,8 +39,9 @@ unconstrain_map(void)
{
boolean res = u.uinwater || u.uburied || u.uswallow;
/* bring Underwater, buried, or swallowed hero to normal map */
iflags.save_uinwater = u.uinwater, u.uinwater = 0; /* bypass set_uinwater() */
/* bring Underwater, buried, or swallowed hero to normal map;
bypass set_uinwater() */
iflags.save_uinwater = u.uinwater, u.uinwater = 0;
iflags.save_uburied = u.uburied, u.uburied = 0;
iflags.save_uswallow = u.uswallow, u.uswallow = 0;
@@ -51,7 +52,8 @@ unconstrain_map(void)
static void
reconstrain_map(void)
{
u.uinwater = iflags.save_uinwater, iflags.save_uinwater = 0; /* set_uinwater() */
/* if was in water and taken out, put back; bypass set_uinwater() */
u.uinwater = iflags.save_uinwater, iflags.save_uinwater = 0;
u.uburied = iflags.save_uburied, iflags.save_uburied = 0;
u.uswallow = iflags.save_uswallow, iflags.save_uswallow = 0;
}
@@ -235,8 +237,8 @@ check_map_spot(int x, int y, char oclass, unsigned material)
if (glyph_is_object(glyph)) {
/* there's some object shown here */
if (oclass == ALL_CLASSES) {
return (boolean) !(g.level.objects[x][y] /* stale if nothing here */
|| ((mtmp = m_at(x, y)) != 0 && mtmp->minvent));
return !(g.level.objects[x][y] /* stale if nothing here */
|| ((mtmp = m_at(x, y)) != 0 && mtmp->minvent));
} else {
if (material
&& objects[glyph_to_obj(glyph)].oc_material == material) {
@@ -1952,7 +1954,8 @@ dump_map(void)
{
int x, y, glyph, skippedrows, lastnonblank;
int subset = TER_MAP | TER_TRP | TER_OBJ | TER_MON;
int default_glyph = cmap_to_glyph(g.level.flags.arboreal ? S_tree : S_stone);
int default_glyph = cmap_to_glyph(g.level.flags.arboreal ? S_tree
: S_stone);
char buf[COLBUFSZ];
boolean blankrow, toprow;
@@ -2005,10 +2008,9 @@ dump_map(void)
/* idea from crawl; show known portion of map without any monsters,
objects, or traps occluding the view of the underlying terrain */
void
reveal_terrain(int full, /* wizard|explore modes allow player
to request full map */
int which_subset) /* when not full, whether to suppress
objs and/or traps */
reveal_terrain(
int full, /* wizard|explore modes allow player to request full map */
int which_subset) /* if not full, whether to suppress objs and/or traps */
{
if ((Hallucination || Stunned || Confusion) && !full) {
You("are too disoriented for this.");
@@ -2023,7 +2025,8 @@ reveal_terrain(int full, /* wizard|explore modes allow player
if (unconstrain_map())
docrt();
default_glyph = cmap_to_glyph(g.level.flags.arboreal ? S_tree : S_stone);
default_glyph = cmap_to_glyph(g.level.flags.arboreal ? S_tree
: S_stone);
for (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) {

View File

@@ -1742,7 +1742,8 @@ clear_glyph_buffer(void)
#ifndef UNBUFFERED_GLYPHINFO
nul_gbuf.gnew = (giptr->ttychar != nul_gbuf.glyphinfo.ttychar
|| giptr->gm.color != nul_gbuf.glyphinfo.gm.color
|| giptr->gm.glyphflags != nul_gbuf.glyphinfo.gm.glyphflags
|| giptr->gm.glyphflags
!= nul_gbuf.glyphinfo.gm.glyphflags
|| giptr->gm.tileidx != nul_gbuf.glyphinfo.gm.tileidx)
#else
nul_gbuf.gnew = (giptr->glyphinfo.ttychar != ' '
@@ -2029,12 +2030,13 @@ back_to_glyph(xchar x, xchar y)
static int
swallow_to_glyph(int mnum, int loc)
{
int m_3 = what_mon(mnum, rn2_on_display_rng) << 3;
if (loc < S_sw_tl || S_sw_br < loc) {
impossible("swallow_to_glyph: bad swallow location");
loc = S_sw_br;
}
return ((int) (what_mon(mnum, rn2_on_display_rng) << 3) |
(loc - S_sw_tl)) + GLYPH_SWALLOW_OFF;
return (m_3 | (loc - S_sw_tl)) + GLYPH_SWALLOW_OFF;
}
/*
@@ -2327,8 +2329,8 @@ cmap_to_roguecolor(int cmap)
gm_levelchange called when the player has gone to a new level.
gm_symchange called if someone has interactively altered the symbols for
the game, most likely at the options menu.
gm_symchange called if someone has interactively altered the symbols
for the game, most likely at the options menu.
gm_optionchange The game settings have been toggled and some of them
are configured to trigger a reset_glyphmap()

View File

@@ -190,8 +190,8 @@ getpos_help(boolean force, const char *goal)
if (iflags.cmdassist) { /* assisting the '/' command, I suppose... */
Sprintf(sbuf,
(iflags.getpos_coords == GPCOORDS_NONE)
? "(Set 'whatis_coord' option to include coordinates with '%s' text.)"
: "(Reset 'whatis_coord' option to omit coordinates from '%s' text.)",
? "(Set 'whatis_coord' option to include coordinates with '%s' text.)"
: "(Reset 'whatis_coord' option to omit coordinates from '%s' text.)",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_AUTODESC]));
}
/* disgusting hack; the alternate selection characters work for any
@@ -211,7 +211,7 @@ getpos_help(boolean force, const char *goal)
putstr(tmpwin, 0, sbuf);
if (doing_what_is) {
Sprintf(sbuf,
" '%s' describe current spot, show 'more info', move to another spot.",
" '%s' describe current spot, show 'more info', move to another spot.",
visctrl(g.Cmd.spkeys[NHKF_GETPOS_PICK_V]));
putstr(tmpwin, 0, sbuf);
Sprintf(sbuf,
@@ -370,8 +370,8 @@ gather_locs_interesting(int x, int y, int gloc)
/* unlike '/M', this skips monsters revealed by
warning glyphs and remembered unseen ones */
return (glyph_is_monster(glyph)
&& glyph != monnum_to_glyph(PM_LONG_WORM_TAIL,MALE) &&
glyph != monnum_to_glyph(PM_LONG_WORM_TAIL, FEMALE));
&& glyph != monnum_to_glyph(PM_LONG_WORM_TAIL,MALE)
&& glyph != monnum_to_glyph(PM_LONG_WORM_TAIL, FEMALE));
case GLOC_OBJS:
return (glyph_is_object(glyph)
&& glyph != objnum_to_glyph(BOULDER)
@@ -532,7 +532,7 @@ coord_desc(int x, int y, char *outbuf, char cmode)
than Nx999 or 999xM will still work, but not line up like normal
when displayed in a column setting.
The (100) is placed in brackets below to mark the [: "03"] as
The (100) is placed in brackets below to mark the [: "03"] as
explicit compile-time dead code for clang */
if (!*screen_fmt)
Sprintf(screen_fmt, "[%%%sd,%%%sd]",
@@ -1027,7 +1027,7 @@ new_mgivenname(struct monst *mon,
if (!mon->mextra)
mon->mextra = newmextra();
else
free_mgivenname(mon); /* already has mextra, might also have name */
free_mgivenname(mon); /* has mextra, might also have name */
MGIVENNAME(mon) = (char *) alloc((unsigned) lth);
} else {
/* zero length: the new name is empty; get rid of the old name */
@@ -1097,7 +1097,7 @@ christen_monst(struct monst *mtmp, const char *name)
int lth;
char buf[PL_PSIZ];
/* g.dogname & g.catname are PL_PSIZ arrays; object names have same limit */
/* dogname & catname are PL_PSIZ arrays; object names have same limit */
lth = (name && *name) ? ((int) strlen(name) + 1) : 0;
if (lth > PL_PSIZ) {
lth = PL_PSIZ;
@@ -1111,7 +1111,7 @@ christen_monst(struct monst *mtmp, const char *name)
}
/* check whether user-supplied name matches or nearly matches an unnameable
monster's name; if so, give an alternate reject message for do_mgivenname() */
monster's name; if so, give alternate reject message for do_mgivenname() */
static boolean
alreadynamed(struct monst *mtmp, char *monnambuf, char *usrbuf)
{
@@ -1579,7 +1579,8 @@ namefloorobj(void)
been moved off the hero's '@' yet, but there's no way to adjust
the help text once getpos() has started */
Sprintf(buf, "object on map (or '.' for one %s you)",
(u.uundetected && hides_under(g.youmonst.data)) ? "over" : "under");
(u.uundetected && hides_under(g.youmonst.data))
? "over" : "under");
if (getpos(&cc, FALSE, buf) < 0 || cc.x <= 0)
return;
if (cc.x == u.ux && cc.y == u.uy) {
@@ -1660,7 +1661,8 @@ static const char *const ghostnames[] = {
const char *
rndghostname(void)
{
return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))] : (const char *) g.plname;
return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))]
: (const char *) g.plname;
}
/*
@@ -2070,9 +2072,11 @@ mon_nam_too(struct monst *mon, struct monst *other_mon)
/* construct "<monnamtext> <verb> <othertext> {him|her|it}self" which might
be distorted by Hallu; if that's plural, adjust monnamtext and verb */
char *
monverbself(struct monst *mon,
char *monnamtext, /* modifiable 'mbuf' with adequare room at end */
const char *verb, const char *othertext)
monverbself(
struct monst *mon,
char *monnamtext, /* modifiable 'mbuf' with adequare room at end */
const char *verb,
const char *othertext)
{
char *verbs, selfbuf[40]; /* sizeof "themselves" suffices */
@@ -2323,7 +2327,8 @@ static NEARDATA const char *const hliquids[] = {
/* if hallucinating, return a random liquid instead of 'liquidpref' */
const char *
hliquid(const char *liquidpref) /* use as-is when not hallucinating (unless empty) */
hliquid(
const char *liquidpref) /* use as-is when not hallucintg (unless empty) */
{
if (Hallucination || !liquidpref || !*liquidpref) {
int indx, count = SIZE(hliquids);

View File

@@ -2927,7 +2927,7 @@ inaccessible_equipment(struct obj *obj,
return FALSE;
}
/* not a getobj callback - unifies code among the other four getobj callbacks */
/* not a getobj callback - unifies code among the other 4 getobj callbacks */
static int
equip_ok(struct obj *obj, boolean removing, boolean accessory)
{
@@ -2937,7 +2937,7 @@ equip_ok(struct obj *obj, boolean removing, boolean accessory)
if (!obj)
return GETOBJ_EXCLUDE;
/* ignore for putting on if already worn, or removing if not already worn */
/* ignore for putting on if already worn, or removing if not worn */
is_worn = ((obj->owornmask & (W_ARMOR | W_ACCESSORY)) != 0);
if (removing ^ is_worn)
return GETOBJ_EXCLUDE_INACCESS;
@@ -2956,8 +2956,8 @@ equip_ok(struct obj *obj, boolean removing, boolean accessory)
return GETOBJ_DOWNPLAY;
/* armor we can't wear, e.g. from polyform */
if (obj->oclass == ARMOR_CLASS && !removing &&
!canwearobj(obj, &dummymask, FALSE))
if (obj->oclass == ARMOR_CLASS && !removing
&& !canwearobj(obj, &dummymask, FALSE))
return GETOBJ_DOWNPLAY;
/* Possible extension: downplay items (both accessories and armor) which

View File

@@ -197,7 +197,12 @@ static NHFILE *viable_nhfile(NHFILE *);
* "This%20is%20a%20%25%20test%21"
*/
char *
fname_encode(const char *legal, char quotechar, char *s, char *callerbuf, int bufsz)
fname_encode(
const char *legal,
char quotechar,
char *s,
char *callerbuf,
int bufsz)
{
char *sp, *op;
int cnt = 0;
@@ -364,8 +369,8 @@ validate_prefix_locations(char *reasonbuf)
if (!(details = strerror(errno)))
#endif
details = "";
Sprintf(panicbuf2, "\"%s\", (%d) %s", g.fqn_prefix[prefcnt], errno,
details);
Sprintf(panicbuf2, "\"%s\", (%d) %s",
g.fqn_prefix[prefcnt], errno, details);
paniclog(panicbuf1, panicbuf2);
failcount++;
}
@@ -513,8 +518,8 @@ create_levelfile(int lev, char errbuf[])
if (nhfp) {
nhfp->ftype = NHF_LEVELFILE;
nhfp->mode = WRITING;
nhfp->structlevel = TRUE; /* do set this TRUE for levelfiles */
nhfp->fieldlevel = FALSE; /* don't set this TRUE for levelfiles */
nhfp->structlevel = TRUE; /* do set this TRUE for levelfiles */
nhfp->fieldlevel = FALSE; /* don't set this TRUE for levelfiles */
nhfp->addinfo = FALSE;
nhfp->style.deflt = FALSE;
nhfp->style.binary = TRUE;
@@ -524,7 +529,8 @@ create_levelfile(int lev, char errbuf[])
/* Use O_TRUNC to force the file to be shortened if it already
* exists and is currently longer.
*/
nhfp->fd = open(fq_lock, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY, FCMASK);
nhfp->fd = open(fq_lock, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
FCMASK);
#else
#ifdef MAC
nhfp->fd = maccreat(fq_lock, LEVL_TYPE);
@@ -536,7 +542,8 @@ create_levelfile(int lev, char errbuf[])
if (nhfp->fd >= 0)
g.level_info[lev].flags |= LFILE_EXISTS;
else if (errbuf) /* failure explanation */
Sprintf(errbuf, "Cannot create file \"%s\" for level %d (errno %d).",
Sprintf(errbuf,
"Cannot create file \"%s\" for level %d (errno %d).",
g.lock, lev, errno);
}
nhfp = viable_nhfile(nhfp);
@@ -556,8 +563,8 @@ open_levelfile(int lev, char errbuf[])
nhfp = new_nhfile();
if (nhfp) {
nhfp->mode = READING;
nhfp->structlevel = TRUE; /* do set this TRUE for levelfiles */
nhfp->fieldlevel = FALSE; /* do not set this TRUE for levelfiles */
nhfp->structlevel = TRUE; /* do set this TRUE for levelfiles */
nhfp->fieldlevel = FALSE; /* do not set this TRUE for levelfiles */
nhfp->addinfo = FALSE;
nhfp->style.deflt = FALSE;
nhfp->style.binary = TRUE;
@@ -576,7 +583,8 @@ open_levelfile(int lev, char errbuf[])
settle for `lock' instead of `fq_lock' because the latter
might end up being too big for nethack's BUFSZ */
if (nhfp->fd < 0 && errbuf)
Sprintf(errbuf, "Cannot open file \"%s\" for level %d (errno %d).",
Sprintf(errbuf,
"Cannot open file \"%s\" for level %d (errno %d).",
g.lock, lev, errno);
}
nhfp = viable_nhfile(nhfp);
@@ -890,8 +898,7 @@ set_savefile_name(boolean regularize_it)
if (strlen(g.SAVEP) < (SAVESIZE - 1))
Strcpy(g.SAVEF, g.SAVEP);
if (strlen(g.SAVEF) < (SAVESIZE - 1))
(void) strncat(g.SAVEF, g.plname,
(SAVESIZE - strlen(g.SAVEF)));
(void) strncat(g.SAVEF, g.plname, (SAVESIZE - strlen(g.SAVEF)));
#endif
#if defined(MICRO) && !defined(VMS) && !defined(WIN32) && !defined(MSDOS)
if (strlen(g.SAVEP) < (SAVESIZE - 1))
@@ -1015,7 +1022,8 @@ create_savefile(void)
}
if (nhfp->structlevel) {
#if defined(MICRO) || defined(WIN32)
nhfp->fd = open(fq_save, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC, FCMASK);
nhfp->fd = open(fq_save, O_WRONLY | O_BINARY | O_CREAT | O_TRUNC,
FCMASK);
#else
#ifdef MAC
nhfp->fd = maccreat(fq_save, SAVE_TYPE);
@@ -1229,8 +1237,8 @@ get_saved_games(void)
fq_new_save = fqname(g.SAVEF, SAVEPREFIX, 0);
fq_old_save = fqname(files[i], SAVEPREFIX, 1);
if(strcmp(fq_old_save, fq_new_save) != 0 &&
!file_exists(fq_new_save))
if (strcmp(fq_old_save, fq_new_save) != 0
&& !file_exists(fq_new_save))
rename(fq_old_save, fq_new_save);
result[j++] = r;
@@ -2927,7 +2935,8 @@ config_erradd(const char *buf)
if (!g.program_state.config_error_ready) {
/* either very early, where pline() will use raw_print(), or
player gave bad value when prompted by interactive 'O' command */
pline("%s%s.", !iflags.window_inited ? "config_error_add: " : "", buf);
pline("%s%s.", !iflags.window_inited ? "config_error_add: " : "",
buf);
wait_synch();
return;
}
@@ -3445,7 +3454,7 @@ read_sym_file(int which_set)
clear_symsetentry(which_set, TRUE);
config_error_done();
/* If name was defined, it was invalid... Then we're loading fallback */
/* If name was defined, it was invalid. Then we're loading fallback */
if (g.symset[which_set].name) {
g.symset[which_set].explicitly = FALSE;
return 0;
@@ -4340,7 +4349,7 @@ reveal_paths(void)
if (strlen(pd) > 0) {
raw_printf("portable_device_paths (set in sysconf):");
raw_printf(" \"%s\"", pd);
}
}
}
#endif

View File

@@ -82,8 +82,8 @@ door_into_nonjoined(xchar x, xchar y)
continue;
/* Is this connecting to a room that doesn't want joining? */
if (levl[tx][ty].roomno >= ROOMOFFSET &&
!g.rooms[levl[tx][ty].roomno - ROOMOFFSET].needjoining) {
if (levl[tx][ty].roomno >= ROOMOFFSET
&& !g.rooms[levl[tx][ty].roomno - ROOMOFFSET].needjoining) {
return TRUE;
}
}
@@ -1610,7 +1610,7 @@ mktrap(int num, int mktrapflags, struct mkroom *croom, coord *tm)
void
mkstairs(xchar x, xchar y,
char up, /* [why 'char' when usage is boolean?] */
char up, /* [why 'char' when usage is boolean?] */
struct mkroom *croom UNUSED)
{
d_level dest;

View File

@@ -538,7 +538,9 @@ optfn_align(int optidx, int req, boolean negated, char *opts, char *op)
static int
optfn_align_message(int optidx, int req, boolean negated, char *opts, char *op)
optfn_align_message(
int optidx, int req, boolean negated,
char *opts, char *op)
{
if (req == do_init) {
return optn_ok;
@@ -748,8 +750,8 @@ optfn_boulder(int optidx UNUSED, int req, boolean negated UNUSED,
#ifdef BACKWARD_COMPAT
Sprintf(opts, "%c",
g.ov_primary_syms[SYM_BOULDER + SYM_OFF_X]
? g.ov_primary_syms[SYM_BOULDER + SYM_OFF_X]
: g.showsyms[(int) objects[BOULDER].oc_class + SYM_OFF_O]);
? g.ov_primary_syms[SYM_BOULDER + SYM_OFF_X]
: g.showsyms[(int) objects[BOULDER].oc_class + SYM_OFF_O]);
#endif
return optn_ok;
}
@@ -757,7 +759,9 @@ optfn_boulder(int optidx UNUSED, int req, boolean negated UNUSED,
}
static int
optfn_catname(int optidx, int req, boolean negated UNUSED, char *opts, char *op)
optfn_catname(
int optidx, int req, boolean negated UNUSED,
char *opts, char *op)
{
if (req == do_init) {
return optn_ok;
@@ -1087,35 +1091,45 @@ optfn_font_message(int optidx, int req, boolean negated, char *opts, char *op)
}
static int
optfn_font_size_map(int optidx, int req, boolean negated, char *opts, char *op)
optfn_font_size_map(
int optidx, int req, boolean negated,
char *opts, char *op)
{
/* send them over to the prefix handling for font_ */
return pfxfn_font(optidx, req, negated, opts, op);
}
static int
optfn_font_size_menu(int optidx, int req, boolean negated, char *opts, char *op)
optfn_font_size_menu(
int optidx, int req, boolean negated,
char *opts, char *op)
{
/* send them over to the prefix handling for font_ */
return pfxfn_font(optidx, req, negated, opts, op);
}
static int
optfn_font_size_message(int optidx, int req, boolean negated, char *opts, char *op)
optfn_font_size_message(
int optidx, int req, boolean negated,
char *opts, char *op)
{
/* send them over to the prefix handling for font_ */
return pfxfn_font(optidx, req, negated, opts, op);
}
static int
optfn_font_size_status(int optidx, int req, boolean negated, char *opts, char *op)
optfn_font_size_status(
int optidx, int req, boolean negated,
char *opts, char *op)
{
/* send them over to the prefix handling for font_ */
return pfxfn_font(optidx, req, negated, opts, op);
}
static int
optfn_font_size_text(int optidx, int req, boolean negated, char *opts, char *op)
optfn_font_size_text(
int optidx, int req, boolean negated,
char *opts, char *op)
{
/* send them over to the prefix handling for font_ */
return pfxfn_font(optidx, req, negated, opts, op);
@@ -1269,7 +1283,9 @@ optfn_hilite_status(int optidx UNUSED, int req, boolean negated,
}
static int
optfn_horsename(int optidx, int req, boolean negated UNUSED, char *opts, char *op)
optfn_horsename(
int optidx, int req, boolean negated UNUSED,
char *opts, char *op)
{
if (req == do_init) {
return optn_ok;
@@ -1374,7 +1390,7 @@ optfn_MACgraphics(int optidx, int req, boolean negated, char *opts, char *op)
}
if (badflag) {
config_error_add("Failure to load symbol set %s.",
allopt[optidx].name);
allopt[optidx].name);
return FALSE;
} else {
switch_symbols(TRUE);
@@ -1732,7 +1748,9 @@ optfn_monsters(int optidx UNUSED, int req, boolean negated UNUSED,
}
static int
optfn_mouse_support(int optidx, int req, boolean negated, char *opts, char *op)
optfn_mouse_support(
int optidx, int req, boolean negated,
char *opts, char *op)
{
boolean compat;
@@ -2030,7 +2048,9 @@ optfn_packorder(int optidx UNUSED, int req, boolean negated UNUSED,
#ifdef CHANGE_COLOR
static int
optfn_palette(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, char *op)
optfn_palette(
int optidx UNUSED, int req, boolean negated UNUSED,
char *opts, char *op)
{
#ifndef WIN32
int cnt, tmp, reverse;
@@ -2131,7 +2151,9 @@ optfn_palette(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, ch
#endif /* CHANGE_COLOR */
static int
optfn_paranoid_confirmation(int optidx, int req, boolean negated, char *opts, char *op)
optfn_paranoid_confirmation(
int optidx, int req, boolean negated,
char *opts, char *op)
{
int i;
@@ -2336,7 +2358,9 @@ optfn_pettype(int optidx, int req, boolean negated, char *opts, char *op)
}
static int
optfn_pickup_burden(int optidx, int req, boolean negated UNUSED, char *opts, char *op)
optfn_pickup_burden(
int optidx, int req, boolean negated UNUSED,
char *opts, char *op)
{
if (req == do_init) {
return optn_ok;
@@ -2518,7 +2542,9 @@ optfn_pile_limit(int optidx, int req, boolean negated, char *opts, char *op)
}
static int
optfn_player_selection(int optidx, int req, boolean negated, char *opts, char *op)
optfn_player_selection(
int optidx, int req, boolean negated,
char *opts, char *op)
{
if (req == do_init) {
return optn_ok;
@@ -2543,7 +2569,8 @@ optfn_player_selection(int optidx, int req, boolean negated, char *opts, char *o
if (req == get_val) {
if (!opts)
return optn_err;
Sprintf(opts, "%s", iflags.wc_player_selection ? "prompts" : "dialog");
Sprintf(opts, "%s",
iflags.wc_player_selection ? "prompts" : "dialog");
return optn_ok;
}
return optn_ok;
@@ -2813,7 +2840,9 @@ optfn_scores(int optidx, int req, boolean negated, char *opts, char *op)
}
static int
optfn_scroll_amount(int optidx, int req, boolean negated, char *opts, char *op)
optfn_scroll_amount(
int optidx, int req, boolean negated,
char *opts, char *op)
{
if (req == do_init) {
return optn_ok;
@@ -2844,7 +2873,9 @@ optfn_scroll_amount(int optidx, int req, boolean negated, char *opts, char *op)
}
static int
optfn_scroll_margin(int optidx, int req, boolean negated, char *opts, char *op)
optfn_scroll_margin(
int optidx, int req, boolean negated,
char *opts, char *op)
{
if (req == do_init) {
return optn_ok;
@@ -2874,7 +2905,9 @@ optfn_scroll_margin(int optidx, int req, boolean negated, char *opts, char *op)
}
static int
optfn_sortdiscoveries(int optidx, int req, boolean negated, char *opts, char *op)
optfn_sortdiscoveries(
int optidx, int req, boolean negated,
char *opts, char *op)
{
if (req == do_init) {
flags.discosort = 'o';
@@ -3340,7 +3373,9 @@ optfn_traps(int optidx UNUSED, int req, boolean negated UNUSED,
}
static int
optfn_vary_msgcount(int optidx, int req, boolean negated, char *opts, char *op)
optfn_vary_msgcount(
int optidx, int req, boolean negated,
char *opts, char *op)
{
if (req == do_init) {
return optn_ok;
@@ -3583,7 +3618,9 @@ optfn_whatis_coord(int optidx, int req, boolean negated, char *opts, char *op)
}
static int
optfn_whatis_filter(int optidx, int req, boolean negated, char *opts, char *op)
optfn_whatis_filter(
int optidx, int req, boolean negated,
char *opts, char *op)
{
if (req == do_init) {
return optn_ok;
@@ -3632,7 +3669,9 @@ optfn_whatis_filter(int optidx, int req, boolean negated, char *opts, char *op)
}
static int
optfn_windowborders(int optidx, int req, boolean negated, char *opts, char *op)
optfn_windowborders(
int optidx, int req, boolean negated,
char *opts, char *op)
{
int retval = optn_ok;
@@ -3929,7 +3968,8 @@ pfxfn_font(int optidx, int req, boolean negated, char *opts, char *op)
return optn_err;
if (optidx == opt_font_map) {
Sprintf(opts, "%s", iflags.wc_font_map ? iflags.wc_font_map : defopt);
Sprintf(opts, "%s",
iflags.wc_font_map ? iflags.wc_font_map : defopt);
} else if (optidx == opt_font_message) {
Sprintf(opts, "%s",
iflags.wc_font_message ? iflags.wc_font_message : defopt);
@@ -4772,7 +4812,7 @@ handler_whatis_filter(void)
(gf == GFILTER_AREA)
? MENU_ITEMFLAGS_SELECTED : MENU_ITEMFLAGS_NONE);
end_menu(tmpwin,
"Select location filtering when going for next/previous map position:");
"Select location filtering when going for next/previous map position:");
if ((pick_cnt = select_menu(tmpwin, PICK_ONE, &window_pick)) > 0) {
iflags.getloc_filter = (window_pick[0].item.a_char - 1);
/* PICK_ONE doesn't unselect preselected entry when
@@ -7061,8 +7101,9 @@ static char n_currently_set[] = "(%d currently set)";
DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after show_menucontrols() */
static int
optfn_o_autopickup_exceptions(int optidx UNUSED, int req, boolean negated UNUSED,
char *opts, char *op UNUSED)
optfn_o_autopickup_exceptions(
int optidx UNUSED, int req, boolean negated UNUSED,
char *opts, char *op UNUSED)
{
if (req == do_init) {
return optn_ok;
@@ -7186,7 +7227,8 @@ get_option_value(const char *optname)
for (i = 0; allopt[i].name != 0; i++)
if (!strcmp(optname, allopt[i].name)) {
if (allopt[i].opttyp == BoolOpt && (bool_p = allopt[i].addr) != 0) {
if (allopt[i].opttyp == BoolOpt
&& (bool_p = allopt[i].addr) != 0) {
Sprintf(retbuf, "%s", *bool_p ? "true" : "false");
return retbuf;
} else if (allopt[i].opttyp == CompOpt && allopt[i].optfn) {
@@ -7212,8 +7254,8 @@ longest_option_name(int startpass, int endpass)
for (pass = 0; pass < 2; pass++)
for (i = 0; (name = allopt[i].name) != 0; i++) {
if (pass == 0 &&
(allopt[i].opttyp != BoolOpt || !allopt[i].addr))
if (pass == 0
&& (allopt[i].opttyp != BoolOpt || !allopt[i].addr))
continue;
optflags = allopt[i].setwhere;
if (optflags < startpass || optflags > endpass)
@@ -7382,7 +7424,8 @@ doset(void) /* changing options via menu by Per Liboriussen */
if (allopt[k].has_handler && allopt[k].optfn) {
reslt = (*allopt[k].optfn)(allopt[k].idx, do_handler,
FALSE, empty_optstr, empty_optstr);
FALSE, empty_optstr,
empty_optstr);
} else {
char abuf[BUFSZ];

View File

@@ -280,10 +280,10 @@ object_from_map(int glyph, int x, int y, struct obj **obj_p)
/* terrain mode views what's already known, doesn't learn new stuff */
&& !iflags.terrainmode) /* so don't set dknown when in terrain mode */
otmp->dknown = 1; /* if a pile, clearly see the top item only */
if (fakeobj && mtmp && mimic_obj &&
(otmp->dknown || (M_AP_FLAG(mtmp) & M_AP_F_DKNOWN))) {
mtmp->m_ap_type |= M_AP_F_DKNOWN;
otmp->dknown = 1;
if (fakeobj && mtmp && mimic_obj
&& (otmp->dknown || (M_AP_FLAG(mtmp) & M_AP_F_DKNOWN))) {
mtmp->m_ap_type |= M_AP_F_DKNOWN;
otmp->dknown = 1;
}
*obj_p = otmp;
return fakeobj; /* when True, caller needs to dealloc *obj_p */
@@ -459,8 +459,8 @@ lookat(int x, int y, char *buf, char *monbuf)
buf[0] = monbuf[0] = '\0';
glyph = glyph_at(x, y);
if (u.ux == x && u.uy == y && canspotself()
&& !(iflags.save_uswallow &&
glyph == mon_to_glyph(u.ustuck, rn2_on_display_rng))
&& !(iflags.save_uswallow
&& glyph == mon_to_glyph(u.ustuck, rn2_on_display_rng))
&& (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0)) {
/* fill in buf[] */
(void) self_lookat(buf);
@@ -1469,8 +1469,9 @@ do_look(int mode, coord *click_cc)
DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after do_supplemental_info() */
static void
look_all(boolean nearby, /* True => within BOLTLIM, False => entire map */
boolean do_mons) /* True => monsters, False => objects */
look_all(
boolean nearby, /* True => within BOLTLIM, False => entire map */
boolean do_mons) /* True => monsters, False => objects */
{
winid win;
int x, y, lo_x, lo_y, hi_x, hi_y, glyph, count = 0;

View File

@@ -266,7 +266,8 @@ change_sex(void)
} else if (u.umonnum == PM_AMOROUS_DEMON) {
flags.female = !flags.female;
#if 0
/* change monster type to match new sex; disabled with PM_AMOROUS_DEMON */
/* change monster type to match new sex; disabled with
PM_AMOROUS_DEMON */
u.umonnum = (u.umonnum == PM_SUCCUBUS) ? PM_INCUBUS : PM_SUCCUBUS;
#endif
@@ -832,12 +833,12 @@ polymon(int mntmp)
if (is_vampire(g.youmonst.data) || is_vampshifter(&g.youmonst))
pline(use_thec, monsterc, "change shape");
if (lays_eggs(g.youmonst.data) && flags.female &&
!(g.youmonst.data == &mons[PM_GIANT_EEL]
|| g.youmonst.data == &mons[PM_ELECTRIC_EEL]))
if (lays_eggs(g.youmonst.data) && flags.female
&& !(g.youmonst.data == &mons[PM_GIANT_EEL]
|| g.youmonst.data == &mons[PM_ELECTRIC_EEL]))
pline(use_thec, "sit",
eggs_in_water(g.youmonst.data) ?
"spawn in the water" : "lay an egg");
eggs_in_water(g.youmonst.data) ? "spawn in the water"
: "lay an egg");
}
/* you now know what an egg of your type looks like */
@@ -1517,7 +1518,8 @@ dogaze(void)
/* as if gazing at a sleeping anything is fruitful... */
You("turn to stone...");
g.killer.format = KILLED_BY;
Strcpy(g.killer.name, "deliberately meeting Medusa's gaze");
Strcpy(g.killer.name,
"deliberately meeting Medusa's gaze");
done(STONING);
}
}
@@ -1976,12 +1978,12 @@ polysense(void)
boolean
ugenocided(void)
{
return (boolean) ((g.mvitals[g.urole.malenum].mvflags & G_GENOD)
|| (g.urole.femalenum != NON_PM
&& (g.mvitals[g.urole.femalenum].mvflags & G_GENOD))
|| (g.mvitals[g.urace.malenum].mvflags & G_GENOD)
|| (g.urace.femalenum != NON_PM
&& (g.mvitals[g.urace.femalenum].mvflags & G_GENOD)));
return ((g.mvitals[g.urole.malenum].mvflags & G_GENOD)
|| (g.urole.femalenum != NON_PM
&& (g.mvitals[g.urole.femalenum].mvflags & G_GENOD))
|| (g.mvitals[g.urace.malenum].mvflags & G_GENOD)
|| (g.urace.femalenum != NON_PM
&& (g.mvitals[g.urace.femalenum].mvflags & G_GENOD)));
}
/* how hero feels "inside" after self-genocide of role or race */

View File

@@ -73,8 +73,8 @@ dosit(void)
obj = g.level.objects[u.ux][u.uy];
if (g.youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) {
You("coil up around your %shoard.",
(obj->quan + money_cnt(g.invent) < u.ulevel * 1000) ? "meager "
: "");
(obj->quan + money_cnt(g.invent) < u.ulevel * 1000)
? "meager " : "");
} else if (obj->otyp == TOWEL) {
pline("It's probably not a good time for a picnic...");
} else {
@@ -133,7 +133,8 @@ dosit(void)
(void) water_damage(uarm, "armor", TRUE);
} else if (IS_SINK(typ)) {
You(sit_message, defsyms[S_sink].explanation);
Your("%s gets wet.", humanoid(g.youmonst.data) ? "rump" : "underside");
Your("%s gets wet.",
humanoid(g.youmonst.data) ? "rump" : "underside");
} else if (IS_ALTAR(typ)) {
You(sit_message, defsyms[S_altar].explanation);
altar_wrath(u.ux, u.uy);
@@ -331,9 +332,9 @@ dosit(void)
pline("A splash tetra you are not.");
return 0;
}
if (Upolyd &&
(g.youmonst.data == &mons[PM_GIANT_EEL]
|| g.youmonst.data == &mons[PM_ELECTRIC_EEL])) {
if (Upolyd
&& (g.youmonst.data == &mons[PM_GIANT_EEL]
|| g.youmonst.data == &mons[PM_ELECTRIC_EEL])) {
You("yearn for the Sargasso Sea.");
return 0;
}

View File

@@ -1265,8 +1265,8 @@ trapeffect_slp_gas_trap(
} else {
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
if (!resists_sleep(mtmp) && !breathless(mtmp->data) && !mtmp->msleeping
&& mtmp->mcanmove) {
if (!resists_sleep(mtmp) && !breathless(mtmp->data)
&& !mtmp->msleeping && mtmp->mcanmove) {
if (sleep_monst(mtmp, rnd(25), -1) && in_sight) {
pline("%s suddenly falls asleep!", Monnam(mtmp));
seetrap(trap);
@@ -1698,7 +1698,7 @@ trapeffect_hole(
seetrap(trap);
if (tt == TRAPDOOR)
pline(
"A trap door opens, but %s doesn't fall through.",
"A trap door opens, but %s doesn't fall through.",
mon_nam(mtmp));
else /* (tt == HOLE) */
pline("%s doesn't fall through the hole.",
@@ -4637,8 +4637,8 @@ unsqueak_ok(struct obj* obj)
if (obj->otyp == CAN_OF_GREASE)
return GETOBJ_SUGGEST;
if (obj->otyp == POT_OIL && obj->dknown &&
objects[POT_OIL].oc_name_known)
if (obj->otyp == POT_OIL && obj->dknown
&& objects[POT_OIL].oc_name_known)
return GETOBJ_SUGGEST;
/* downplay all other potions, including unidentified oil

View File

@@ -283,7 +283,7 @@ comp_times(long filetime)
{
/* BUILD_TIME is constant but might have L suffix rather than UL;
'filetime' is historically signed but ought to have been unsigned */
return (boolean) ((unsigned long) filetime < (unsigned long) nomakedefs.build_time);
return ((unsigned long) filetime < (unsigned long) nomakedefs.build_time);
}
#endif
@@ -311,10 +311,10 @@ check_version(struct version_info *version_data, const char *filename,
#endif
|| ((utdflags & UTD_SKIP_SANITY1) == 0
&& version_data->entity_count != nomakedefs.version_sanity1)
|| ((utdflags & UTD_CHECKSIZES) &&
(version_data->struct_sizes1 != nomakedefs.version_sanity2))
|| ((utdflags & UTD_CHECKSIZES) &&
(version_data->struct_sizes2 != nomakedefs.version_sanity3))) {
|| ((utdflags & UTD_CHECKSIZES) != 0
&& version_data->struct_sizes1 != nomakedefs.version_sanity2)
|| ((utdflags & UTD_CHECKSIZES) != 0
&& version_data->struct_sizes2 != nomakedefs.version_sanity3)) {
if (complain)
pline("Configuration incompatibility for file \"%s\".", filename);
return FALSE;
@@ -381,11 +381,16 @@ store_version(NHFILE *nhfp)
0UL,0UL,0UL,0UL,0Ul
};
version_data.incarnation = nomakedefs.version_number; /* actual version number */
version_data.feature_set = nomakedefs.version_features; /* bitmask of config settings */
version_data.entity_count = nomakedefs.version_sanity1; /* # of monsters and objects */
version_data.struct_sizes1 = nomakedefs.version_sanity2; /* size of key structs */
version_data.struct_sizes2 = nomakedefs.version_sanity3; /* size of more key structs */
/* actual version number */
version_data.incarnation = nomakedefs.version_number;
/* bitmask of config settings */
version_data.feature_set = nomakedefs.version_features;
/* # of monsters and objects */
version_data.entity_count = nomakedefs.version_sanity1;
/* size of key structs */
version_data.struct_sizes1 = nomakedefs.version_sanity2;
/* size of more key structs */
version_data.struct_sizes2 = nomakedefs.version_sanity3;
if (nhfp->structlevel) {
bufoff(nhfp->fd);