formatting: src/a*.c - d*.c continuation lines

Mostly && and || at end of the first half of a continued line rather
than at the start of the second half.  The automated reformat got
confused by comments in the midst of such lines.
  foo ||
  bar
was converted to
  foo
  || bar
but
  foo ||
  /* comment */
  bar
stayed as is.

Some excluded code [#if 0] was also manually reformatted, but this is
mainly stuff that can be found via regexp '[&|?:][ \t]*$' (with a lot
of false hits for labels whose colon ends their line).
This commit is contained in:
PatR
2015-10-19 17:32:21 -07:00
parent 2c20805b16
commit 3986546325
12 changed files with 272 additions and 270 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 apply.c $NHDT-Date: 1445126424 2015/10/18 00:00:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.206 $ */
/* NetHack 3.6 apply.c $NHDT-Date: 1445301113 2015/10/20 00:31:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.207 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -916,9 +916,9 @@ struct obj *obj;
} else if (!Blind) {
if (mtmp->minvis && !See_invisible)
;
else if ((mtmp->minvis && !perceives(mtmp->data)) ||
else if ((mtmp->minvis && !perceives(mtmp->data))
/* redundant: can't get here if these are true */
!haseyes(mtmp->data) || notonhead || !mtmp->mcansee)
|| !haseyes(mtmp->data) || notonhead || !mtmp->mcansee)
pline("%s doesn't seem to notice %s reflection.", Monnam(mtmp),
mhis(mtmp));
else
@@ -956,9 +956,9 @@ struct obj **optr;
#ifdef AMIGA
amii_speaker(obj, "ahdhgqeqdhehaqdqfhgw", AMII_MUFFLED_VOLUME);
#endif
if (obj->cursed && !rn2(4) &&
if (obj->cursed && !rn2(4)
/* note: once any of them are gone, we stop all of them */
!(mvitals[PM_WOOD_NYMPH].mvflags & G_GONE)
&& !(mvitals[PM_WOOD_NYMPH].mvflags & G_GONE)
&& !(mvitals[PM_WATER_NYMPH].mvflags & G_GONE)
&& !(mvitals[PM_MOUNTAIN_NYMPH].mvflags & G_GONE)
&& (mtmp = makemon(mkclass(S_NYMPH, 0), u.ux, u.uy, NO_MINVENT))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 artifact.c $NHDT-Date: 1439605077 2015/08/15 02:17:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.92 $ */
/* NetHack 3.6 artifact.c $NHDT-Date: 1445301116 2015/10/20 00:31:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.95 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -151,9 +151,9 @@ aligntyp alignment; /* target alignment, or A_NONE */
/* we're looking for an alignment-specific item
suitable for hero's role+race */
if ((a->alignment == alignment || a->alignment == A_NONE) &&
if ((a->alignment == alignment || a->alignment == A_NONE)
/* avoid enemies' equipment */
(a->race == NON_PM || !race_hostile(&mons[a->race]))) {
&& (a->race == NON_PM || !race_hostile(&mons[a->race]))) {
/* when a role-specific first choice is available, use it */
if (Role_if(a->role)) {
/* make this be the only possibility in the list */
@@ -1165,9 +1165,9 @@ int dieroll; /* needed for Magicbane and vorpal blades */
return FALSE;
}
realizes_damage = (youdefend || vis ||
realizes_damage = (youdefend || vis
/* feel the effect even if not seen */
(youattack && mdef == u.ustuck));
|| (youattack && mdef == u.ustuck));
/* the four basic attacks: fire, cold, shock and missiles */
if (attacks(AD_FIRE, otmp)) {
@@ -1944,11 +1944,11 @@ boolean drop_untouchable;
boolean beingworn, carryeffect, invoked;
long wearmask = ~(W_QUIVER | (u.twoweap ? 0L : W_SWAPWEP) | W_BALL);
beingworn = (obj->owornmask & wearmask) != 0L ||
/* some items in use don't have any wornmask setting */
(obj->oclass == TOOL_CLASS
&& (obj->lamplit || (obj->otyp == LEASH && obj->leashmon)
|| (Is_container(obj) && Has_contents(obj))));
beingworn = ((obj->owornmask & wearmask) != 0L
/* some items in use don't have any wornmask setting */
|| (obj->oclass == TOOL_CLASS
&& (obj->lamplit || (obj->otyp == LEASH && obj->leashmon)
|| (Is_container(obj) && Has_contents(obj)))));
if ((art = get_artifact(obj)) != 0) {
carryeffect = (art->cary.adtyp || art->cspfx);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 ball.c $NHDT-Date: 1432512770 2015/05/25 00:12:50 $ $NHDT-Branch: master $:$NHDT-Revision: 1.26 $ */
/* NetHack 3.6 ball.c $NHDT-Date: 1445301116 2015/10/20 00:31:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -592,11 +592,11 @@ drag:
return FALSE;
}
if ((is_pool(uchain->ox, uchain->oy) &&
if ((is_pool(uchain->ox, uchain->oy)
/* water not mere continuation of previous water */
(levl[uchain->ox][uchain->oy].typ == POOL
|| !is_pool(uball->ox, uball->oy)
|| levl[uball->ox][uball->oy].typ == POOL))
&& (levl[uchain->ox][uchain->oy].typ == POOL
|| !is_pool(uball->ox, uball->oy)
|| levl[uball->ox][uball->oy].typ == POOL))
|| ((t = t_at(uchain->ox, uchain->oy))
&& (t->ttyp == PIT || t->ttyp == SPIKED_PIT || t->ttyp == HOLE
|| t->ttyp == TRAPDOOR))) {

239
src/cmd.c
View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 cmd.c $NHDT-Date: 1436753509 2015/07/13 02:11:49 $ $NHDT-Branch: master $:$NHDT-Revision: 1.197 $ */
/* NetHack 3.6 cmd.c $NHDT-Date: 1445301117 2015/10/20 00:31:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.202 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1041,14 +1041,12 @@ wiz_levltyp_legend(VOID_ARGS)
for (i = 0; i < last / 2; ++i)
for (j = i; j < last; j += last / 2) {
dsc = levltyp[j];
c = !*dsc ? ' ' : !strncmp(dsc, "unreachable", 11)
? '*'
:
/* same int-to-char conversion as
wiz_map_levltyp() */
(j < 10) ? '0' + j : (j < 36)
? 'a' + j - 10
: 'A' + j - 36;
c = !*dsc ? ' '
: !strncmp(dsc, "unreachable", 11) ? '*'
/* same int-to-char conversion as wiz_map_levltyp() */
: (j < 10) ? '0' + j
: (j < 36) ? 'a' + j - 10
: 'A' + j - 36;
Sprintf(eos(buf), fmt, c, dsc);
if (j > i) {
putstr(win, 0, buf);
@@ -1426,19 +1424,18 @@ int final;
you_are(buf, "");
/* report alignment (bypass you_are() in order to omit ending period) */
Sprintf(
buf, " %s%s%s, %son a mission for %s", You_, !final ? are : were,
align_str(u.ualign.type),
/* helm of opposite alignment (might hide conversion) */
(u.ualign.type != u.ualignbase[A_CURRENT]) ? "temporarily " :
/* permanent conversion */
(u.ualign.type != u.ualignbase[A_ORIGINAL])
? "now "
:
/* atheist (ignored in very early game); lastly, normal case
*/
(!u.uconduct.gnostic && moves > 1000L) ? "nominally " : "",
u_gname());
Sprintf(buf, " %s%s%s, %son a mission for %s",
You_, !final ? are : were,
align_str(u.ualign.type),
/* helm of opposite alignment (might hide conversion) */
(u.ualign.type != u.ualignbase[A_CURRENT]) ? "temporarily "
/* permanent conversion */
: (u.ualign.type != u.ualignbase[A_ORIGINAL]) ? "now "
/* atheist (ignored in very early game) */
: (!u.uconduct.gnostic && moves > 1000L) ? "nominally "
/* lastly, normal case */
: "",
u_gname());
putstr(en_win, 0, buf);
/* show the rest of this game's pantheon (finishes previous sentence)
[appending "also Moloch" at the end would allow for straightforward
@@ -2075,12 +2072,11 @@ int final;
if (Flying)
enl_msg(You_, "would fly", "would have flown",
Levitation
? "if you weren't levitating"
: (save_BFly == FROMOUTSIDE)
? if_surroundings_permitted
:
/* both surroundings and [latent] levitation */
" if circumstances permitted",
? "if you weren't levitating"
: (save_BFly == FROMOUTSIDE)
? if_surroundings_permitted
/* both surroundings and [latent] levitation */
: " if circumstances permitted",
"");
BFlying = save_BFly;
}
@@ -2307,100 +2303,105 @@ STATIC_DCL boolean NDECL(minimal_enlightenment);
STATIC_OVL boolean
minimal_enlightenment()
{
winid tmpwin;
menu_item *selected;
anything any;
int genidx, n;
char buf[BUFSZ], buf2[BUFSZ];
static const char untabbed_fmtstr[] = "%-15s: %-12s";
static const char untabbed_deity_fmtstr[] = "%-17s%s";
static const char tabbed_fmtstr[] = "%s:\t%-12s";
static const char tabbed_deity_fmtstr[] = "%s\t%s";
static const char *fmtstr;
static const char *deity_fmtstr;
winid tmpwin;
menu_item *selected;
anything any;
int genidx, n;
char buf[BUFSZ], buf2[BUFSZ];
static const char untabbed_fmtstr[] = "%-15s: %-12s";
static const char untabbed_deity_fmtstr[] = "%-17s%s";
static const char tabbed_fmtstr[] = "%s:\t%-12s";
static const char tabbed_deity_fmtstr[] = "%s\t%s";
static const char *fmtstr;
static const char *deity_fmtstr;
fmtstr = iflags.menu_tab_sep ? tabbed_fmtstr : untabbed_fmtstr;
deity_fmtstr = iflags.menu_tab_sep ?
tabbed_deity_fmtstr : untabbed_deity_fmtstr;
any = zeroany;
buf[0] = buf2[0] = '\0';
tmpwin = create_nhwindow(NHW_MENU);
start_menu(tmpwin);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, "Starting", FALSE);
fmtstr = iflags.menu_tab_sep ? tabbed_fmtstr : untabbed_fmtstr;
deity_fmtstr = iflags.menu_tab_sep ? tabbed_deity_fmtstr
: untabbed_deity_fmtstr;
any = zeroany;
buf[0] = buf2[0] = '\0';
tmpwin = create_nhwindow(NHW_MENU);
start_menu(tmpwin);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Starting", FALSE);
/* Starting name, race, role, gender */
Sprintf(buf, fmtstr, "name", plname);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf, fmtstr, "race", urace.noun);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf, fmtstr, "role",
(flags.initgend && urole.name.f) ? urole.name.f : urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf, fmtstr, "gender", genders[flags.initgend].adj);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
/* Starting name, race, role, gender */
Sprintf(buf, fmtstr, "name", plname);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf, fmtstr, "race", urace.noun);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf, fmtstr, "role",
(flags.initgend && urole.name.f) ? urole.name.f : urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf, fmtstr, "gender", genders[flags.initgend].adj);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
/* Starting alignment */
Sprintf(buf, fmtstr, "alignment", align_str(u.ualignbase[A_ORIGINAL]));
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
/* Starting alignment */
Sprintf(buf, fmtstr, "alignment", align_str(u.ualignbase[A_ORIGINAL]));
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
/* Current name, race, role, gender */
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, "Current", FALSE);
Sprintf(buf, fmtstr, "race", Upolyd ? youmonst.data->mname : urace.noun);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
if (Upolyd) {
Sprintf(buf, fmtstr, "role (base)",
(u.mfemale && urole.name.f) ? urole.name.f : urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
} else {
Sprintf(buf, fmtstr, "role",
(flags.female && urole.name.f) ? urole.name.f : urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
}
/* don't want poly_gender() here; it forces `2' for non-humanoids */
genidx = is_neuter(youmonst.data) ? 2 : flags.female;
Sprintf(buf, fmtstr, "gender", genders[genidx].adj);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
if (Upolyd && (int)u.mfemale != genidx) {
Sprintf(buf, fmtstr, "gender (base)", genders[u.mfemale].adj);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
}
/* Current name, race, role, gender */
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Current", FALSE);
Sprintf(buf, fmtstr, "race", Upolyd ? youmonst.data->mname : urace.noun);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
if (Upolyd) {
Sprintf(buf, fmtstr, "role (base)",
(u.mfemale && urole.name.f) ? urole.name.f
: urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
} else {
Sprintf(buf, fmtstr, "role",
(flags.female && urole.name.f) ? urole.name.f
: urole.name.m);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
}
/* don't want poly_gender() here; it forces `2' for non-humanoids */
genidx = is_neuter(youmonst.data) ? 2 : flags.female;
Sprintf(buf, fmtstr, "gender", genders[genidx].adj);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
if (Upolyd && (int)u.mfemale != genidx) {
Sprintf(buf, fmtstr, "gender (base)", genders[u.mfemale].adj);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
}
/* Current alignment */
Sprintf(buf, fmtstr, "alignment", align_str(u.ualign.type));
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
/* Current alignment */
Sprintf(buf, fmtstr, "alignment", align_str(u.ualign.type));
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
/* Deity list */
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings, "Deities", FALSE);
Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC),
(u.ualignbase[A_ORIGINAL] == u.ualign.type
&& u.ualign.type == A_CHAOTIC) ? " (s,c)" :
(u.ualignbase[A_ORIGINAL] == A_CHAOTIC) ? " (s)" :
(u.ualign.type == A_CHAOTIC) ? " (c)" : "");
Sprintf(buf, fmtstr, "Chaotic", buf2);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
/* Deity list */
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, "", FALSE);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
"Deities", FALSE);
Sprintf(buf2, deity_fmtstr, align_gname(A_CHAOTIC),
(u.ualignbase[A_ORIGINAL] == u.ualign.type
&& u.ualign.type == A_CHAOTIC) ? " (s,c)"
: (u.ualignbase[A_ORIGINAL] == A_CHAOTIC) ? " (s)"
: (u.ualign.type == A_CHAOTIC) ? " (c)" : "");
Sprintf(buf, fmtstr, "Chaotic", buf2);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL),
(u.ualignbase[A_ORIGINAL] == u.ualign.type
&& u.ualign.type == A_NEUTRAL) ? " (s,c)" :
(u.ualignbase[A_ORIGINAL] == A_NEUTRAL) ? " (s)" :
(u.ualign.type == A_NEUTRAL) ? " (c)" : "");
Sprintf(buf, fmtstr, "Neutral", buf2);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf2, deity_fmtstr, align_gname(A_NEUTRAL),
(u.ualignbase[A_ORIGINAL] == u.ualign.type
&& u.ualign.type == A_NEUTRAL) ? " (s,c)"
: (u.ualignbase[A_ORIGINAL] == A_NEUTRAL) ? " (s)"
: (u.ualign.type == A_NEUTRAL) ? " (c)" : "");
Sprintf(buf, fmtstr, "Neutral", buf2);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL),
(u.ualignbase[A_ORIGINAL] == u.ualign.type &&
u.ualign.type == A_LAWFUL) ? " (s,c)" :
(u.ualignbase[A_ORIGINAL] == A_LAWFUL) ? " (s)" :
(u.ualign.type == A_LAWFUL) ? " (c)" : "");
Sprintf(buf, fmtstr, "Lawful", buf2);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
Sprintf(buf2, deity_fmtstr, align_gname(A_LAWFUL),
(u.ualignbase[A_ORIGINAL] == u.ualign.type
&& u.ualign.type == A_LAWFUL) ? " (s,c)"
: (u.ualignbase[A_ORIGINAL] == A_LAWFUL) ? " (s)"
: (u.ualign.type == A_LAWFUL) ? " (c)" : "");
Sprintf(buf, fmtstr, "Lawful", buf2);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, buf, FALSE);
end_menu(tmpwin, "Base Attributes");
n = select_menu(tmpwin, PICK_NONE, &selected);
destroy_nhwindow(tmpwin);
return (n != -1);
end_menu(tmpwin, "Base Attributes");
n = select_menu(tmpwin, PICK_NONE, &selected);
destroy_nhwindow(tmpwin);
return (boolean) (n != -1);
}
#endif /*0*/
@@ -3266,11 +3267,11 @@ register char *cmd;
case '-':
if (!Cmd.num_pad)
break; /* else FALLTHRU */
/* Effects of movement commands and invisible monsters:
* m: always move onto space (even if 'I' remembered)
* F: always attack space (even if 'I' not remembered)
* normal movement: attack if 'I', move otherwise
*/
/* Effects of movement commands and invisible monsters:
* m: always move onto space (even if 'I' remembered)
* F: always attack space (even if 'I' not remembered)
* normal movement: attack if 'I', move otherwise.
*/
case 'F':
if (movecmd(cmd[1])) {
context.forcefight = 1;
@@ -3319,7 +3320,7 @@ register char *cmd;
do_rush = TRUE;
break;
}
/*FALLTHRU*/
/*FALLTHRU*/
default:
if (movecmd(*cmd)) { /* ordinary movement */
context.run = 0; /* only matters here if it was 8 */

127
src/dig.c
View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dig.c $NHDT-Date: 1432512771 2015/05/25 00:12:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.95 $ */
/* NetHack 3.6 dig.c $NHDT-Date: 1445301118 2015/10/20 00:31:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.97 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -228,10 +228,10 @@ int x, y;
if (verbose)
There("isn't enough room to %s here.", verb);
return (FALSE);
} else if (madeby == BY_OBJECT &&
} else if (madeby == BY_OBJECT
/* the block against existing traps is mainly to
prevent broken wands from turning holes into pits */
(ttmp || is_pool_or_lava(x, y))) {
&& (ttmp || is_pool_or_lava(x, y))) {
/* digging by player handles pools separately */
return FALSE;
}
@@ -452,8 +452,8 @@ dig(VOID_ARGS)
switch (rn2(2)) {
case 0:
mtmp =
makemon(&mons[PM_EARTH_ELEMENTAL], dpx, dpy, NO_MM_FLAGS);
mtmp = makemon(&mons[PM_EARTH_ELEMENTAL], dpx, dpy,
NO_MM_FLAGS);
break;
default:
mtmp = makemon(&mons[PM_XORN], dpx, dpy, NO_MM_FLAGS);
@@ -1162,11 +1162,11 @@ struct obj *obj;
/* might escape trap and still be teetering at brink */
if (!u.utrap)
cant_reach_floor(u.ux, u.uy, FALSE, TRUE);
} else if (!ispick &&
} else if (!ispick
/* can only dig down with an axe when doing so will
trigger or disarm a trap here */
(!trap
|| (trap->ttyp != LANDMINE && trap->ttyp != BEAR_TRAP))) {
&& (!trap || (trap->ttyp != LANDMINE
&& trap->ttyp != BEAR_TRAP))) {
pline("%s merely scratches the %s.", Yobjnam2(obj, (char *) 0),
surface(u.ux, u.uy));
u_wipe_engr(3);
@@ -1999,20 +1999,20 @@ void
bury_monst(mtmp)
struct monst *mtmp;
{
debugpline1("bury_monst: %s", mon_nam(mtmp));
if(canseemon(mtmp)) {
if(is_flyer(mtmp->data) || is_floater(mtmp->data)) {
pline_The("%s opens up, but %s is not swallowed!",
surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
return;
} else
pline_The("%s opens up and swallows %s!",
surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
}
debugpline1("bury_monst: %s", mon_nam(mtmp));
if (canseemon(mtmp)) {
if (is_flyer(mtmp->data) || is_floater(mtmp->data)) {
pline_The("%s opens up, but %s is not swallowed!",
surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
return;
} else
pline_The("%s opens up and swallows %s!",
surface(mtmp->mx, mtmp->my), mon_nam(mtmp));
}
mtmp->mburied = TRUE;
wakeup(mtmp); /* at least give it a chance :-) */
newsym(mtmp->mx, mtmp->my);
mtmp->mburied = TRUE;
wakeup(mtmp); /* at least give it a chance :-) */
newsym(mtmp->mx, mtmp->my);
}
void
@@ -2020,14 +2020,15 @@ bury_you()
{
debugpline0("bury_you");
if (!Levitation && !Flying) {
if(u.uswallow)
if (u.uswallow)
You_feel("a sensation like falling into a trap!");
else
pline_The("%s opens beneath you and you fall in!",
surface(u.ux, u.uy));
surface(u.ux, u.uy));
u.uburied = TRUE;
if(!Strangled && !Breathless) Strangled = 6;
if (!Strangled && !Breathless)
Strangled = 6;
under_ground(1);
}
}
@@ -2035,61 +2036,63 @@ bury_you()
void
unearth_you()
{
debugpline0("unearth_you");
u.uburied = FALSE;
under_ground(0);
if(!uamul || uamul->otyp != AMULET_OF_STRANGULATION)
Strangled = 0;
vision_recalc(0);
debugpline0("unearth_you");
u.uburied = FALSE;
under_ground(0);
if (!uamul || uamul->otyp != AMULET_OF_STRANGULATION)
Strangled = 0;
vision_recalc(0);
}
void
escape_tomb()
{
debugpline0("escape_tomb");
if ((Teleportation || can_teleport(youmonst.data)) &&
(Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell.");
(void) dotele(); /* calls unearth_you() */
} else if(u.uburied) { /* still buried after 'port attempt */
boolean good;
debugpline0("escape_tomb");
if ((Teleportation || can_teleport(youmonst.data))
&& (Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell.");
(void) dotele(); /* calls unearth_you() */
} else if (u.uburied) { /* still buried after 'port attempt */
boolean good;
if(amorphous(youmonst.data) || Passes_walls ||
noncorporeal(youmonst.data) ||
(unsolid(youmonst.data) &&
youmonst.data != &mons[PM_WATER_ELEMENTAL]) ||
(tunnels(youmonst.data) && !needspick(youmonst.data))) {
if (amorphous(youmonst.data) || Passes_walls
|| noncorporeal(youmonst.data)
|| (unsolid(youmonst.data)
&& youmonst.data != &mons[PM_WATER_ELEMENTAL])
|| (tunnels(youmonst.data) && !needspick(youmonst.data))) {
You("%s up through the %s.",
(tunnels(youmonst.data) && !needspick(youmonst.data))
? "try to tunnel"
: (amorphous(youmonst.data))
? "ooze"
: "phase",
surface(u.ux, u.uy));
You("%s up through the %s.",
(tunnels(youmonst.data) && !needspick(youmonst.data)) ?
"try to tunnel" : (amorphous(youmonst.data)) ?
"ooze" : "phase", surface(u.ux, u.uy));
if(tunnels(youmonst.data) && !needspick(youmonst.data))
good = dighole(TRUE, FALSE, (coord *)0);
else good = TRUE;
if(good) unearth_you();
}
}
good = (tunnels(youmonst.data) && !needspick(youmonst.data))
? dighole(TRUE, FALSE, (coord *)0) : TRUE;
if (good)
unearth_you();
}
}
}
void
bury_obj(otmp)
struct obj *otmp;
{
debugpline0("bury_obj");
if (cansee(otmp->ox, otmp->oy))
pline_The("objects on the %s tumble into a hole!",
surface(otmp->ox, otmp->oy));
debugpline0("bury_obj");
if(cansee(otmp->ox, otmp->oy))
pline_The("objects on the %s tumble into a hole!",
surface(otmp->ox, otmp->oy));
bury_objs(otmp->ox, otmp->oy);
bury_objs(otmp->ox, otmp->oy);
}
#endif
#endif /*0*/
#ifdef DEBUG
int wiz_debug_cmd_bury() /* in this case, bury everything at your loc and
around */
/* bury everything at your loc and around */
int
wiz_debug_cmd_bury()
{
int x, y;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 display.c $NHDT-Date: 1434450195 2015/06/16 10:23:15 $ $NHDT-Branch: master $:$NHDT-Revision: 1.64 $ */
/* NetHack 3.6 display.c $NHDT-Date: 1445301119 2015/10/20 00:31:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.76 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1741,8 +1741,8 @@ xchar x, y;
if (lev->typ == CORR && idx == S_litcorr)
idx = S_corr;
else if (idx == S_room)
idx = (flags.dark_room && iflags.use_color) ?
(DARKROOMSYM) : S_stone;
idx = (flags.dark_room && iflags.use_color)
? DARKROOMSYM : S_stone;
}
if (idx != S_room)
@@ -2195,19 +2195,19 @@ struct rm *lev;
break;
case WM_T_BL:
#if 0 /* older method, fixed */
if (only(seenv, SV4|SV5)) {
col = T_tlcorn;
} else if ((seenv & (SV0|SV1|SV2)) &&
only(seenv, SV0|SV1|SV2|SV6|SV7)) {
col = T_hwall;
} else if (seenv & SV3 ||
((seenv & (SV0|SV1|SV2)) && (seenv & (SV4|SV5)))) {
col = T_tdwall;
} else {
if (seenv != SV6)
t_warn(lev);
col = T_stone;
}
if (only(seenv, SV4|SV5)) {
col = T_tlcorn;
} else if ((seenv & (SV0|SV1|SV2))
&& only(seenv, SV0|SV1|SV2|SV6|SV7)) {
col = T_hwall;
} else if ((seenv & SV3)
|| ((seenv & (SV0|SV1|SV2)) && (seenv & (SV4|SV5)))) {
col = T_tdwall;
} else {
if (seenv != SV6)
t_warn(lev);
col = T_stone;
}
#endif /* 0 */
if (only(seenv, SV4 | SV5))
col = T_tlcorn;
@@ -2221,19 +2221,19 @@ struct rm *lev;
break;
case WM_T_BR:
#if 0 /* older method, fixed */
if (only(seenv, SV5|SV6)) {
col = T_trcorn;
} else if ((seenv & (SV0|SV1|SV2)) &&
only(seenv, SV0|SV1|SV2|SV3|SV4)) {
col = T_hwall;
} else if (seenv & SV7 ||
((seenv & (SV0|SV1|SV2)) && (seenv & (SV5|SV6)))) {
col = T_tdwall;
} else {
if (seenv != SV4)
t_warn(lev);
col = T_stone;
}
if (only(seenv, SV5|SV6)) {
col = T_trcorn;
} else if ((seenv & (SV0|SV1|SV2))
&& only(seenv, SV0|SV1|SV2|SV3|SV4)) {
col = T_hwall;
} else if ((seenv & SV7)
|| ((seenv & (SV0|SV1|SV2)) && (seenv & (SV5|SV6)))) {
col = T_tdwall;
} else {
if (seenv != SV4)
t_warn(lev);
col = T_stone;
}
#endif /* 0 */
if (only(seenv, SV5 | SV6))
col = T_trcorn;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_wear.c $NHDT-Date: 1438652304 2015/08/04 01:38:24 $ $NHDT-Branch: master $:$NHDT-Revision: 1.84 $ */
/* NetHack 3.6 do_wear.c $NHDT-Date: 1445301119 2015/10/20 00:31:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.86 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -220,11 +220,11 @@ Boots_off(VOID_ARGS)
break;
case WATER_WALKING_BOOTS:
/* check for lava since fireproofed boots make it viable */
if ((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy)) && !Levitation
&& !Flying && !is_clinger(youmonst.data)
&& !context.takeoff.cancelled_don &&
if ((is_pool(u.ux, u.uy) || is_lava(u.ux, u.uy))
&& !Levitation && !Flying && !is_clinger(youmonst.data)
&& !context.takeoff.cancelled_don
/* avoid recursive call to lava_effects() */
!iflags.in_lava_effects) {
&& !iflags.in_lava_effects) {
/* make boots known in case you survive the drowning */
makeknown(otyp);
spoteffects(TRUE);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dog.c $NHDT-Date: 1432512767 2015/05/25 00:12:47 $ $NHDT-Branch: master $:$NHDT-Revision: 1.49 $ */
/* NetHack 3.6 dog.c $NHDT-Date: 1445301120 2015/10/20 00:32:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.51 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -592,11 +592,11 @@ boolean pets_only; /* true for ascension or final escape */
mtmp->mfrozen = 0;
mtmp->mcanmove = 1;
}
if (((monnear(mtmp, u.ux, u.uy) && levl_follower(mtmp)) ||
if (((monnear(mtmp, u.ux, u.uy) && levl_follower(mtmp))
/* the wiz will level t-port from anywhere to chase
the amulet; if you don't have it, will chase you
only if in range. -3. */
(u.uhave.amulet && mtmp->iswiz))
|| (u.uhave.amulet && mtmp->iswiz))
&& ((!mtmp->msleeping && mtmp->mcanmove)
/* eg if level teleport or new trap, steed has no control
to avoid following */
@@ -911,9 +911,9 @@ register struct obj *obj;
return FALSE;
}
if (mtmp->mtame || !mtmp->mcanmove ||
if (mtmp->mtame || !mtmp->mcanmove
/* monsters with conflicting structures cannot be tamed */
mtmp->isshk || mtmp->isgd || mtmp->ispriest || mtmp->isminion
|| mtmp->isshk || mtmp->isgd || mtmp->ispriest || mtmp->isminion
|| is_covetous(mtmp->data) || is_human(mtmp->data)
|| (is_demon(mtmp->data) && !is_demon(youmonst.data))
|| (obj && dogfood(mtmp, obj) >= MANFOOD))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dogmove.c $NHDT-Date: 1432512765 2015/05/25 00:12:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.52 $ */
/* NetHack 3.6 dogmove.c $NHDT-Date: 1445301121 2015/10/20 00:32:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.55 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -427,9 +427,9 @@ int udist;
) {
int edible = dogfood(mtmp, obj);
if ((edible <= CADAVER ||
if ((edible <= CADAVER
/* starving pet is more aggressive about eating */
(edog->mhpmax_penalty && edible == ACCFOOD))
|| (edog->mhpmax_penalty && edible == ACCFOOD))
&& could_reach_item(mtmp, obj->ox, obj->oy))
return dog_eat(mtmp, obj, omx, omy, FALSE);
@@ -700,11 +700,11 @@ register int after; /* this is extra fast monster movement */
}
}
#if 0 /* [this is now handled in dochug()] */
if (!Conflict && !mtmp->mconf &&
mtmp == u.ustuck && !sticks(youmonst.data)) {
unstuck(mtmp); /* swallowed case handled above */
You("get released!");
}
if (!Conflict && !mtmp->mconf
&& mtmp == u.ustuck && !sticks(youmonst.data)) {
unstuck(mtmp); /* swallowed case handled above */
You("get released!");
}
#endif
if (!nohands(mtmp->data) && !verysmall(mtmp->data)) {
allowflags |= OPENDOOR;
@@ -784,9 +784,9 @@ register int after; /* this is extra fast monster movement */
if ((mstatus & MM_HIT) && !(mstatus & MM_DEF_DIED) && rn2(4)
&& mtmp2->mlstmv != monstermoves
&& !onscary(mtmp->mx, mtmp->my, mtmp2) &&
&& !onscary(mtmp->mx, mtmp->my, mtmp2)
/* monnear check needed: long worms hit on tail */
monnear(mtmp2, mtmp->mx, mtmp->my)) {
&& monnear(mtmp2, mtmp->mx, mtmp->my)) {
mstatus = mattackm(mtmp2, mtmp); /* return attack */
if (mstatus & MM_DEF_DIED)
return 2;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dokick.c $NHDT-Date: 1432512765 2015/05/25 00:12:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.99 $ */
/* NetHack 3.6 dokick.c $NHDT-Date: 1445301122 2015/10/20 00:32:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.101 $ */
/* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -912,10 +912,10 @@ dokick()
was there before the kick */
if (glyph != oldglyph && glyph_is_invisible(glyph))
show_glyph(x, y, oldglyph);
} else if (!canspotmon(mtmp) &&
} else if (!canspotmon(mtmp)
/* check <x,y>; monster that evades kick by jumping
to an unseen square doesn't leave an I behind */
mtmp->mx == x && mtmp->my == y
&& mtmp->mx == x && mtmp->my == y
&& !glyph_is_invisible(glyph)
&& !(u.uswallow && mtmp == u.ustuck)) {
map_invisible(x, y);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dothrow.c $NHDT-Date: 1445215018 2015/10/19 00:36:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.110 $ */
/* NetHack 3.6 dothrow.c $NHDT-Date: 1445301122 2015/10/20 00:32:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.111 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -850,13 +850,11 @@ boolean hitsroof;
int blindinc;
/* need to check for blindness result prior to destroying obj */
blindinc =
(otyp == CREAM_PIE || otyp == BLINDING_VENOM) &&
blindinc = ((otyp == CREAM_PIE || otyp == BLINDING_VENOM)
/* AT_WEAP is ok here even if attack type was AT_SPIT */
can_blnd(&youmonst, &youmonst, AT_WEAP, obj)
? rnd(25)
: 0;
&& can_blnd(&youmonst, &youmonst, AT_WEAP, obj))
? rnd(25)
: 0;
breakmsg(obj, !Blind);
breakobj(obj, u.ux, u.uy, TRUE, TRUE);
obj = 0; /* it's now gone */
@@ -949,12 +947,12 @@ STATIC_OVL boolean
throwing_weapon(obj)
struct obj *obj;
{
return (is_missile(obj) || is_spear(obj) ||
/* daggers and knife (excludes scalpel) */
(is_blade(obj) && !is_sword(obj)
&& (objects[obj->otyp].oc_dir & PIERCE)) ||
/* special cases [might want to add AXE] */
obj->otyp == WAR_HAMMER || obj->otyp == AKLYS);
return (boolean) (is_missile(obj) || is_spear(obj)
/* daggers and knife (excludes scalpel) */
|| (is_blade(obj) && !is_sword(obj)
&& (objects[obj->otyp].oc_dir & PIERCE))
/* special cases [might want to add AXE] */
|| obj->otyp == WAR_HAMMER || obj->otyp == AKLYS);
}
/* the currently thrown object is returning to you (not for boomerangs) */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dungeon.c $NHDT-Date: 1436753511 2015/07/13 02:11:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.61 $ */
/* NetHack 3.6 dungeon.c $NHDT-Date: 1445301123 2015/10/20 00:32:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.65 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1607,10 +1607,10 @@ const char *nam;
if ((slev = find_level(nam)) != 0) {
dlev = slev->dlevel;
idx = ledger_no(&dlev);
if ((dlev.dnum == u.uz.dnum ||
if ((dlev.dnum == u.uz.dnum
/* within same branch, or else main dungeon <-> gehennom */
(u.uz.dnum == valley_level.dnum
&& dlev.dnum == medusa_level.dnum)
|| (u.uz.dnum == valley_level.dnum
&& dlev.dnum == medusa_level.dnum)
|| (u.uz.dnum == medusa_level.dnum
&& dlev.dnum == valley_level.dnum))
&& (/* either wizard mode or else seen and not forgotten */