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
+9 -9
View File
@@ -980,8 +980,8 @@ use_mirror(struct obj *obj)
if (vis) if (vis)
pline("%s confuses itself!", Monnam(mtmp)); pline("%s confuses itself!", Monnam(mtmp));
mtmp->mconf = 1; mtmp->mconf = 1;
} else if (monable && } else if (monable && (mlet == S_NYMPH
(mlet == S_NYMPH || mtmp->data == &mons[PM_AMOROUS_DEMON])) { || mtmp->data == &mons[PM_AMOROUS_DEMON])) {
if (vis) { if (vis) {
char buf[BUFSZ]; /* "She" or "He" */ char buf[BUFSZ]; /* "She" or "He" */
@@ -1546,8 +1546,8 @@ light_cocktail(struct obj **optr)
*optr = obj; *optr = obj;
} }
/* getobj callback for object to be rubbed - not selecting a secondary object to /* getobj callback for object to be rubbed - not selecting a secondary object
* rub on a gray stone or rub jelly on */ to rub on a gray stone or rub jelly on */
static int static int
rub_ok(struct obj *obj) rub_ok(struct obj *obj)
{ {
@@ -3630,12 +3630,12 @@ do_break_wand(struct obj *obj)
? (char *) 0 ? (char *) 0
: "Some holes are quickly filled with %s!"); : "Some holes are quickly filled with %s!");
fillmsg = TRUE; fillmsg = TRUE;
} else } else {
digactualhole(x, y, BY_OBJECT, (rn2(obj->spe) < 3 digactualhole(x, y, BY_OBJECT,
(rn2(obj->spe) < 3
|| (!Can_dig_down(&u.uz) || (!Can_dig_down(&u.uz)
&& !levl[x][y].candig)) && !levl[x][y].candig)) ? PIT : HOLE);
? PIT }
: HOLE);
} }
continue; continue;
} else if (obj->otyp == WAN_CREATE_MONSTER) { } else if (obj->otyp == WAN_CREATE_MONSTER) {
+15 -12
View File
@@ -28,8 +28,8 @@ static void openone(int, int, genericptr_t);
static int mfind0(struct monst *, boolean); static int mfind0(struct monst *, boolean);
static int reveal_terrain_getglyph(int, int, int, unsigned, int, int); 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 /* wildcard class for clear_stale_map - this used to be used as a getobj()
* but it's no longer used for that function */ input but it's no longer used for that function */
#define ALL_CLASSES (MAXOCLASSES + 1) #define ALL_CLASSES (MAXOCLASSES + 1)
/* bring hero out from underwater or underground or being engulfed; /* 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; boolean res = u.uinwater || u.uburied || u.uswallow;
/* bring Underwater, buried, or swallowed hero to normal map */ /* bring Underwater, buried, or swallowed hero to normal map;
iflags.save_uinwater = u.uinwater, u.uinwater = 0; /* bypass set_uinwater() */ bypass set_uinwater() */
iflags.save_uinwater = u.uinwater, u.uinwater = 0;
iflags.save_uburied = u.uburied, u.uburied = 0; iflags.save_uburied = u.uburied, u.uburied = 0;
iflags.save_uswallow = u.uswallow, u.uswallow = 0; iflags.save_uswallow = u.uswallow, u.uswallow = 0;
@@ -51,7 +52,8 @@ unconstrain_map(void)
static void static void
reconstrain_map(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.uburied = iflags.save_uburied, iflags.save_uburied = 0;
u.uswallow = iflags.save_uswallow, iflags.save_uswallow = 0; u.uswallow = iflags.save_uswallow, iflags.save_uswallow = 0;
} }
@@ -235,7 +237,7 @@ check_map_spot(int x, int y, char oclass, unsigned material)
if (glyph_is_object(glyph)) { if (glyph_is_object(glyph)) {
/* there's some object shown here */ /* there's some object shown here */
if (oclass == ALL_CLASSES) { if (oclass == ALL_CLASSES) {
return (boolean) !(g.level.objects[x][y] /* stale if nothing here */ return !(g.level.objects[x][y] /* stale if nothing here */
|| ((mtmp = m_at(x, y)) != 0 && mtmp->minvent)); || ((mtmp = m_at(x, y)) != 0 && mtmp->minvent));
} else { } else {
if (material if (material
@@ -1952,7 +1954,8 @@ dump_map(void)
{ {
int x, y, glyph, skippedrows, lastnonblank; int x, y, glyph, skippedrows, lastnonblank;
int subset = TER_MAP | TER_TRP | TER_OBJ | TER_MON; 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]; char buf[COLBUFSZ];
boolean blankrow, toprow; boolean blankrow, toprow;
@@ -2005,10 +2008,9 @@ dump_map(void)
/* idea from crawl; show known portion of map without any monsters, /* idea from crawl; show known portion of map without any monsters,
objects, or traps occluding the view of the underlying terrain */ objects, or traps occluding the view of the underlying terrain */
void void
reveal_terrain(int full, /* wizard|explore modes allow player reveal_terrain(
to request full map */ int full, /* wizard|explore modes allow player to request full map */
int which_subset) /* when not full, whether to suppress int which_subset) /* if not full, whether to suppress objs and/or traps */
objs and/or traps */
{ {
if ((Hallucination || Stunned || Confusion) && !full) { if ((Hallucination || Stunned || Confusion) && !full) {
You("are too disoriented for this."); You("are too disoriented for this.");
@@ -2023,7 +2025,8 @@ reveal_terrain(int full, /* wizard|explore modes allow player
if (unconstrain_map()) if (unconstrain_map())
docrt(); 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 (x = 1; x < COLNO; x++)
for (y = 0; y < ROWNO; y++) { for (y = 0; y < ROWNO; y++) {
+7 -5
View File
@@ -1742,7 +1742,8 @@ clear_glyph_buffer(void)
#ifndef UNBUFFERED_GLYPHINFO #ifndef UNBUFFERED_GLYPHINFO
nul_gbuf.gnew = (giptr->ttychar != nul_gbuf.glyphinfo.ttychar nul_gbuf.gnew = (giptr->ttychar != nul_gbuf.glyphinfo.ttychar
|| giptr->gm.color != nul_gbuf.glyphinfo.gm.color || 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) || giptr->gm.tileidx != nul_gbuf.glyphinfo.gm.tileidx)
#else #else
nul_gbuf.gnew = (giptr->glyphinfo.ttychar != ' ' nul_gbuf.gnew = (giptr->glyphinfo.ttychar != ' '
@@ -2029,12 +2030,13 @@ back_to_glyph(xchar x, xchar y)
static int static int
swallow_to_glyph(int mnum, int loc) 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) { if (loc < S_sw_tl || S_sw_br < loc) {
impossible("swallow_to_glyph: bad swallow location"); impossible("swallow_to_glyph: bad swallow location");
loc = S_sw_br; loc = S_sw_br;
} }
return ((int) (what_mon(mnum, rn2_on_display_rng) << 3) | return (m_3 | (loc - S_sw_tl)) + GLYPH_SWALLOW_OFF;
(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_levelchange called when the player has gone to a new level.
gm_symchange called if someone has interactively altered the symbols for gm_symchange called if someone has interactively altered the symbols
the game, most likely at the options menu. for the game, most likely at the options menu.
gm_optionchange The game settings have been toggled and some of them gm_optionchange The game settings have been toggled and some of them
are configured to trigger a reset_glyphmap() are configured to trigger a reset_glyphmap()
+15 -10
View File
@@ -370,8 +370,8 @@ gather_locs_interesting(int x, int y, int gloc)
/* unlike '/M', this skips monsters revealed by /* unlike '/M', this skips monsters revealed by
warning glyphs and remembered unseen ones */ warning glyphs and remembered unseen ones */
return (glyph_is_monster(glyph) return (glyph_is_monster(glyph)
&& glyph != monnum_to_glyph(PM_LONG_WORM_TAIL,MALE) && && 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, FEMALE));
case GLOC_OBJS: case GLOC_OBJS:
return (glyph_is_object(glyph) return (glyph_is_object(glyph)
&& glyph != objnum_to_glyph(BOULDER) && glyph != objnum_to_glyph(BOULDER)
@@ -1027,7 +1027,7 @@ new_mgivenname(struct monst *mon,
if (!mon->mextra) if (!mon->mextra)
mon->mextra = newmextra(); mon->mextra = newmextra();
else 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); MGIVENNAME(mon) = (char *) alloc((unsigned) lth);
} else { } else {
/* zero length: the new name is empty; get rid of the old name */ /* 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; int lth;
char buf[PL_PSIZ]; 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; lth = (name && *name) ? ((int) strlen(name) + 1) : 0;
if (lth > PL_PSIZ) { if (lth > PL_PSIZ) {
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 /* 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 static boolean
alreadynamed(struct monst *mtmp, char *monnambuf, char *usrbuf) 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 been moved off the hero's '@' yet, but there's no way to adjust
the help text once getpos() has started */ the help text once getpos() has started */
Sprintf(buf, "object on map (or '.' for one %s you)", 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) if (getpos(&cc, FALSE, buf) < 0 || cc.x <= 0)
return; return;
if (cc.x == u.ux && cc.y == u.uy) { if (cc.x == u.ux && cc.y == u.uy) {
@@ -1660,7 +1661,8 @@ static const char *const ghostnames[] = {
const char * const char *
rndghostname(void) 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 /* construct "<monnamtext> <verb> <othertext> {him|her|it}self" which might
be distorted by Hallu; if that's plural, adjust monnamtext and verb */ be distorted by Hallu; if that's plural, adjust monnamtext and verb */
char * char *
monverbself(struct monst *mon, monverbself(
struct monst *mon,
char *monnamtext, /* modifiable 'mbuf' with adequare room at end */ char *monnamtext, /* modifiable 'mbuf' with adequare room at end */
const char *verb, const char *othertext) const char *verb,
const char *othertext)
{ {
char *verbs, selfbuf[40]; /* sizeof "themselves" suffices */ 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' */ /* if hallucinating, return a random liquid instead of 'liquidpref' */
const char * 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) { if (Hallucination || !liquidpref || !*liquidpref) {
int indx, count = SIZE(hliquids); int indx, count = SIZE(hliquids);
+4 -4
View File
@@ -2927,7 +2927,7 @@ inaccessible_equipment(struct obj *obj,
return FALSE; 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 static int
equip_ok(struct obj *obj, boolean removing, boolean accessory) equip_ok(struct obj *obj, boolean removing, boolean accessory)
{ {
@@ -2937,7 +2937,7 @@ equip_ok(struct obj *obj, boolean removing, boolean accessory)
if (!obj) if (!obj)
return GETOBJ_EXCLUDE; 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); is_worn = ((obj->owornmask & (W_ARMOR | W_ACCESSORY)) != 0);
if (removing ^ is_worn) if (removing ^ is_worn)
return GETOBJ_EXCLUDE_INACCESS; return GETOBJ_EXCLUDE_INACCESS;
@@ -2956,8 +2956,8 @@ equip_ok(struct obj *obj, boolean removing, boolean accessory)
return GETOBJ_DOWNPLAY; return GETOBJ_DOWNPLAY;
/* armor we can't wear, e.g. from polyform */ /* armor we can't wear, e.g. from polyform */
if (obj->oclass == ARMOR_CLASS && !removing && if (obj->oclass == ARMOR_CLASS && !removing
!canwearobj(obj, &dummymask, FALSE)) && !canwearobj(obj, &dummymask, FALSE))
return GETOBJ_DOWNPLAY; return GETOBJ_DOWNPLAY;
/* Possible extension: downplay items (both accessories and armor) which /* Possible extension: downplay items (both accessories and armor) which
+22 -13
View File
@@ -197,7 +197,12 @@ static NHFILE *viable_nhfile(NHFILE *);
* "This%20is%20a%20%25%20test%21" * "This%20is%20a%20%25%20test%21"
*/ */
char * 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; char *sp, *op;
int cnt = 0; int cnt = 0;
@@ -364,8 +369,8 @@ validate_prefix_locations(char *reasonbuf)
if (!(details = strerror(errno))) if (!(details = strerror(errno)))
#endif #endif
details = ""; details = "";
Sprintf(panicbuf2, "\"%s\", (%d) %s", g.fqn_prefix[prefcnt], errno, Sprintf(panicbuf2, "\"%s\", (%d) %s",
details); g.fqn_prefix[prefcnt], errno, details);
paniclog(panicbuf1, panicbuf2); paniclog(panicbuf1, panicbuf2);
failcount++; failcount++;
} }
@@ -524,7 +529,8 @@ create_levelfile(int lev, char errbuf[])
/* Use O_TRUNC to force the file to be shortened if it already /* Use O_TRUNC to force the file to be shortened if it already
* exists and is currently longer. * 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 #else
#ifdef MAC #ifdef MAC
nhfp->fd = maccreat(fq_lock, LEVL_TYPE); nhfp->fd = maccreat(fq_lock, LEVL_TYPE);
@@ -536,7 +542,8 @@ create_levelfile(int lev, char errbuf[])
if (nhfp->fd >= 0) if (nhfp->fd >= 0)
g.level_info[lev].flags |= LFILE_EXISTS; g.level_info[lev].flags |= LFILE_EXISTS;
else if (errbuf) /* failure explanation */ 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); g.lock, lev, errno);
} }
nhfp = viable_nhfile(nhfp); nhfp = viable_nhfile(nhfp);
@@ -576,7 +583,8 @@ open_levelfile(int lev, char errbuf[])
settle for `lock' instead of `fq_lock' because the latter settle for `lock' instead of `fq_lock' because the latter
might end up being too big for nethack's BUFSZ */ might end up being too big for nethack's BUFSZ */
if (nhfp->fd < 0 && errbuf) 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); g.lock, lev, errno);
} }
nhfp = viable_nhfile(nhfp); nhfp = viable_nhfile(nhfp);
@@ -890,8 +898,7 @@ set_savefile_name(boolean regularize_it)
if (strlen(g.SAVEP) < (SAVESIZE - 1)) if (strlen(g.SAVEP) < (SAVESIZE - 1))
Strcpy(g.SAVEF, g.SAVEP); Strcpy(g.SAVEF, g.SAVEP);
if (strlen(g.SAVEF) < (SAVESIZE - 1)) if (strlen(g.SAVEF) < (SAVESIZE - 1))
(void) strncat(g.SAVEF, g.plname, (void) strncat(g.SAVEF, g.plname, (SAVESIZE - strlen(g.SAVEF)));
(SAVESIZE - strlen(g.SAVEF)));
#endif #endif
#if defined(MICRO) && !defined(VMS) && !defined(WIN32) && !defined(MSDOS) #if defined(MICRO) && !defined(VMS) && !defined(WIN32) && !defined(MSDOS)
if (strlen(g.SAVEP) < (SAVESIZE - 1)) if (strlen(g.SAVEP) < (SAVESIZE - 1))
@@ -1015,7 +1022,8 @@ create_savefile(void)
} }
if (nhfp->structlevel) { if (nhfp->structlevel) {
#if defined(MICRO) || defined(WIN32) #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 #else
#ifdef MAC #ifdef MAC
nhfp->fd = maccreat(fq_save, SAVE_TYPE); nhfp->fd = maccreat(fq_save, SAVE_TYPE);
@@ -1229,8 +1237,8 @@ get_saved_games(void)
fq_new_save = fqname(g.SAVEF, SAVEPREFIX, 0); fq_new_save = fqname(g.SAVEF, SAVEPREFIX, 0);
fq_old_save = fqname(files[i], SAVEPREFIX, 1); fq_old_save = fqname(files[i], SAVEPREFIX, 1);
if(strcmp(fq_old_save, fq_new_save) != 0 && if (strcmp(fq_old_save, fq_new_save) != 0
!file_exists(fq_new_save)) && !file_exists(fq_new_save))
rename(fq_old_save, fq_new_save); rename(fq_old_save, fq_new_save);
result[j++] = r; result[j++] = r;
@@ -2927,7 +2935,8 @@ config_erradd(const char *buf)
if (!g.program_state.config_error_ready) { if (!g.program_state.config_error_ready) {
/* either very early, where pline() will use raw_print(), or /* either very early, where pline() will use raw_print(), or
player gave bad value when prompted by interactive 'O' command */ 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(); wait_synch();
return; return;
} }
@@ -3445,7 +3454,7 @@ read_sym_file(int which_set)
clear_symsetentry(which_set, TRUE); clear_symsetentry(which_set, TRUE);
config_error_done(); 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) { if (g.symset[which_set].name) {
g.symset[which_set].explicitly = FALSE; g.symset[which_set].explicitly = FALSE;
return 0; return 0;
+2 -2
View File
@@ -82,8 +82,8 @@ door_into_nonjoined(xchar x, xchar y)
continue; continue;
/* Is this connecting to a room that doesn't want joining? */ /* Is this connecting to a room that doesn't want joining? */
if (levl[tx][ty].roomno >= ROOMOFFSET && if (levl[tx][ty].roomno >= ROOMOFFSET
!g.rooms[levl[tx][ty].roomno - ROOMOFFSET].needjoining) { && !g.rooms[levl[tx][ty].roomno - ROOMOFFSET].needjoining) {
return TRUE; return TRUE;
} }
} }
+69 -26
View File
@@ -538,7 +538,9 @@ optfn_align(int optidx, int req, boolean negated, char *opts, char *op)
static int 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) { if (req == do_init) {
return optn_ok; return optn_ok;
@@ -757,7 +759,9 @@ optfn_boulder(int optidx UNUSED, int req, boolean negated UNUSED,
} }
static int 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) { if (req == do_init) {
return optn_ok; return optn_ok;
@@ -1087,35 +1091,45 @@ optfn_font_message(int optidx, int req, boolean negated, char *opts, char *op)
} }
static int 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_ */ /* send them over to the prefix handling for font_ */
return pfxfn_font(optidx, req, negated, opts, op); return pfxfn_font(optidx, req, negated, opts, op);
} }
static int 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_ */ /* send them over to the prefix handling for font_ */
return pfxfn_font(optidx, req, negated, opts, op); return pfxfn_font(optidx, req, negated, opts, op);
} }
static int 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_ */ /* send them over to the prefix handling for font_ */
return pfxfn_font(optidx, req, negated, opts, op); return pfxfn_font(optidx, req, negated, opts, op);
} }
static int 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_ */ /* send them over to the prefix handling for font_ */
return pfxfn_font(optidx, req, negated, opts, op); return pfxfn_font(optidx, req, negated, opts, op);
} }
static int 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_ */ /* send them over to the prefix handling for font_ */
return pfxfn_font(optidx, req, negated, opts, op); return pfxfn_font(optidx, req, negated, opts, op);
@@ -1269,7 +1283,9 @@ optfn_hilite_status(int optidx UNUSED, int req, boolean negated,
} }
static int 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) { if (req == do_init) {
return optn_ok; return optn_ok;
@@ -1732,7 +1748,9 @@ optfn_monsters(int optidx UNUSED, int req, boolean negated UNUSED,
} }
static int 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; boolean compat;
@@ -2030,7 +2048,9 @@ optfn_packorder(int optidx UNUSED, int req, boolean negated UNUSED,
#ifdef CHANGE_COLOR #ifdef CHANGE_COLOR
static int 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 #ifndef WIN32
int cnt, tmp, reverse; int cnt, tmp, reverse;
@@ -2131,7 +2151,9 @@ optfn_palette(int optidx UNUSED, int req, boolean negated UNUSED, char *opts, ch
#endif /* CHANGE_COLOR */ #endif /* CHANGE_COLOR */
static int 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; int i;
@@ -2336,7 +2358,9 @@ optfn_pettype(int optidx, int req, boolean negated, char *opts, char *op)
} }
static int 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) { if (req == do_init) {
return optn_ok; return optn_ok;
@@ -2518,7 +2542,9 @@ optfn_pile_limit(int optidx, int req, boolean negated, char *opts, char *op)
} }
static int 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) { if (req == do_init) {
return optn_ok; 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 (req == get_val) {
if (!opts) if (!opts)
return optn_err; 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;
} }
return optn_ok; return optn_ok;
@@ -2813,7 +2840,9 @@ optfn_scores(int optidx, int req, boolean negated, char *opts, char *op)
} }
static int 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) { if (req == do_init) {
return optn_ok; return optn_ok;
@@ -2844,7 +2873,9 @@ optfn_scroll_amount(int optidx, int req, boolean negated, char *opts, char *op)
} }
static int 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) { if (req == do_init) {
return optn_ok; return optn_ok;
@@ -2874,7 +2905,9 @@ optfn_scroll_margin(int optidx, int req, boolean negated, char *opts, char *op)
} }
static int 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) { if (req == do_init) {
flags.discosort = 'o'; flags.discosort = 'o';
@@ -3340,7 +3373,9 @@ optfn_traps(int optidx UNUSED, int req, boolean negated UNUSED,
} }
static int 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) { if (req == do_init) {
return optn_ok; return optn_ok;
@@ -3583,7 +3618,9 @@ optfn_whatis_coord(int optidx, int req, boolean negated, char *opts, char *op)
} }
static int 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) { if (req == do_init) {
return optn_ok; return optn_ok;
@@ -3632,7 +3669,9 @@ optfn_whatis_filter(int optidx, int req, boolean negated, char *opts, char *op)
} }
static int 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; int retval = optn_ok;
@@ -3929,7 +3968,8 @@ pfxfn_font(int optidx, int req, boolean negated, char *opts, char *op)
return optn_err; return optn_err;
if (optidx == opt_font_map) { 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) { } else if (optidx == opt_font_message) {
Sprintf(opts, "%s", Sprintf(opts, "%s",
iflags.wc_font_message ? iflags.wc_font_message : defopt); iflags.wc_font_message ? iflags.wc_font_message : defopt);
@@ -7061,7 +7101,8 @@ static char n_currently_set[] = "(%d currently set)";
DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after show_menucontrols() */ DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after show_menucontrols() */
static int static int
optfn_o_autopickup_exceptions(int optidx UNUSED, int req, boolean negated UNUSED, optfn_o_autopickup_exceptions(
int optidx UNUSED, int req, boolean negated UNUSED,
char *opts, char *op UNUSED) char *opts, char *op UNUSED)
{ {
if (req == do_init) { if (req == do_init) {
@@ -7186,7 +7227,8 @@ get_option_value(const char *optname)
for (i = 0; allopt[i].name != 0; i++) for (i = 0; allopt[i].name != 0; i++)
if (!strcmp(optname, allopt[i].name)) { 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"); Sprintf(retbuf, "%s", *bool_p ? "true" : "false");
return retbuf; return retbuf;
} else if (allopt[i].opttyp == CompOpt && allopt[i].optfn) { } 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 (pass = 0; pass < 2; pass++)
for (i = 0; (name = allopt[i].name) != 0; i++) { for (i = 0; (name = allopt[i].name) != 0; i++) {
if (pass == 0 && if (pass == 0
(allopt[i].opttyp != BoolOpt || !allopt[i].addr)) && (allopt[i].opttyp != BoolOpt || !allopt[i].addr))
continue; continue;
optflags = allopt[i].setwhere; optflags = allopt[i].setwhere;
if (optflags < startpass || optflags > endpass) 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) { if (allopt[k].has_handler && allopt[k].optfn) {
reslt = (*allopt[k].optfn)(allopt[k].idx, do_handler, reslt = (*allopt[k].optfn)(allopt[k].idx, do_handler,
FALSE, empty_optstr, empty_optstr); FALSE, empty_optstr,
empty_optstr);
} else { } else {
char abuf[BUFSZ]; char abuf[BUFSZ];
+6 -5
View File
@@ -280,8 +280,8 @@ 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 */ /* terrain mode views what's already known, doesn't learn new stuff */
&& !iflags.terrainmode) /* so don't set dknown when in terrain mode */ && !iflags.terrainmode) /* so don't set dknown when in terrain mode */
otmp->dknown = 1; /* if a pile, clearly see the top item only */ otmp->dknown = 1; /* if a pile, clearly see the top item only */
if (fakeobj && mtmp && mimic_obj && if (fakeobj && mtmp && mimic_obj
(otmp->dknown || (M_AP_FLAG(mtmp) & M_AP_F_DKNOWN))) { && (otmp->dknown || (M_AP_FLAG(mtmp) & M_AP_F_DKNOWN))) {
mtmp->m_ap_type |= M_AP_F_DKNOWN; mtmp->m_ap_type |= M_AP_F_DKNOWN;
otmp->dknown = 1; otmp->dknown = 1;
} }
@@ -459,8 +459,8 @@ lookat(int x, int y, char *buf, char *monbuf)
buf[0] = monbuf[0] = '\0'; buf[0] = monbuf[0] = '\0';
glyph = glyph_at(x, y); glyph = glyph_at(x, y);
if (u.ux == x && u.uy == y && canspotself() if (u.ux == x && u.uy == y && canspotself()
&& !(iflags.save_uswallow && && !(iflags.save_uswallow
glyph == mon_to_glyph(u.ustuck, rn2_on_display_rng)) && glyph == mon_to_glyph(u.ustuck, rn2_on_display_rng))
&& (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0)) { && (!iflags.terrainmode || (iflags.terrainmode & TER_MON) != 0)) {
/* fill in buf[] */ /* fill in buf[] */
(void) self_lookat(buf); (void) self_lookat(buf);
@@ -1469,7 +1469,8 @@ do_look(int mode, coord *click_cc)
DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after do_supplemental_info() */ DISABLE_WARNING_FORMAT_NONLITERAL /* RESTORE is after do_supplemental_info() */
static void static void
look_all(boolean nearby, /* True => within BOLTLIM, False => entire map */ look_all(
boolean nearby, /* True => within BOLTLIM, False => entire map */
boolean do_mons) /* True => monsters, False => objects */ boolean do_mons) /* True => monsters, False => objects */
{ {
winid win; winid win;
+9 -7
View File
@@ -266,7 +266,8 @@ change_sex(void)
} else if (u.umonnum == PM_AMOROUS_DEMON) { } else if (u.umonnum == PM_AMOROUS_DEMON) {
flags.female = !flags.female; flags.female = !flags.female;
#if 0 #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; u.umonnum = (u.umonnum == PM_SUCCUBUS) ? PM_INCUBUS : PM_SUCCUBUS;
#endif #endif
@@ -832,12 +833,12 @@ polymon(int mntmp)
if (is_vampire(g.youmonst.data) || is_vampshifter(&g.youmonst)) if (is_vampire(g.youmonst.data) || is_vampshifter(&g.youmonst))
pline(use_thec, monsterc, "change shape"); pline(use_thec, monsterc, "change shape");
if (lays_eggs(g.youmonst.data) && flags.female && if (lays_eggs(g.youmonst.data) && flags.female
!(g.youmonst.data == &mons[PM_GIANT_EEL] && !(g.youmonst.data == &mons[PM_GIANT_EEL]
|| g.youmonst.data == &mons[PM_ELECTRIC_EEL])) || g.youmonst.data == &mons[PM_ELECTRIC_EEL]))
pline(use_thec, "sit", pline(use_thec, "sit",
eggs_in_water(g.youmonst.data) ? eggs_in_water(g.youmonst.data) ? "spawn in the water"
"spawn in the water" : "lay an egg"); : "lay an egg");
} }
/* you now know what an egg of your type looks like */ /* 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... */ /* as if gazing at a sleeping anything is fruitful... */
You("turn to stone..."); You("turn to stone...");
g.killer.format = KILLED_BY; 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); done(STONING);
} }
} }
@@ -1976,7 +1978,7 @@ polysense(void)
boolean boolean
ugenocided(void) ugenocided(void)
{ {
return (boolean) ((g.mvitals[g.urole.malenum].mvflags & G_GENOD) return ((g.mvitals[g.urole.malenum].mvflags & G_GENOD)
|| (g.urole.femalenum != NON_PM || (g.urole.femalenum != NON_PM
&& (g.mvitals[g.urole.femalenum].mvflags & G_GENOD)) && (g.mvitals[g.urole.femalenum].mvflags & G_GENOD))
|| (g.mvitals[g.urace.malenum].mvflags & G_GENOD) || (g.mvitals[g.urace.malenum].mvflags & G_GENOD)
+6 -5
View File
@@ -73,8 +73,8 @@ dosit(void)
obj = g.level.objects[u.ux][u.uy]; obj = g.level.objects[u.ux][u.uy];
if (g.youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) { if (g.youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) {
You("coil up around your %shoard.", 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) { } else if (obj->otyp == TOWEL) {
pline("It's probably not a good time for a picnic..."); pline("It's probably not a good time for a picnic...");
} else { } else {
@@ -133,7 +133,8 @@ dosit(void)
(void) water_damage(uarm, "armor", TRUE); (void) water_damage(uarm, "armor", TRUE);
} else if (IS_SINK(typ)) { } else if (IS_SINK(typ)) {
You(sit_message, defsyms[S_sink].explanation); 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)) { } else if (IS_ALTAR(typ)) {
You(sit_message, defsyms[S_altar].explanation); You(sit_message, defsyms[S_altar].explanation);
altar_wrath(u.ux, u.uy); altar_wrath(u.ux, u.uy);
@@ -331,8 +332,8 @@ dosit(void)
pline("A splash tetra you are not."); pline("A splash tetra you are not.");
return 0; return 0;
} }
if (Upolyd && if (Upolyd
(g.youmonst.data == &mons[PM_GIANT_EEL] && (g.youmonst.data == &mons[PM_GIANT_EEL]
|| g.youmonst.data == &mons[PM_ELECTRIC_EEL])) { || g.youmonst.data == &mons[PM_ELECTRIC_EEL])) {
You("yearn for the Sargasso Sea."); You("yearn for the Sargasso Sea.");
return 0; return 0;
+4 -4
View File
@@ -1265,8 +1265,8 @@ trapeffect_slp_gas_trap(
} else { } else {
boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed); boolean in_sight = canseemon(mtmp) || (mtmp == u.usteed);
if (!resists_sleep(mtmp) && !breathless(mtmp->data) && !mtmp->msleeping if (!resists_sleep(mtmp) && !breathless(mtmp->data)
&& mtmp->mcanmove) { && !mtmp->msleeping && mtmp->mcanmove) {
if (sleep_monst(mtmp, rnd(25), -1) && in_sight) { if (sleep_monst(mtmp, rnd(25), -1) && in_sight) {
pline("%s suddenly falls asleep!", Monnam(mtmp)); pline("%s suddenly falls asleep!", Monnam(mtmp));
seetrap(trap); seetrap(trap);
@@ -4637,8 +4637,8 @@ unsqueak_ok(struct obj* obj)
if (obj->otyp == CAN_OF_GREASE) if (obj->otyp == CAN_OF_GREASE)
return GETOBJ_SUGGEST; return GETOBJ_SUGGEST;
if (obj->otyp == POT_OIL && obj->dknown && if (obj->otyp == POT_OIL && obj->dknown
objects[POT_OIL].oc_name_known) && objects[POT_OIL].oc_name_known)
return GETOBJ_SUGGEST; return GETOBJ_SUGGEST;
/* downplay all other potions, including unidentified oil /* downplay all other potions, including unidentified oil
+15 -10
View File
@@ -283,7 +283,7 @@ comp_times(long filetime)
{ {
/* BUILD_TIME is constant but might have L suffix rather than UL; /* BUILD_TIME is constant but might have L suffix rather than UL;
'filetime' is historically signed but ought to have been unsigned */ '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 #endif
@@ -311,10 +311,10 @@ check_version(struct version_info *version_data, const char *filename,
#endif #endif
|| ((utdflags & UTD_SKIP_SANITY1) == 0 || ((utdflags & UTD_SKIP_SANITY1) == 0
&& version_data->entity_count != nomakedefs.version_sanity1) && version_data->entity_count != nomakedefs.version_sanity1)
|| ((utdflags & UTD_CHECKSIZES) && || ((utdflags & UTD_CHECKSIZES) != 0
(version_data->struct_sizes1 != nomakedefs.version_sanity2)) && version_data->struct_sizes1 != nomakedefs.version_sanity2)
|| ((utdflags & UTD_CHECKSIZES) && || ((utdflags & UTD_CHECKSIZES) != 0
(version_data->struct_sizes2 != nomakedefs.version_sanity3))) { && version_data->struct_sizes2 != nomakedefs.version_sanity3)) {
if (complain) if (complain)
pline("Configuration incompatibility for file \"%s\".", filename); pline("Configuration incompatibility for file \"%s\".", filename);
return FALSE; return FALSE;
@@ -381,11 +381,16 @@ store_version(NHFILE *nhfp)
0UL,0UL,0UL,0UL,0Ul 0UL,0UL,0UL,0UL,0Ul
}; };
version_data.incarnation = nomakedefs.version_number; /* actual version number */ /* actual version number */
version_data.feature_set = nomakedefs.version_features; /* bitmask of config settings */ version_data.incarnation = nomakedefs.version_number;
version_data.entity_count = nomakedefs.version_sanity1; /* # of monsters and objects */ /* bitmask of config settings */
version_data.struct_sizes1 = nomakedefs.version_sanity2; /* size of key structs */ version_data.feature_set = nomakedefs.version_features;
version_data.struct_sizes2 = nomakedefs.version_sanity3; /* size of more key structs */ /* # 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) { if (nhfp->structlevel) {
bufoff(nhfp->fd); bufoff(nhfp->fd);