more src reformatting

Fixing up mis-indented block comments, but hit some files that hadn't
had the earlier mixture of tab replacement, etc, so it's bigger than I
expected.  If I get to it, they'll be another round of this tomorrow.
This commit is contained in:
PatR
2015-11-06 03:14:50 -08:00
parent 102e427ca7
commit 915dd89270
14 changed files with 811 additions and 752 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 apply.c $NHDT-Date: 1446369459 2015/11/01 09:17:39 $ $NHDT-Branch: master $:$NHDT-Revision: 1.208 $ */
/* NetHack 3.6 apply.c $NHDT-Date: 1446808436 2015/11/06 11:13:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.210 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1471,7 +1471,7 @@ boolean showmsg;
return TRUE;
}
int jumping_is_magic;
static int jumping_is_magic;
void
display_jump_positions(state)
@@ -1481,6 +1481,7 @@ int state;
tmp_at(DISP_BEAM, cmap_to_glyph(S_goodpos));
} else if (state == 1) {
int x, y, dx, dy;
for (dx = -4; dx <= 4; dx++)
for (dy = -4; dy <= 4; dy++) {
x = dx + (int) u.ux;
@@ -1508,8 +1509,7 @@ int magic; /* 0=Physical, otherwise skill level */
} else if (!magic && !Jumping) {
You_cant("jump very far.");
return 0;
/* if steed is immobile, can't do physical jump but can do spell one
*/
/* if steed is immobile, can't do physical jump but can do spell one */
} else if (!magic && u.usteed && stucksteed(FALSE)) {
/* stucksteed gave "<steed> won't move" message */
return 0;
@@ -1587,7 +1587,8 @@ int magic; /* 0=Physical, otherwise skill level */
if (u.utrap)
switch (u.utraptype) {
case TT_BEARTRAP: {
register long side = rn2(3) ? LEFT_SIDE : RIGHT_SIDE;
long side = rn2(3) ? LEFT_SIDE : RIGHT_SIDE;
You("rip yourself free of the bear trap! Ouch!");
losehp(Maybe_Half_Phys(rnd(10)), "jumping out of a bear trap",
KILLED_BY);
@@ -2718,7 +2719,7 @@ coord *pos;
int min_range, max_range;
{
struct monst *mtmp;
struct monst *selmon = NULL;
struct monst *selmon = (struct monst *) 0;
for (mtmp = fmon; mtmp; mtmp = mtmp->nmon)
if (mtmp && !DEADMONSTER(mtmp) && !mtmp->mtame
@@ -3164,7 +3165,7 @@ struct obj *obj;
/* we want this before the explosion instead of at the very end */
pline("A wall of force smashes down around you!");
dmg = d(1 + obj->spe, 6); /* normally 2d12 */
/*FALLTHRU*/
/*FALLTHRU*/
case WAN_CANCELLATION:
case WAN_POLYMORPH:
case WAN_TELEPORTATION:

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 ball.c $NHDT-Date: 1445301116 2015/10/20 00:31:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.27 $ */
/* NetHack 3.6 ball.c $NHDT-Date: 1446808438 2015/11/06 11:13:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.28 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -56,10 +56,10 @@ ballfall()
* To make this work, we have to mess with the hero's mind. The rules for
* ball&chain are:
*
* 1. If the hero can see them, fine.
* 2. If the hero can't see either, it isn't seen.
* 3. If either is felt it is seen.
* 4. If either is felt and moved, it disappears.
* 1. If the hero can see them, fine.
* 2. If the hero can't see either, it isn't seen.
* 3. If either is felt it is seen.
* 4. If either is felt and moved, it disappears.
*
* If the hero can see, then when a move is done, the ball and chain are
* first picked up, the positions under them are corrected, then they
@@ -77,12 +77,12 @@ ballfall()
/*
* from you.h
* int u.bglyph glyph under the ball
* int u.cglyph glyph under the chain
* int u.bc_felt mask for ball/chain being felt
* #define BC_BALL 0x01 bit mask in u.bc_felt for ball
* #define BC_CHAIN 0x02 bit mask in u.bc_felt for chain
* int u.bc_order ball & chain order
* int u.bglyph glyph under the ball
* int u.cglyph glyph under the chain
* int u.bc_felt mask for ball/chain being felt
* #define BC_BALL 0x01 bit mask in u.bc_felt for ball
* #define BC_CHAIN 0x02 bit mask in u.bc_felt for chain
* int u.bc_order ball & chain order
*
* u.bc_felt is also manipulated in display.c and read.c, the others only
* in this file. None of these variables are valid unless the player is
@@ -479,7 +479,7 @@ boolean allow_drag;
&& !already_in_rock) {
if (allow_drag) {
/* Avoid pathological case *if* not teleporting:
* 0 0_
* 0 0_
* _X move northeast -----> X@
* @
*/
@@ -487,9 +487,9 @@ boolean allow_drag;
&& dist2(x, y, tempx, tempy) == 1)
SKIP_TO_DRAG;
/* Avoid pathological case *if* not teleporting:
* 0 0
* 0 0
* _X move east -----> X_
* @ @
* @ @
*/
if (dist2(u.ux, u.uy, uball->ox, uball->oy) == 4
&& dist2(x, y, tempx, tempy) == 2)
@@ -694,8 +694,9 @@ drop_ball(x, y)
xchar x, y;
{
if (Blind) {
u.bc_order = bc_order(); /* get the order */
/* pick up glyph */
/* get the order */
u.bc_order = bc_order();
/* pick up glyph */
u.bglyph = (u.bc_order) ? u.cglyph : levl[x][y].glyph;
}
@@ -796,14 +797,13 @@ drag_down()
uchar dragchance = 3;
/*
* Assume that the ball falls forward if:
* Assume that the ball falls forward if:
*
* a) the character is wielding it, or
* b) the character has both hands available to hold it (i.e. is
* not wielding any weapon), or
* c) (perhaps) it falls forward out of his non-weapon hand
* a) the character is wielding it, or
* b) the character has both hands available to hold it (i.e. is
* not wielding any weapon), or
* c) (perhaps) it falls forward out of his non-weapon hand
*/
forward = carried(uball) && (uwep == uball || !uwep || !rn2(3));
if (carried(uball))

View File

@@ -1,10 +1,10 @@
/* NetHack 3.6 display.c $NHDT-Date: 1445301119 2015/10/20 00:31:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.76 $ */
/* NetHack 3.6 display.c $NHDT-Date: 1446808439 2015/11/06 11:13:59 $ $NHDT-Branch: master $:$NHDT-Revision: 1.77 $ */
/* Copyright (c) Dean Luick, with acknowledgements to Kevin Darcy */
/* and Dave Cohrs, 1990. */
/* and Dave Cohrs, 1990. */
/* NetHack may be freely redistributed. See license for details. */
/*
* THE NEW DISPLAY CODE
* THE NEW DISPLAY CODE
*
* The old display code has been broken up into three parts: vision, display,
* and drawing. Vision decides what locations can and cannot be physically
@@ -30,15 +30,15 @@
*
* Display rules:
*
* If the location is in sight, display in order:
* visible (or sensed) monsters
* visible objects
* known traps
* background
* If the location is in sight, display in order:
* visible (or sensed) monsters
* visible objects
* known traps
* background
*
* If the location is out of sight, display in order:
* sensed monsters (telepathy)
* memory
* If the location is out of sight, display in order:
* sensed monsters (telepathy)
* memory
*
*
*
@@ -97,24 +97,23 @@
*
* Parts of the rm structure that are used:
*
* typ - What is really there.
* glyph - What the hero remembers. This will never be a monster.
* Monsters "float" above this.
* lit - True if the position is lit. An optimization for
* lit/unlit rooms.
* waslit - True if the position was *remembered* as lit.
* seenv - A vector of bits representing the directions from which the
* hero has seen this position. The vector's primary use is
* determining how walls are seen. E.g. a wall sometimes looks
* like stone on one side, but is seen as a wall from the
*other.
* Other uses are for unmapping detected objects and felt
* locations, where we need to know if the hero has ever
* seen the location.
* flags - Additional information for the typ field. Different for
* each typ.
* horizontal - Indicates whether the wall or door is horizontal or
* vertical.
* typ - What is really there.
* glyph - What the hero remembers. This will never be a monster.
* Monsters "float" above this.
* lit - True if the position is lit. An optimization for
* lit/unlit rooms.
* waslit - True if the position was *remembered* as lit.
* seenv - A vector of bits representing the directions from which the
* hero has seen this position. The vector's primary use is
* determining how walls are seen. E.g. a wall sometimes looks
* like stone on one side, but is seen as wall from the other.
* Other uses are for unmapping detected objects and felt
* locations, where we need to know if the hero has ever
* seen the location.
* flags - Additional information for the typ field. Different for
* each typ.
* horizontal - Indicates whether the wall or door is horizontal or
* vertical.
*/
#include "hack.h"
@@ -180,7 +179,7 @@ int show;
* The routines map_background(), map_object(), and map_trap() could just
* as easily be:
*
* map_glyph(x,y,glyph,show)
* map_glyph(x,y,glyph,show)
*
* Which is called with the xx_to_glyph() in the call. Then I can get
* rid of 3 routines that don't do very much anyway. And then stop
@@ -360,13 +359,13 @@ STATIC_OVL void
display_monster(x, y, mon, sightflags, worm_tail)
register xchar x, y; /* display position */
register struct monst *mon; /* monster to display */
int sightflags; /* 1 if the monster is physically seen */
/* 2 if detected using Detect_monsters */
register xchar worm_tail; /* mon is actually a worm tail */
int sightflags; /* 1 if the monster is physically seen;
2 if detected using Detect_monsters */
xchar worm_tail; /* mon is actually a worm tail */
{
register boolean mon_mimic = (mon->m_ap_type != M_AP_NOTHING);
register int sensed =
mon_mimic && (Protection_from_shape_changers || sensemon(mon));
boolean mon_mimic = (mon->m_ap_type != M_AP_NOTHING);
int sensed = (mon_mimic && (Protection_from_shape_changers
|| sensemon(mon)));
/*
* We must do the mimic check first. If the mimic is mimicing something,
* and the location is in sight, we have to change the hero's memory
@@ -405,8 +404,9 @@ register xchar worm_tail; /* mon is actually a worm tail */
}
case M_AP_OBJECT: {
struct obj obj; /* Make a fake object to send */
/* to map_object(). */
/* Make a fake object to send to map_object(). */
struct obj obj;
obj = zeroobj;
obj.ox = x;
obj.oy = y;
@@ -520,8 +520,8 @@ xchar x, y;
if (Underwater && !Is_waterlevel(&u.uz) && !is_pool(x, y))
return;
/* Set the seen vector as if the hero had seen it. It doesn't matter */
/* if the hero is levitating or not. */
/* Set the seen vector as if the hero had seen it.
It doesn't matter if the hero is levitating or not. */
set_seenv(lev, u.ux, u.uy, x, y);
if (!can_reach_floor(FALSE)) {
@@ -534,11 +534,11 @@ xchar x, y;
*
* Check (and display) in order:
*
* + Stone, walls, and closed doors.
* + Boulders. [see a boulder before a doorway]
* + Doors.
* + Room/water positions
* + Everything else (hallways!)
* + Stone, walls, and closed doors.
* + Boulders. [see a boulder before a doorway]
* + Doors.
* + Room/water positions
* + Everything else (hallways!)
*/
if (IS_ROCK(lev->typ)
|| (IS_DOOR(lev->typ)
@@ -578,7 +578,8 @@ xchar x, y;
if (lev->typ != ROOM && lev->seenv) {
map_background(x, y, 1);
} else {
lev->glyph = (flags.dark_room && iflags.use_color && !Is_rogue_level(&u.uz))
lev->glyph = (flags.dark_room && iflags.use_color
&& !Is_rogue_level(&u.uz))
? cmap_to_glyph(S_darkroom)
: (lev->waslit ? cmap_to_glyph(S_room)
: cmap_to_glyph(S_stone));
@@ -587,7 +588,8 @@ xchar x, y;
} else if ((lev->glyph >= cmap_to_glyph(S_stone)
&& lev->glyph < cmap_to_glyph(S_darkroom))
|| glyph_is_invisible(levl[x][y].glyph)) {
lev->glyph = (flags.dark_room && iflags.use_color && !Is_rogue_level(&u.uz))
lev->glyph = (flags.dark_room && iflags.use_color
&& !Is_rogue_level(&u.uz))
? cmap_to_glyph(S_darkroom)
: (lev->waslit ? cmap_to_glyph(S_room)
: cmap_to_glyph(S_stone));
@@ -597,7 +599,7 @@ xchar x, y;
/* We feel it (I think hallways are the only things left). */
map_background(x, y, 1);
/* Corridors are never felt as lit (unless remembered that way) */
/* (lit_corridor only). */
/* (lit_corridor only). */
if (lev->typ == CORR && lev->glyph == cmap_to_glyph(S_litcorr)
&& !lev->waslit)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
@@ -697,7 +699,7 @@ register int x, y;
/*
* Don't use templit here: E.g.
*
* lev->waslit = !!(lev->lit || templit(x,y));
* lev->waslit = !!(lev->lit || templit(x,y));
*
* Otherwise we have the "light pool" problem, where non-permanently
* lit areas just out of sight stay remembered as lit. They should
@@ -749,30 +751,30 @@ register int x, y;
display_monster(x, y, mon,
see_it ? PHYSICALLY_SEEN : DETECTED,
worm_tail);
} else if (mon && mon_warning(mon) && !is_worm_tail(mon))
} else if (mon && mon_warning(mon) && !is_worm_tail(mon)) {
display_warning(mon);
else if (glyph_is_invisible(levl[x][y].glyph))
} else if (glyph_is_invisible(levl[x][y].glyph)) {
map_invisible(x, y);
else
_map_location(x, y, 1); /* map the location */
} else
_map_location(x, y, 1); /* map the location */\
}
}
/* Can't see the location. */
else {
} else {
if (x == u.ux && y == u.uy) {
feel_location(u.ux, u.uy); /* forces an update */
if (canspotself())
display_self();
} else if ((mon = m_at(x, y))
&& ((see_it =
(tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)
|| (see_with_infrared(mon) && mon_visible(mon))))
&& ((see_it = (tp_sensemon(mon) || MATCH_WARN_OF_MON(mon)
|| (see_with_infrared(mon)
&& mon_visible(mon))))
|| Detect_monsters)) {
/* Monsters are printed every time. */
/* This also gets rid of any invisibility glyph */
display_monster(x, y, mon, see_it ? 0 : DETECTED, is_worm_tail(mon) ? TRUE : FALSE);
display_monster(x, y, mon, see_it ? 0 : DETECTED,
is_worm_tail(mon) ? TRUE : FALSE);
} else if ((mon = m_at(x, y)) && mon_warning(mon)
&& !is_worm_tail(mon)) {
display_warning(mon);
@@ -782,20 +784,20 @@ register int x, y;
* If the location is remembered as being both dark (waslit is false)
* and lit (glyph is a lit room or lit corridor) then it was either:
*
* (1) A dark location that the hero could see through night
* vision.
* (1) A dark location that the hero could see through night
* vision.
*
* (2) Darkened while out of the hero's sight. This can happen
* when cursed scroll of light is read.
* (2) Darkened while out of the hero's sight. This can happen
* when cursed scroll of light is read.
*
* In either case, we have to manually correct the hero's memory to
* match waslit. Deciding when to change waslit is non-trivial.
*
* Note: If flags.lit_corridor is set, then corridors act like room
* squares. That is, they light up if in night vision range.
* If flags.lit_corridor is not set, then corridors will
* remain dark unless lit by a light spell and may darken
* again, as discussed above.
* squares. That is, they light up if in night vision range.
* If flags.lit_corridor is not set, then corridors will
* remain dark unless lit by a light spell and may darken
* again, as discussed above.
*
* These checks and changes must be here and not in back_to_glyph().
* They are dependent on the position being out of sight.
@@ -803,7 +805,8 @@ register int x, y;
else if (Is_rogue_level(&u.uz)) {
if (lev->glyph == cmap_to_glyph(S_litcorr) && lev->typ == CORR)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_corr));
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM && !lev->waslit)
else if (lev->glyph == cmap_to_glyph(S_room) && lev->typ == ROOM
&& !lev->waslit)
show_glyph(x, y, lev->glyph = cmap_to_glyph(S_stone));
else
goto show_mem;
@@ -856,20 +859,20 @@ xchar x, y;
* but explode() wants to delay].
*
* Call:
* (DISP_BEAM, glyph) open, initialize glyph
* (DISP_FLASH, glyph) open, initialize glyph
* (DISP_ALWAYS, glyph) open, initialize glyph
* (DISP_CHANGE, glyph) change glyph
* (DISP_END, 0) close & clean up (second argument doesn't
* matter)
* (DISP_FREEMEM, 0) only used to prevent memory leak during
* exit)
* (x, y) display the glyph at the location
* (DISP_BEAM, glyph) open, initialize glyph
* (DISP_FLASH, glyph) open, initialize glyph
* (DISP_ALWAYS, glyph) open, initialize glyph
* (DISP_CHANGE, glyph) change glyph
* (DISP_END, 0) close & clean up (second argument doesn't
* matter)
* (DISP_FREEMEM, 0) only used to prevent memory leak during
* exit)
* (x, y) display the glyph at the location
*
* DISP_BEAM - Display the given glyph at each location, but do not erase
* any until the close call.
* any until the close call.
* DISP_FLASH - Display the given glyph at each location, but erase the
* previous location's glyph.
* previous location's glyph.
* DISP_ALWAYS- Like DISP_FLASH, but vision is not taken into account.
*/
@@ -1063,19 +1066,20 @@ int mode;
if (mode == 1 || dela) {
cls();
dela = FALSE;
}
/* delayed full update */
else if (mode == 2) {
} else if (mode == 2) {
dela = TRUE;
return;
}
/* limited update */
else {
} else {
for (y = lasty - 1; y <= lasty + 1; y++)
for (x = lastx - 1; x <= lastx + 1; x++)
if (isok(x, y))
show_glyph(x, y, cmap_to_glyph(S_stone));
}
for (x = u.ux - 1; x <= u.ux + 1; x++)
for (y = u.uy - 1; y <= u.uy + 1; y++)
if (isok(x, y) && is_pool(x, y)) {
@@ -1089,9 +1093,9 @@ int mode;
}
/*
* under_ground()
* under_ground()
*
* Very restricted display. You can only see yourself.
* Very restricted display. You can only see yourself.
*/
void
under_ground(mode)
@@ -1107,15 +1111,16 @@ int mode;
if (mode == 1 || dela) {
cls();
dela = FALSE;
}
/* delayed full update */
else if (mode == 2) {
} else if (mode == 2) {
dela = TRUE;
return;
}
/* limited update */
else
} else {
newsym(u.ux, u.uy);
}
}
/* =========================================================================
@@ -1123,17 +1128,17 @@ int mode;
/*
* Loop through all of the monsters and update them. Called when:
* + going blind & telepathic
* + regaining sight & telepathic
* + going blind & telepathic
* + regaining sight & telepathic
* + getting and losing infravision
* + hallucinating
* + doing a full screen redraw
* + see invisible times out or a ring of see invisible is taken off
* + when a potion of see invisible is quaffed or a ring of see
* invisible is put on
* + gaining telepathy when blind [givit() in eat.c, pleased() in pray.c]
* + losing telepathy while blind [xkilled() in mon.c, attrcurse() in
* sit.c]
* + hallucinating
* + doing a full screen redraw
* + see invisible times out or a ring of see invisible is taken off
* + when a potion of see invisible is quaffed or a ring of see
* invisible is put on
* + gaining telepathy when blind [givit() in eat.c, pleased() in pray.c]
* + losing telepathy while blind [xkilled() in mon.c, attrcurse() in
* sit.c]
*/
void
see_monsters()
@@ -1191,7 +1196,7 @@ set_mimic_blocking()
/*
* Loop through all of the object *locations* and update them. Called when
* + hallucinating.
* + hallucinating.
*/
void
see_objects()
@@ -1451,7 +1456,7 @@ flush_screen(cursor_on_u)
int cursor_on_u;
{
/* Prevent infinite loops on errors:
* flush_screen->print_glyph->impossible->pline->flush_screen
* flush_screen->print_glyph->impossible->pline->flush_screen
*/
static boolean flushing = 0;
static boolean delay_flushing = 0;
@@ -1646,8 +1651,7 @@ int loc;
impossible("swallow_to_glyph: bad swallow location");
loc = S_sw_br;
}
return ((int) (what_mon(mnum) << 3) | (loc - S_sw_tl))
+ GLYPH_SWALLOW_OFF;
return ((int) (what_mon(mnum) << 3) | (loc - S_sw_tl)) + GLYPH_SWALLOW_OFF;
}
/*
@@ -1657,10 +1661,10 @@ int loc;
* type has four glyphs, one for each of the symbols below. The order of
* the zap symbols [0-3] as defined in rm.h are:
*
* | S_vbeam ( 0, 1) or ( 0,-1)
* - S_hbeam ( 1, 0) or (-1, 0)
* \ S_lslant ( 1, 1) or (-1,-1)
* / S_rslant (-1, 1) or ( 1,-1)
* | S_vbeam ( 0, 1) or ( 0,-1)
* - S_hbeam ( 1, 0) or (-1, 0)
* \ S_lslant ( 1, 1) or (-1,-1)
* / S_rslant (-1, 1) or ( 1,-1)
*/
int
zapdir_to_glyph(dx, dy, beam_type)
@@ -1783,8 +1787,8 @@ error4(x, y, a, b, c, dd)
int x, y, a, b, c, dd;
{
pline("set_wall_state: %s @ (%d,%d) %s%s%s%s",
type_to_name(levl[x][y].typ), x, y, a ? "1" : "", b ? "2" : "",
c ? "3" : "", dd ? "4" : "");
type_to_name(levl[x][y].typ), x, y,
a ? "1" : "", b ? "2" : "", c ? "3" : "", dd ? "4" : "");
bad_count[levl[x][y].typ]++;
}
#endif /* WA_VERBOSE */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 do_name.c $NHDT-Date: 1444617209 2015/10/12 02:33:29 $ $NHDT-Branch: master $:$NHDT-Revision: 1.75 $ */
/* NetHack 3.6 do_name.c $NHDT-Date: 1446808440 2015/11/06 11:14:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.77 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -29,10 +29,11 @@ nextmbuf()
/* function for getpos() to highlight desired map locations.
* parameter value 0 = initialize, 1 = highlight, 2 = done
*/
void (*getpos_hilitefunc)(int) = NULL;
void FDECL((*getpos_hilitefunc), (int)) = (void FDECL((*), (int))) 0;
void
getpos_sethilite(f)
void (*f)(int);
void FDECL((*f), (int));
{
getpos_hilitefunc = f;
}
@@ -244,8 +245,7 @@ const char *goal;
|| glyph_to_cmap(k) == S_darkroom
|| glyph_to_cmap(k) == S_corr
|| glyph_to_cmap(k) == S_litcorr)) {
/* what the hero remembers to be at tx,ty
*/
/* what hero remembers to be at tx,ty */
k = glyph_at(tx, ty);
}
if (glyph_is_cmap(k)
@@ -384,8 +384,7 @@ struct obj *obj;
{
if (has_oname(obj))
return ONAME(obj);
else
return "";
return "";
}
/* historical note: this returns a monster pointer because it used to
@@ -718,8 +717,8 @@ register struct obj *obj;
(void) mungspaces(buf);
if (!*buf) {
if (*str1) { /* had name, so possibly remove from disco[] */
/* strip name first, for the update_inventory() call
from undiscover_object() */
/* strip name first, for the update_inventory() call
from undiscover_object() */
*str1 = (char *) 0;
undiscover_object(obj->otyp);
}
@@ -821,20 +820,20 @@ rndghostname()
return rn2(7) ? ghostnames[rn2(SIZE(ghostnames))] : (const char *) plname;
}
/* Monster naming functions:
/*
* Monster naming functions:
* x_monnam is the generic monster-naming function.
* seen unseen detected named
* mon_nam: the newt it the invisible orc Fido
* noit_mon_nam:the newt (as if detected) the invisible orc Fido
* l_monnam: newt it invisible orc dog called
*fido
* Monnam: The newt It The invisible orc Fido
* noit_Monnam: The newt (as if detected) The invisible orc Fido
* Adjmonnam: The poor newt It The poor invisible orc The poor Fido
* Amonnam: A newt It An invisible orc Fido
* a_monnam: a newt it an invisible orc Fido
* m_monnam: newt xan orc Fido
* y_monnam: your newt your xan your invisible orc Fido
* seen unseen detected named
* mon_nam: the newt it the invisible orc Fido
* noit_mon_nam:the newt (as if detected) the invisible orc Fido
* l_monnam: newt it invisible orc dog called Fido
* Monnam: The newt It The invisible orc Fido
* noit_Monnam: The newt (as if detected) The invisible orc Fido
* Adjmonnam: The poor newt It The poor invisible orc The poor Fido
* Amonnam: A newt It An invisible orc Fido
* a_monnam: a newt it an invisible orc Fido
* m_monnam: newt xan orc Fido
* y_monnam: your newt your xan your invisible orc Fido
*/
/* Bug: if the monster is a priest or shopkeeper, not every one of these
@@ -953,6 +952,7 @@ boolean called;
if (do_hallu) {
char rnamecode;
char *rname = rndmonnam(&rnamecode);
Strcat(buf, rname);
name_at_start = bogon_is_pname(rnamecode);
} else if (has_mname(mtmp)) {
@@ -982,6 +982,7 @@ boolean called;
}
} else if (is_mplayer(mdat) && !In_endgame(&u.uz)) {
char pbuf[BUFSZ];
Strcpy(pbuf, rank_of((int) mtmp->m_lev, monsndx(mdat),
(boolean) mtmp->female));
Strcat(buf, lcase(pbuf));
@@ -1015,7 +1016,7 @@ boolean called;
Strcpy(buf, buf2);
return buf;
case ARTICLE_A:
return (an(buf));
return an(buf);
case ARTICLE_NONE:
default:
return buf;
@@ -1025,18 +1026,18 @@ boolean called;
char *
l_monnam(mtmp)
register struct monst *mtmp;
struct monst *mtmp;
{
return (x_monnam(mtmp, ARTICLE_NONE, (char *) 0,
(has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, TRUE));
return x_monnam(mtmp, ARTICLE_NONE, (char *) 0,
(has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, TRUE);
}
char *
mon_nam(mtmp)
register struct monst *mtmp;
struct monst *mtmp;
{
return (x_monnam(mtmp, ARTICLE_THE, (char *) 0,
(has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE));
return x_monnam(mtmp, ARTICLE_THE, (char *) 0,
(has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE);
}
/* print the name as if mon_nam() was called, but assume that the player
@@ -1045,32 +1046,32 @@ register struct monst *mtmp;
*/
char *
noit_mon_nam(mtmp)
register struct monst *mtmp;
struct monst *mtmp;
{
return (x_monnam(mtmp, ARTICLE_THE, (char *) 0,
(has_mname(mtmp)) ? (SUPPRESS_SADDLE | SUPPRESS_IT)
return x_monnam(mtmp, ARTICLE_THE, (char *) 0,
(has_mname(mtmp)) ? (SUPPRESS_SADDLE | SUPPRESS_IT)
: SUPPRESS_IT,
FALSE));
FALSE);
}
char *
Monnam(mtmp)
register struct monst *mtmp;
struct monst *mtmp;
{
register char *bp = mon_nam(mtmp);
*bp = highc(*bp);
return (bp);
return bp;
}
char *
noit_Monnam(mtmp)
register struct monst *mtmp;
struct monst *mtmp;
{
register char *bp = noit_mon_nam(mtmp);
*bp = highc(*bp);
return (bp);
return bp;
}
/* monster's own name */
@@ -1100,33 +1101,32 @@ struct monst *mtmp;
char *
Adjmonnam(mtmp, adj)
register struct monst *mtmp;
register const char *adj;
struct monst *mtmp;
const char *adj;
{
register char *bp =
x_monnam(mtmp, ARTICLE_THE, adj,
(has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE);
char *bp = x_monnam(mtmp, ARTICLE_THE, adj,
has_mname(mtmp) ? SUPPRESS_SADDLE : 0, FALSE);
*bp = highc(*bp);
return (bp);
return bp;
}
char *
a_monnam(mtmp)
register struct monst *mtmp;
struct monst *mtmp;
{
return x_monnam(mtmp, ARTICLE_A, (char *) 0,
(has_mname(mtmp)) ? SUPPRESS_SADDLE : 0, FALSE);
has_mname(mtmp) ? SUPPRESS_SADDLE : 0, FALSE);
}
char *
Amonnam(mtmp)
register struct monst *mtmp;
struct monst *mtmp;
{
register char *bp = a_monnam(mtmp);
char *bp = a_monnam(mtmp);
*bp = highc(*bp);
return (bp);
return bp;
}
/* used for monster ID by the '/', ';', and 'C' commands to block remote
@@ -1170,7 +1170,6 @@ char *buf, *code;
return mname;
}
#define BOGUSMONSIZE 100 /* arbitrary */
/* return a random monster name, for hallucination */
char *
rndmonnam(code)
@@ -1179,6 +1178,7 @@ char *code;
static char buf[BUFSZ];
char *mname;
int name;
#define BOGUSMONSIZE 100 /* arbitrary */
if (code)
*code = '\0';
@@ -1194,8 +1194,8 @@ char *code;
mname = strcpy(buf, mons[name].mname);
}
return mname;
}
#undef BOGUSMONSIZE
}
/* check bogusmon prefix to decide whether it's a personal name */
boolean
@@ -1249,8 +1249,10 @@ const char *
rndcolor()
{
int k = rn2(CLR_MAX);
return Hallucination ? hcolor((char *) 0)
: (k == NO_COLOR) ? "colorless" : c_obj_colors[k];
: (k == NO_COLOR) ? "colorless"
: c_obj_colors[k];
}
/* Aliases for road-runner nemesis

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dog.c $NHDT-Date: 1445301120 2015/10/20 00:32:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.51 $ */
/* NetHack 3.6 dog.c $NHDT-Date: 1446808440 2015/11/06 11:14:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.52 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -56,13 +56,13 @@ STATIC_OVL int
pet_type()
{
if (urole.petnum != NON_PM)
return (urole.petnum);
return urole.petnum;
else if (preferred_pet == 'c')
return (PM_KITTEN);
return PM_KITTEN;
else if (preferred_pet == 'd')
return (PM_LITTLE_DOG);
return PM_LITTLE_DOG;
else
return (rn2(2) ? PM_KITTEN : PM_LITTLE_DOG);
return rn2(2) ? PM_KITTEN : PM_LITTLE_DOG;
}
struct monst *
@@ -200,7 +200,7 @@ makedog()
mtmp = christen_monst(mtmp, petname);
initedog(mtmp);
return (mtmp);
return mtmp;
}
/* record `last move time' for all monsters prior to level save so that
@@ -582,10 +582,10 @@ boolean pets_only; /* true for ascension or final escape */
if (pets_only) {
if (!mtmp->mtame)
continue; /* reject non-pets */
/* don't block pets from accompanying hero's dungeon
escape or ascension simply due to mundane trifles;
unlike level change for steed, don't bother trying
to achieve a normal trap escape first */
/* don't block pets from accompanying hero's dungeon
escape or ascension simply due to mundane trifles;
unlike level change for steed, don't bother trying
to achieve a normal trap escape first */
mtmp->mtrapped = 0;
mtmp->meating = 0;
mtmp->msleeping = 0;
@@ -743,7 +743,7 @@ register struct obj *obj;
boolean carni = carnivorous(mptr), herbi = herbivorous(mptr), starving;
if (is_quest_artifact(obj) || obj_resists(obj, 0, 95))
return (obj->cursed ? TABU : APPORT);
return obj->cursed ? TABU : APPORT;
switch (obj->oclass) {
case FOOD_CLASS:
@@ -771,7 +771,9 @@ register struct obj *obj;
&& fptr != &mons[PM_LIZARD]
&& fptr != &mons[PM_LICHEN])
? DOGFOOD
: (starving && !vegan(fptr)) ? ACCFOOD : POISON;
: (starving && !vegan(fptr))
? ACCFOOD
: POISON;
if (obj->otyp == EGG)
return stale_egg(obj) ? CADAVER : starving ? ACCFOOD : POISON;
return TABU;
@@ -783,9 +785,9 @@ register struct obj *obj;
case MEAT_RING:
case MEAT_STICK:
case HUGE_CHUNK_OF_MEAT:
return (carni ? DOGFOOD : MANFOOD);
return carni ? DOGFOOD : MANFOOD;
case EGG:
return (carni ? CADAVER : MANFOOD);
return carni ? CADAVER : MANFOOD;
case CORPSE:
if ((peek_at_iced_corpse_age(obj) + 50L <= monstermoves
&& obj->corpsenm != PM_LIZARD && obj->corpsenm != PM_LICHEN
@@ -795,57 +797,61 @@ register struct obj *obj;
return POISON;
/* turning into slime is preferable to starvation */
else if (fptr == &mons[PM_GREEN_SLIME] && !slimeproof(mon->data))
return (starving ? ACCFOOD : POISON);
return starving ? ACCFOOD : POISON;
else if (vegan(fptr))
return (herbi ? CADAVER : MANFOOD);
return herbi ? CADAVER : MANFOOD;
/* most humanoids will avoid cannibalism unless starving;
arbitrary: elves won't eat other elves even then */
else if (humanoid(mptr) && same_race(mptr, fptr)
&& (!is_undead(mptr) && fptr->mlet != S_KOBOLD
&& fptr->mlet != S_ORC && fptr->mlet != S_OGRE))
return ((starving && carni && !is_elf(mptr)) ? ACCFOOD
: TABU);
return (starving && carni && !is_elf(mptr)) ? ACCFOOD : TABU;
else
return (carni ? CADAVER : MANFOOD);
return carni ? CADAVER : MANFOOD;
case CLOVE_OF_GARLIC:
return ((is_undead(mptr) || is_vampshifter(mon))
? TABU
: ((herbi || starving) ? ACCFOOD : MANFOOD));
return (is_undead(mptr) || is_vampshifter(mon))
? TABU
: (herbi || starving)
? ACCFOOD
: MANFOOD;
case TIN:
return (metallivorous(mptr) ? ACCFOOD : MANFOOD);
return metallivorous(mptr) ? ACCFOOD : MANFOOD;
case APPLE:
case CARROT:
return (herbi ? DOGFOOD : starving ? ACCFOOD : MANFOOD);
return herbi ? DOGFOOD : starving ? ACCFOOD : MANFOOD;
case BANANA:
return ((mptr->mlet == S_YETI)
? DOGFOOD
: ((herbi || starving) ? ACCFOOD : MANFOOD));
return (mptr->mlet == S_YETI)
? DOGFOOD
: (herbi || starving)
? ACCFOOD
: MANFOOD;
default:
if (starving)
return ACCFOOD;
return (obj->otyp > SLIME_MOLD ? (carni ? ACCFOOD : MANFOOD)
: (herbi ? ACCFOOD : MANFOOD));
return (obj->otyp > SLIME_MOLD) ? (carni ? ACCFOOD : MANFOOD)
: (herbi ? ACCFOOD : MANFOOD);
}
default:
if (obj->otyp == AMULET_OF_STRANGULATION
|| obj->otyp == RIN_SLOW_DIGESTION)
return TABU;
if (mon_hates_silver(mon) && objects[obj->otyp].oc_material == SILVER)
return (TABU);
return TABU;
if (mptr == &mons[PM_GELATINOUS_CUBE] && is_organic(obj))
return (ACCFOOD);
return ACCFOOD;
if (metallivorous(mptr) && is_metallic(obj)
&& (is_rustprone(obj) || mptr != &mons[PM_RUST_MONSTER])) {
/* Non-rustproofed ferrous based metals are preferred. */
return ((is_rustprone(obj) && !obj->oerodeproof) ? DOGFOOD
: ACCFOOD);
return (is_rustprone(obj) && !obj->oerodeproof) ? DOGFOOD
: ACCFOOD;
}
if (!obj->cursed && obj->oclass != BALL_CLASS
if (!obj->cursed
&& obj->oclass != BALL_CLASS
&& obj->oclass != CHAIN_CLASS)
return (APPORT);
/* fall into next case */
return APPORT;
/*FALLTHRU*/
case ROCK_CLASS:
return (UNDEF);
return UNDEF;
}
}

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dokick.c $NHDT-Date: 1446191875 2015/10/30 07:57:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.102 $ */
/* NetHack 3.6 dokick.c $NHDT-Date: 1446808441 2015/11/06 11:14:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.103 $ */
/* Copyright (c) Izchak Miller, Mike Stephenson, Steve Linhart, 1989. */
/* NetHack may be freely redistributed. See license for details. */
@@ -17,8 +17,8 @@ static NEARDATA const char *gate_str;
extern boolean notonhead; /* for long worms */
STATIC_DCL void FDECL(kickdmg, (struct monst *, BOOLEAN_P));
STATIC_DCL boolean
FDECL(maybe_kick_monster, (struct monst *, XCHAR_P, XCHAR_P));
STATIC_DCL boolean FDECL(maybe_kick_monster, (struct monst *,
XCHAR_P, XCHAR_P));
STATIC_DCL void FDECL(kick_monster, (struct monst *, XCHAR_P, XCHAR_P));
STATIC_DCL int FDECL(kick_object, (XCHAR_P, XCHAR_P));
STATIC_DCL int FDECL(really_kick_object, (XCHAR_P, XCHAR_P));
@@ -1655,8 +1655,8 @@ boolean near_hero;
if (!noscatter)
(void) scatter(nx, ny, rnd(2), 0, otmp);
} else { /* random location */
/* set dummy coordinates because there's no
current position for rloco() to update */
/* set dummy coordinates because there's no
current position for rloco() to update */
otmp->ox = otmp->oy = 0;
if (rloco(otmp) && !nobreak && breaktest(otmp)) {
/* assume it broke before player arrived, no messages */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dungeon.c $NHDT-Date: 1445301123 2015/10/20 00:32:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.65 $ */
/* NetHack 3.6 dungeon.c $NHDT-Date: 1446808442 2015/11/06 11:14:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -24,9 +24,10 @@ struct proto_dungeon {
int n_brs; /* number of tmpbranch entries */
};
int n_dgns; /* number of dungeons (also used */
/* in mklev.c and do.c) */
static branch *branches = (branch *) 0; /* dungeon branch list */
int n_dgns; /* number of dungeons (also used in mklev.c and do.c) */
static branch *branches = (branch *) 0; /* dungeon branch list */
mapseen *mapseenchn = (struct mapseen *) 0; /*DUNGEON_OVERVIEW*/
struct lchoice {
int idx;
@@ -40,15 +41,15 @@ static void FDECL(Fread, (genericptr_t, int, int, dlb *));
STATIC_DCL xchar FDECL(dname_to_dnum, (const char *));
STATIC_DCL int FDECL(find_branch, (const char *, struct proto_dungeon *));
STATIC_DCL xchar FDECL(parent_dnum, (const char *, struct proto_dungeon *));
STATIC_DCL int FDECL(level_range,
(XCHAR_P, int, int, int, struct proto_dungeon *, int *));
STATIC_DCL int FDECL(level_range, (XCHAR_P, int, int, int,
struct proto_dungeon *, int *));
STATIC_DCL xchar FDECL(parent_dlevel, (const char *, struct proto_dungeon *));
STATIC_DCL int FDECL(correct_branch_type, (struct tmpbranch *));
STATIC_DCL branch *FDECL(add_branch, (int, int, struct proto_dungeon *));
STATIC_DCL void FDECL(add_level, (s_level *));
STATIC_DCL void FDECL(init_level, (int, int, struct proto_dungeon *));
STATIC_DCL int FDECL(possible_places,
(int, boolean *, struct proto_dungeon *));
STATIC_DCL int FDECL(possible_places, (int, boolean *,
struct proto_dungeon *));
STATIC_DCL xchar FDECL(pick_level, (boolean *, int));
STATIC_DCL boolean FDECL(place_level, (int, struct proto_dungeon *));
STATIC_DCL boolean FDECL(unplaced_floater, (struct dungeon *));
@@ -56,17 +57,15 @@ STATIC_DCL boolean FDECL(unreachable_level, (d_level *, BOOLEAN_P));
STATIC_DCL void FDECL(tport_menu, (winid, char *, struct lchoice *, d_level *,
BOOLEAN_P));
STATIC_DCL const char *FDECL(br_string, (int));
STATIC_DCL void FDECL(print_branch,
(winid, int, int, int, BOOLEAN_P, struct lchoice *));
mapseen *mapseenchn = (struct mapseen *) 0;
STATIC_DCL void FDECL(print_branch, (winid, int, int, int, BOOLEAN_P,
struct lchoice *));
STATIC_DCL mapseen *FDECL(load_mapseen, (int));
STATIC_DCL void FDECL(save_mapseen, (int, mapseen *));
STATIC_DCL mapseen *FDECL(find_mapseen, (d_level *));
STATIC_DCL void FDECL(print_mapseen, (winid, mapseen *, int, int, BOOLEAN_P));
STATIC_DCL boolean FDECL(interest_mapseen, (mapseen *));
STATIC_DCL void FDECL(traverse_mapseenchn,
(BOOLEAN_P, winid, int, int, int *));
STATIC_DCL void FDECL(traverse_mapseenchn, (BOOLEAN_P, winid,
int, int, int *));
STATIC_DCL const char *FDECL(seen_string, (XCHAR_P, const char *));
STATIC_DCL const char *FDECL(br_string2, (branch *));
STATIC_DCL const char *FDECL(endgamelevelname, (char *, int));
@@ -326,7 +325,7 @@ struct proto_dungeon *pd;
*/
for (pdnum = 0; strcmp(pd->tmpdungeon[pdnum].name, s); pdnum++)
if ((i -= pd->tmpdungeon[pdnum].branches) < 0)
return (pdnum);
return pdnum;
panic("parent_dnum: couldn't resolve branch.");
/*NOT REACHED*/
@@ -338,10 +337,10 @@ struct proto_dungeon *pd;
* or dungeon entrance can occupy.
*
* Note: This follows the acouple (instead of the rcouple) rules for a
* negative random component (randc < 0). These rules are found
* in dgn_comp.y. The acouple [absolute couple] section says that
* a negative random component means from the (adjusted) base to the
* end of the dungeon.
* negative random component (randc < 0). These rules are found
* in dgn_comp.y. The acouple [absolute couple] section says that
* a negative random component means from the (adjusted) base to the
* end of the dungeon.
*/
STATIC_OVL int
level_range(dgn, base, randc, chain, pd, adjusted_base)
@@ -704,7 +703,9 @@ struct level_map {
{ X_GOAL, &nemesis_level },
{ "", (d_level *) 0 } };
void init_dungeons() /* initialize the "dungeon" structs */
/* initialize the "dungeon" structs */
void
init_dungeons()
{
dlb *dgn_file;
register int i, cl = 0, cb = 0;
@@ -810,9 +811,9 @@ void init_dungeons() /* initialize the "dungeon" structs */
/*
* Set the entry level for this dungeon. The pd.tmpdungeon entry
* value means:
* < 0 from bottom (-1 == bottom level)
* 0 default (top)
* > 0 actual level (1 = top)
* < 0 from bottom (-1 == bottom level)
* 0 default (top)
* > 0 actual level (1 = top)
*
* Note that the entry_lev field in the dungeon structure is
* redundant. It is used only here and in print_dungeon().
@@ -850,13 +851,13 @@ void init_dungeons() /* initialize the "dungeon" structs */
* Calculate the depth of the top of the dungeon via
* its branch. First, the depth of the entry point:
*
* depth of branch from "parent" dungeon
* + -1 or 1 depending on a up or down stair or
* 0 if portal
* depth of branch from "parent" dungeon
* + -1 or 1 depending on a up or down stair or
* 0 if portal
*
* Followed by the depth of the top of the dungeon:
*
* - (entry depth - 1)
* - (entry depth - 1)
*
* We'll say that portals stay on the same depth.
*/
@@ -945,7 +946,7 @@ void init_dungeons() /* initialize the "dungeon" structs */
}
}
/*
* I hate hardwiring these names. :-(
* I hate hardwiring these names. :-(
*/
quest_dnum = dname_to_dnum("The Quest");
sokoban_dnum = dname_to_dnum("Sokoban");
@@ -970,21 +971,25 @@ void init_dungeons() /* initialize the "dungeon" structs */
#endif
}
xchar dunlev(lev) /* return the level number for lev in *this* dungeon */
/* return the level number for lev in *this* dungeon */
xchar
dunlev(lev)
d_level *lev;
{
return (lev->dlevel);
return lev->dlevel;
}
/* return the lowest level number for *this* dungeon */
xchar
dunlevs_in_dungeon(lev) /* return the lowest level number for *this* dungeon*/
dunlevs_in_dungeon(lev)
d_level *lev;
{
return (dungeons[lev->dnum].num_dunlevs);
return dungeons[lev->dnum].num_dunlevs;
}
/* return the lowest level explored in the game*/
xchar
deepest_lev_reached(noquest) /* return the lowest level explored in the game*/
deepest_lev_reached(noquest)
boolean noquest;
{
/* this function is used for three purposes: to provide a factor
@@ -1016,16 +1021,16 @@ boolean noquest;
if (depth(&tmp) > ret)
ret = depth(&tmp);
}
return ((xchar) ret);
return (xchar) ret;
}
/* return a bookkeeping level number for purpose of comparisons and
* save/restore */
save/restore */
xchar
ledger_no(lev)
d_level *lev;
{
return ((xchar)(lev->dlevel + dungeons[lev->dnum].ledger_start));
return (xchar) (lev->dlevel + dungeons[lev->dnum].ledger_start);
}
/*
@@ -1041,8 +1046,8 @@ d_level *lev;
xchar
maxledgerno()
{
return (xchar)(dungeons[n_dgns - 1].ledger_start
+ dungeons[n_dgns - 1].num_dunlevs);
return (xchar) (dungeons[n_dgns - 1].ledger_start
+ dungeons[n_dgns - 1].num_dunlevs);
}
/* return the dungeon that this ledgerno exists in */
@@ -1068,11 +1073,12 @@ xchar
ledger_to_dlev(ledgerno)
xchar ledgerno;
{
return (xchar)(ledgerno - dungeons[ledger_to_dnum(ledgerno)].ledger_start);
return (xchar) (ledgerno
- dungeons[ledger_to_dnum(ledgerno)].ledger_start);
}
/* returns the depth of a level, in floors below the surface */
/* (note levels in different dungeons can have the same depth). */
/* returns the depth of a level, in floors below the surface
(note levels in different dungeons can have the same depth) */
schar
depth(lev)
d_level *lev;
@@ -1085,8 +1091,8 @@ boolean
on_level(lev1, lev2)
d_level *lev1, *lev2;
{
return (boolean) ((lev1->dnum == lev2->dnum)
&& (lev1->dlevel == lev2->dlevel));
return (boolean) (lev1->dnum == lev2->dnum
&& lev1->dlevel == lev2->dlevel);
}
/* is this level referenced in the special level chain? */
@@ -1098,7 +1104,7 @@ d_level *lev;
for (levtmp = sp_levchn; levtmp; levtmp = levtmp->next)
if (on_level(lev, &levtmp->dlevel))
return (levtmp);
return levtmp;
return (s_level *) 0;
}
@@ -1192,7 +1198,9 @@ int x, y;
u.ux0 = u.ux, u.uy0 = u.uy;
}
void u_on_rndspot(upflag) /* place you on a random location */
/* place you on a random location */
void
u_on_rndspot(upflag)
int upflag;
{
int up = (upflag & 1), was_in_W_tower = (upflag & 2);
@@ -1220,7 +1228,9 @@ int upflag;
(d_level *) 0);
}
void u_on_sstairs(upflag) /* place you on the special staircase */
/* place you on the special staircase */
void
u_on_sstairs(upflag)
int upflag;
{
if (sstairs.sx)
@@ -1229,7 +1239,9 @@ int upflag;
u_on_rndspot(upflag);
}
void u_on_upstairs() /* place you on upstairs (or special equivalent) */
/* place you on upstairs (or special equivalent) */
void
u_on_upstairs()
{
if (xupstair)
u_on_newpos(xupstair, yupstair);
@@ -1237,7 +1249,9 @@ void u_on_upstairs() /* place you on upstairs (or special equivalent) */
u_on_sstairs(0); /* destination upstairs implies moving down */
}
void u_on_dnstairs() /* place you on dnstairs (or special equivalent) */
/* place you on dnstairs (or special equivalent) */
void
u_on_dnstairs()
{
if (xdnstair)
u_on_newpos(xdnstair, ydnstair);
@@ -1249,26 +1263,27 @@ boolean
On_stairs(x, y)
xchar x, y;
{
return ((boolean)((x == xupstair && y == yupstair)
return (boolean) ((x == xupstair && y == yupstair)
|| (x == xdnstair && y == ydnstair)
|| (x == xdnladder && y == ydnladder)
|| (x == xupladder && y == yupladder)
|| (x == sstairs.sx && y == sstairs.sy)));
|| (x == sstairs.sx && y == sstairs.sy));
}
boolean
Is_botlevel(lev)
d_level *lev;
{
return ((boolean)(lev->dlevel == dungeons[lev->dnum].num_dunlevs));
return (boolean) (lev->dlevel == dungeons[lev->dnum].num_dunlevs);
}
boolean
Can_dig_down(lev)
d_level *lev;
{
return ((boolean)(!level.flags.hardfloor && !Is_botlevel(lev)
&& !Invocation_lev(lev)));
return (boolean) (!level.flags.hardfloor
&& !Is_botlevel(lev)
&& !Invocation_lev(lev));
}
/*
@@ -1280,7 +1295,7 @@ boolean
Can_fall_thru(lev)
d_level *lev;
{
return ((boolean)(Can_dig_down(lev) || Is_stronghold(lev)));
return (boolean) (Can_dig_down(lev) || Is_stronghold(lev));
}
/*
@@ -1299,9 +1314,10 @@ d_level *lev;
if (In_endgame(lev) || In_sokoban(lev)
|| (Is_wiz1_level(lev) && In_W_tower(x, y, lev)))
return FALSE;
return (boolean)(lev->dlevel > 1
|| (dungeons[lev->dnum].entry_lev == 1
&& ledger_no(lev) != 1 && sstairs.sx && sstairs.up));
return (boolean) (lev->dlevel > 1
|| (dungeons[lev->dnum].entry_lev == 1
&& ledger_no(lev) != 1
&& sstairs.sx && sstairs.up));
}
boolean
@@ -1309,7 +1325,7 @@ has_ceiling(lev)
d_level *lev;
{
/* [what about level 1 of the quest?] */
return (!Is_airlevel(lev) && !Is_waterlevel(lev));
return (boolean) (!Is_airlevel(lev) && !Is_waterlevel(lev));
}
/*
@@ -1371,25 +1387,29 @@ int levnum;
newlevel->dlevel = levnum;
}
boolean In_quest(lev) /* are you in the quest dungeon? */
/* are you in the quest dungeon? */
boolean
In_quest(lev)
d_level *lev;
{
return ((boolean)(lev->dnum == quest_dnum));
return (boolean) (lev->dnum == quest_dnum);
}
boolean In_mines(lev) /* are you in the mines dungeon? */
/* are you in the mines dungeon? */
boolean
In_mines(lev)
d_level *lev;
{
return ((boolean)(lev->dnum == mines_dnum));
return (boolean) (lev->dnum == mines_dnum);
}
/*
* Return the branch for the given dungeon.
*
* This function assumes:
* + This is not called with "Dungeons of Doom".
* + There is only _one_ branch to a given dungeon.
* + Field end2 is the "child" dungeon.
* + This is not called with "Dungeons of Doom".
* + There is only _one_ branch to a given dungeon.
* + Field end2 is the "child" dungeon.
*/
branch *
dungeon_branch(s)
@@ -1426,25 +1446,30 @@ const char *s;
branch *br;
br = dungeon_branch(s);
return ((boolean)(on_level(&u.uz, &br->end1) ? TRUE : FALSE));
}
boolean In_V_tower(lev) /* is `lev' part of Vlad's tower? */
d_level *lev;
{
return ((boolean)(lev->dnum == tower_dnum));
return on_level(&u.uz, &br->end1) ? TRUE : FALSE;
}
/* is `lev' part of Vlad's tower? */
boolean
On_W_tower_level(lev) /* is `lev' a level containing the Wizard's tower? */
In_V_tower(lev)
d_level *lev;
{
return (boolean)(Is_wiz1_level(lev) || Is_wiz2_level(lev)
|| Is_wiz3_level(lev));
return (boolean) (lev->dnum == tower_dnum);
}
boolean In_W_tower(x, y,
lev) /* is <x,y> of `lev' inside the Wizard's tower? */
/* is `lev' a level containing the Wizard's tower? */
boolean
On_W_tower_level(lev)
d_level *lev;
{
return (boolean) (Is_wiz1_level(lev)
|| Is_wiz2_level(lev)
|| Is_wiz3_level(lev));
}
/* is <x,y> of `lev' inside the Wizard's tower? */
boolean
In_W_tower(x, y, lev)
int x, y;
d_level *lev;
{
@@ -1453,7 +1478,7 @@ d_level *lev;
/*
* Both of the exclusion regions for arriving via level teleport
* (from above or below) define the tower's boundary.
* assert( updest.nIJ == dndest.nIJ for I={l|h},J={x|y} );
* assert( updest.nIJ == dndest.nIJ for I={l|h},J={x|y} );
*/
if (dndest.nlx > 0)
return (boolean) within_bounded_area(x, y, dndest.nlx, dndest.nly,
@@ -1463,20 +1488,26 @@ d_level *lev;
return FALSE;
}
boolean In_hell(lev) /* are you in one of the Hell levels? */
/* are you in one of the Hell levels? */
boolean
In_hell(lev)
d_level *lev;
{
return ((boolean)(dungeons[lev->dnum].flags.hellish));
return (boolean) (dungeons[lev->dnum].flags.hellish);
}
void find_hell(lev) /* sets *lev to be the gateway to Gehennom... */
/* sets *lev to be the gateway to Gehennom... */
void
find_hell(lev)
d_level *lev;
{
lev->dnum = valley_level.dnum;
lev->dlevel = 1;
}
void goto_hell(at_stairs, falling) /* go directly to hell... */
/* go directly to hell... */
void
goto_hell(at_stairs, falling)
boolean at_stairs, falling;
{
d_level lev;
@@ -1485,14 +1516,18 @@ boolean at_stairs, falling;
goto_level(&lev, at_stairs, falling, FALSE);
}
void assign_level(dest, src) /* equivalent to dest = source */
/* equivalent to dest = source */
void
assign_level(dest, src)
d_level *dest, *src;
{
dest->dnum = src->dnum;
dest->dlevel = src->dlevel;
}
void assign_rnd_level(dest, src, range) /* dest = src + rn1(range) */
/* dest = src + rn1(range) */
void
assign_rnd_level(dest, src, range)
d_level *dest, *src;
int range;
{
@@ -1514,23 +1549,22 @@ int pct;
if (lev && lev->flags.align)
if (rn2(100) < pct)
return (lev->flags.align);
return lev->flags.align;
if (dungeons[u.uz.dnum].flags.align)
if (rn2(100) < pct)
return (dungeons[u.uz.dnum].flags.align);
return dungeons[u.uz.dnum].flags.align;
al = rn2(3) - 1;
return (Align2amask(al));
return Align2amask(al);
}
boolean
Invocation_lev(lev)
d_level *lev;
{
return (
(boolean)(In_hell(lev)
&& lev->dlevel == (dungeons[lev->dnum].num_dunlevs - 1)));
return (boolean) (In_hell(lev)
&& lev->dlevel == dungeons[lev->dnum].num_dunlevs - 1);
}
/* use instead of depth() wherever a degree of difficulty is made
@@ -2155,11 +2189,7 @@ d_level *lev;
#define INTEREST(feat) \
((feat).nfount || (feat).nsink || (feat).nthrone || (feat).naltar \
|| (feat).ngrave || (feat).ntree || (feat).nshop || (feat).ntemple)
/*
|| ((feat).water) || \
((feat).ice) || \
((feat).lava)
*/
/* || (feat).water || (feat).ice || (feat).lava */
/* returns true if this level has something interesting to print out */
STATIC_OVL boolean
@@ -2187,14 +2217,16 @@ mapseen *mptr;
have annotations or not, so that #overview doesn't become extremely
sparse once the rest of the dungeon has been flagged as unreachable */
if (In_endgame(&u.uz))
return In_endgame(&mptr->lev);
return (boolean) In_endgame(&mptr->lev);
/* level is of interest if it has non-zero feature count or known bones
or user annotation or known connection to another dungeon branch
or is the furthest level reached in its branch */
return (INTEREST(mptr->feat) || (mptr->final_resting_place
&& (mptr->flags.knownbones || wizard))
|| mptr->custom || mptr->br
|| mptr->lev.dlevel == dungeons[mptr->lev.dnum].dunlev_ureached);
return (boolean) (INTEREST(mptr->feat)
|| (mptr->final_resting_place
&& (mptr->flags.knownbones || wizard))
|| mptr->custom || mptr->br
|| (mptr->lev.dlevel
== dungeons[mptr->lev.dnum].dunlev_ureached));
}
/* recalculate mapseen for the current level */
@@ -2329,20 +2361,23 @@ recalc_mapseen()
switch (lastseentyp[x][y]) {
#if 0
case ICE:
count = mptr->feat.ice + 1;
if (count <= 3) mptr->feat.ice = count;
break;
case POOL:
case MOAT:
case WATER:
count = mptr->feat.water + 1;
if (count <= 3) mptr->feat.water = count;
break;
case LAVAPOOL:
count = mptr->feat.lava + 1;
if (count <= 3) mptr->feat.lava = count;
break;
case ICE:
count = mptr->feat.ice + 1;
if (count <= 3)
mptr->feat.ice = count;
break;
case POOL:
case MOAT:
case WATER:
count = mptr->feat.water + 1;
if (count <= 3)
mptr->feat.water = count;
break;
case LAVAPOOL:
count = mptr->feat.lava + 1;
if (count <= 3)
mptr->feat.lava = count;
break;
#endif
case TREE:
count = mptr->feat.ntree + 1;
@@ -2379,16 +2414,16 @@ recalc_mapseen()
if (count <= 3)
mptr->feat.naltar = count;
break;
/* An automatic annotation is added to the Castle and
* to Fort Ludios once their structure's main entrance
* has been seen (in person or via magic mapping).
/* An automatic annotation is added to the Castle and
* to Fort Ludios once their structure's main entrance
* has been seen (in person or via magic mapping).
* DOOR: possibly a lowered drawbridge's open portcullis;
* DBWALL: a raised drawbridge's "closed door";
* DRAWBRIDGE_DOWN: the span provided by lowered bridge,
* with moat or other terrain hidden underneath;
* with moat or other terrain hidden underneath;
* DRAWBRIDGE_UP: moat in front of a raised drawbridge,
* not recognizable as a bridge location unless/until
* the adjacent DBWALL has been seen.
* not recognizable as a bridge location unless/until
* the adjacent DBWALL has been seen.
*/
case DOOR:
if (is_drawbridge_wall(x, y) < 0)
@@ -2547,9 +2582,9 @@ branch *br;
case BR_NO_END1:
return "Connection";
case BR_NO_END2:
return (br->end1_up) ? "One way stairs up" : "One way stairs down";
return br->end1_up ? "One way stairs up" : "One way stairs down";
case BR_STAIR:
return (br->end1_up) ? "Stairs up" : "Stairs down";
return br->end1_up ? "Stairs up" : "Stairs down";
}
return "(unknown)";
@@ -2753,9 +2788,9 @@ boolean printdun;
buf[0] = 0;
i = 0; /* interest counter */
/* List interests in an order vaguely corresponding to
* how important they are.
*/
/* List interests in an order vaguely corresponding to
* how important they are.
*/
if (mptr->feat.nshop > 0) {
if (mptr->feat.nshop > 1)
ADDNTOBUF("shop", mptr->feat.nshop);
@@ -2780,9 +2815,9 @@ boolean printdun;
ADDNTOBUF("grave", mptr->feat.ngrave);
ADDNTOBUF("tree", mptr->feat.ntree);
#if 0
ADDTOBUF("water", mptr->feat.water);
ADDTOBUF("lava", mptr->feat.lava);
ADDTOBUF("ice", mptr->feat.ice);
ADDTOBUF("water", mptr->feat.water);
ADDTOBUF("lava", mptr->feat.lava);
ADDTOBUF("ice", mptr->feat.ice);
#endif
/* capitalize afterwards */
i = strlen(PREFIX);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 eat.c $NHDT-Date: 1446189655 2015/10/30 07:20:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.150 $ */
/* NetHack 3.6 eat.c $NHDT-Date: 1446808443 2015/11/06 11:14:03 $ $NHDT-Branch: master $:$NHDT-Revision: 1.151 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -563,9 +563,9 @@ int *dmg_p; /* for dishing out extra damage in lieu of Int loss */
/* caller handles Int and memory loss */
} else { /* mhitm */
/*
* monster mind flayer is eating another monster's brain
*/
/*
* monster mind flayer is eating another monster's brain
*/
if (mindless(pd)) {
if (visflag)
pline("%s doesn't notice.", Monnam(mdef));
@@ -653,6 +653,7 @@ register int pm;
case PM_KITTEN:
case PM_HOUSECAT:
case PM_LARGE_CAT:
/* cannibals are allowed to eat domestic animals without penalty */
if (!CANNIBAL_ALLOWED()) {
You_feel("that eating the %s was a bad idea.", mons[pm].mname);
HAggravate_monster |= FROMOUTSIDE;
@@ -956,21 +957,20 @@ register int pm;
HSee_invisible |= FROMOUTSIDE;
}
newsym(u.ux, u.uy);
/* fall into next case */
/*FALLTHRU*/
case PM_YELLOW_LIGHT:
/* fall into next case */
case PM_GIANT_BAT:
make_stunned((HStun & TIMEOUT) + 30L, FALSE);
/* fall into next case */
/*FALLTHRU*/
case PM_BAT:
make_stunned((HStun & TIMEOUT) + 30L, FALSE);
break;
case PM_GIANT_MIMIC:
tmp += 10;
/* fall into next case */
/*FALLTHRU*/
case PM_LARGE_MIMIC:
tmp += 20;
/* fall into next case */
/*FALLTHRU*/
case PM_SMALL_MIMIC:
tmp += 20;
if (youmonst.data->mlet != S_MIMIC && !Unchanging) {
@@ -984,12 +984,11 @@ register int pm;
dismount_steed(DISMOUNT_FELL);
nomul(-tmp);
multi_reason = "pretending to be a pile of gold";
Sprintf(
buf,
Hallucination
? "You suddenly dread being peeled and mimic %s again!"
: "You now prefer mimicking %s again.",
an(Upolyd ? youmonst.data->mname : urace.noun));
Sprintf(buf,
Hallucination
? "You suddenly dread being peeled and mimic %s again!"
: "You now prefer mimicking %s again.",
an(Upolyd ? youmonst.data->mname : urace.noun));
eatmbuf = dupstr(buf);
nomovemsg = eatmbuf;
afternmv = eatmdone;
@@ -1548,6 +1547,7 @@ struct obj *otmp;
if (mnum != PM_ACID_BLOB && !stoneable && rotted > 5L) {
boolean cannibal = maybe_cannibal(mnum, FALSE);
pline("Ulch - that %s was tainted%s!",
mons[mnum].mlet == S_FUNGUS
? "fungoid vegetation"
@@ -1619,15 +1619,15 @@ struct obj *otmp;
You("peck the eyeball with delight.");
} else {
/* [is this right? omnivores end up always disliking the taste] */
boolean yummy =
(vegan(&mons[mnum])
? (!carnivorous(youmonst.data) && herbivorous(youmonst.data))
: (carnivorous(youmonst.data)
&& !herbivorous(youmonst.data)));
boolean yummy = vegan(&mons[mnum])
? (!carnivorous(youmonst.data)
&& herbivorous(youmonst.data))
: (carnivorous(youmonst.data)
&& !herbivorous(youmonst.data));
pline("%s%s %s!", type_is_pname(&mons[mnum])
? ""
: the_unique_pm(&mons[mnum]) ? "The " : "This ",
pline("%s%s %s!",
type_is_pname(&mons[mnum])
? "" : the_unique_pm(&mons[mnum]) ? "The " : "This ",
food_xname(otmp, FALSE),
Hallucination
? (yummy ? ((u.umonnum == PM_TIGER) ? "is gr-r-reat"
@@ -1886,8 +1886,9 @@ struct obj *otmp;
makeknown(typ);
}
break;
}
break;
} /* inner switch */
break; /* default case of outer switch */
case RIN_ADORNMENT:
accessory_has_effect(otmp);
if (adjattrib(A_CHA, otmp->spe, -1))
@@ -1916,8 +1917,8 @@ struct obj *otmp;
case RIN_PROTECTION:
accessory_has_effect(otmp);
HProtection |= FROMOUTSIDE;
u.ublessed =
bounded_increase(u.ublessed, otmp->spe, RIN_PROTECTION);
u.ublessed = bounded_increase(u.ublessed, otmp->spe,
RIN_PROTECTION);
context.botl = 1;
break;
case RIN_FREE_ACTION:
@@ -1948,8 +1949,7 @@ struct obj *otmp;
/* no message--this gives no permanent effect */
choke(otmp);
break;
case AMULET_OF_RESTFUL_SLEEP: /* another bad idea! */
{
case AMULET_OF_RESTFUL_SLEEP: { /* another bad idea! */
long newnap = (long) rnd(100), oldnap = (HSleepy & TIMEOUT);
if (!(HSleepy & FROMOUTSIDE))
@@ -1958,13 +1958,14 @@ struct obj *otmp;
/* might also be wearing one; use shorter of two timeouts */
if (newnap < oldnap || oldnap == 0L)
HSleepy = (HSleepy & ~TIMEOUT) | newnap;
} break;
break;
}
case RIN_SUSTAIN_ABILITY:
case AMULET_OF_LIFE_SAVING:
case AMULET_OF_REFLECTION: /* nice try */
/* can't eat Amulet of Yendor or fakes,
* and no oc_prop even if you could -3.
*/
/* can't eat Amulet of Yendor or fakes,
* and no oc_prop even if you could -3.
*/
break;
}
}
@@ -2171,12 +2172,12 @@ STATIC_OVL int
edibility_prompts(otmp)
struct obj *otmp;
{
/* blessed food detection granted you a one-use
ability to detect food that is unfit for consumption
or dangerous and avoid it. */
char buf[BUFSZ], foodsmell[BUFSZ], it_or_they[QBUFSZ],
eat_it_anyway[QBUFSZ];
/* Blessed food detection grants hero a one-use
* ability to detect food that is unfit for consumption
* or dangerous and avoid it.
*/
char buf[BUFSZ], foodsmell[BUFSZ],
it_or_they[QBUFSZ], eat_it_anyway[QBUFSZ];
boolean cadaver = (otmp->otyp == CORPSE), stoneorslime = FALSE;
int material = objects[otmp->otyp].oc_material, mnum = otmp->corpsenm;
long rotted = 0L;
@@ -2210,7 +2211,6 @@ struct obj *otmp;
* These problems with food should be checked in
* order from most detrimental to least detrimental.
*/
if (cadaver && mnum != PM_ACID_BLOB && rotted > 5L && !Sick_resistance) {
/* Tainted meat */
Sprintf(buf, "%s like %s could be tainted! %s", foodsmell, it_or_they,
@@ -2334,8 +2334,8 @@ doeat()
if (u.uedibility) {
int res = edibility_prompts(otmp);
if (res) {
Your("%s stops tingling and your sense of smell returns to "
"normal.",
Your(
"%s stops tingling and your sense of smell returns to normal.",
body_part(NOSE));
u.uedibility = 0;
if (res == 1)
@@ -2564,8 +2564,8 @@ doeat()
/* possible if most has been eaten before */
context.victual.nmod = 0;
else if ((int) otmp->oeaten >= context.victual.reqtime)
context.victual.nmod =
-((int) otmp->oeaten / context.victual.reqtime);
context.victual.nmod = -((int) otmp->oeaten
/ context.victual.reqtime);
else
context.victual.nmod = context.victual.reqtime % otmp->oeaten;
context.victual.canchoke = (u.uhs == SATIATED);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 lock.c $NHDT-Date: 1446604112 2015/11/04 02:28:32 $ $NHDT-Branch: master $:$NHDT-Revision: 1.65 $ */
/* NetHack 3.6 lock.c $NHDT-Date: 1446808444 2015/11/06 11:14:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.66 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -45,10 +45,12 @@ STATIC_OVL const char *
lock_action()
{
/* "unlocking"+2 == "locking" */
static const char *actions[] = { /* [0] */ "unlocking the door",
/* [1] */ "unlocking the chest",
/* [2] */ "unlocking the box",
/* [3] */ "picking the lock" };
static const char *actions[] = {
"unlocking the door", /* [0] */
"unlocking the chest", /* [1] */
"unlocking the box", /* [2] */
"picking the lock" /* [3] */
};
/* if the target is currently unlocked, we're trying to lock it now */
if (xlock.door && !(xlock.door->doormask & D_LOCKED))
@@ -191,7 +193,6 @@ forcelock(VOID_ARGS)
}
if (xlock.picktyp) { /* blade */
if (rn2(1000 - (int) uwep->spe) > (992 - greatest_erosion(uwep) * 10)
&& !uwep->cursed && !obj_resists(uwep, 0, 99)) {
/* for a +0 weapon, probability that it survives an unsuccessful
@@ -530,13 +531,6 @@ doforce()
return 1;
}
/* try to open a door */
int
doopen()
{
return doopen_indir(0, 0);
}
boolean
stumble_on_door_mimic(x, y)
int x, y;
@@ -551,6 +545,13 @@ int x, y;
return FALSE;
}
/* the 'O' command - try to open a door */
int
doopen()
{
return doopen_indir(0, 0);
}
/* try to open a door in direction u.dx/u.dy */
int
doopen_indir(x, y)
@@ -694,7 +695,7 @@ boolean quietly;
return FALSE;
}
/* try to close a door */
/* the 'C' command - try to close a door */
int
doclose()
{

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 makemon.c $NHDT-Date: 1445556868 2015/10/22 23:34:28 $ $NHDT-Branch: master $:$NHDT-Revision: 1.99 $ */
/* NetHack 3.6 makemon.c $NHDT-Date: 1446808445 2015/11/06 11:14:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.100 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -33,7 +33,7 @@ extern const int monstr[];
boolean
is_home_elemental(ptr)
register struct permonst *ptr;
struct permonst *ptr;
{
if (ptr->mlet == S_ELEMENTAL)
switch (monsndx(ptr)) {
@@ -54,10 +54,10 @@ register struct permonst *ptr;
*/
STATIC_OVL boolean
wrong_elem_type(ptr)
register struct permonst *ptr;
struct permonst *ptr;
{
if (ptr->mlet == S_ELEMENTAL) {
return ((boolean)(!is_home_elemental(ptr)));
return (boolean) !is_home_elemental(ptr);
} else if (Is_earthlevel(&u.uz)) {
/* no restrictions? */
} else if (Is_waterlevel(&u.uz)) {
@@ -75,7 +75,9 @@ register struct permonst *ptr;
return FALSE;
}
STATIC_OVL void m_initgrp(mtmp, x, y, n) /* make a group just like mtmp */
/* make a group just like mtmp */
STATIC_OVL void
m_initgrp(mtmp, x, y, n)
register struct monst *mtmp;
register int x, y, n;
{
@@ -165,18 +167,18 @@ register struct monst *mtmp;
register struct permonst *ptr = mtmp->data;
register int mm = monsndx(ptr);
struct obj *otmp;
int bias, spe2, w1, w2;
if (Is_rogue_level(&u.uz))
return;
/*
* first a few special cases:
*
* giants get a boulder to throw sometimes.
* ettins get clubs
* kobolds get darts to throw
* centaurs get some sort of bow & arrows or bolts
* soldiers get all sorts of things.
* kops get clubs & cream pies.
* First a few special cases:
* giants get a boulder to throw sometimes
* ettins get clubs
* kobolds get darts to throw
* centaurs get some sort of bow & arrows or bolts
* soldiers get all sorts of things
* kops get clubs & cream pies.
*/
switch (ptr->mlet) {
case S_GIANT:
@@ -185,7 +187,7 @@ register struct monst *mtmp;
break;
case S_HUMAN:
if (is_mercenary(ptr)) {
int w1 = 0, w2 = 0;
w1 = w2 = 0;
switch (mm) {
case PM_WATCHMAN:
case PM_SOLDIER:
@@ -272,8 +274,6 @@ register struct monst *mtmp;
case S_ANGEL:
if (humanoid(ptr)) {
int spe2;
/* create minion stuff; can't use mongets */
otmp = mksobj(LONG_SWORD, FALSE, FALSE);
@@ -336,9 +336,9 @@ register struct monst *mtmp;
}
}
break;
case S_KOP: /* create Keystone Kops with cream pies to
* throw. As suggested by KAA. [MRS]
*/
case S_KOP:
/* create Keystone Kops with cream pies to
throw. As suggested by KAA. [MRS] */
if (!rn2(4))
m_initthrow(mtmp, CREAM_PIE, 2);
if (!rn2(3))
@@ -347,8 +347,8 @@ register struct monst *mtmp;
case S_ORC:
if (rn2(2))
(void) mongets(mtmp, ORCISH_HELM);
switch (mm != PM_ORC_CAPTAIN ? mm : rn2(2) ? PM_MORDOR_ORC
: PM_URUK_HAI) {
switch ((mm != PM_ORC_CAPTAIN) ? mm
: rn2(2) ? PM_MORDOR_ORC : PM_URUK_HAI) {
case PM_MORDOR_ORC:
if (!rn2(3))
(void) mongets(mtmp, SCIMITAR);
@@ -458,15 +458,13 @@ register struct monst *mtmp;
*/
if (!is_demon(ptr))
break;
/* fall thru */
/*
* Now the general case, Some chance of getting some type
* of weapon for "normal" monsters. Certain special types
* of monsters will get a bonus chance or different selections.
*/
default: {
int bias;
/*FALLTHRU*/
default:
/*
* Now the general case, some chance of getting some type
* of weapon for "normal" monsters. Certain special types
* of monsters will get a bonus chance or different selections.
*/
bias = is_lord(ptr) + is_prince(ptr) * 2 + extra_nasty(ptr);
switch (rnd(14 - (2 * bias))) {
case 1:
@@ -502,8 +500,9 @@ register struct monst *mtmp;
default:
break;
}
} break;
break;
}
if ((int) mtmp->m_lev > rn2(75))
(void) mongets(mtmp, rnd_offensive_item(mtmp));
}
@@ -518,6 +517,7 @@ struct monst *mtmp;
long amount;
{
struct obj *gold = mksobj(GOLD_PIECE, FALSE, FALSE);
gold->quan = amount;
add_to_minv(mtmp, gold);
}
@@ -529,11 +529,12 @@ register struct monst *mtmp;
register int cnt;
register struct obj *otmp;
register struct permonst *ptr = mtmp->data;
if (Is_rogue_level(&u.uz))
return;
/*
* Soldiers get armour & rations - armour approximates their ac.
* Nymphs may get mirror or potion of object detection.
* Soldiers get armour & rations - armour approximates their ac.
* Nymphs may get mirror or potion of object detection.
*/
switch (ptr->mlet) {
case S_HUMAN:
@@ -842,8 +843,7 @@ boolean ghostly;
{
boolean result;
uchar lim = mbirth_limit(mndx);
boolean gone =
(mvitals[mndx].mvflags & G_GONE); /* genocided or extinct */
boolean gone = (mvitals[mndx].mvflags & G_GONE) != 0; /* geno'd|extinct */
result = (((int) mvitals[mndx].born < lim) && !gone) ? TRUE : FALSE;
@@ -944,7 +944,6 @@ newmextra()
return mextra;
}
boolean
makemon_rnd_goodpos(mon, gpflags, cc)
struct monst *mon;
@@ -954,12 +953,14 @@ coord *cc;
int tryct = 0;
int nx,ny;
boolean good;
do {
nx = rn1(COLNO - 3, 2);
ny = rn2(ROWNO);
if (!in_mklev && cansee(nx,ny)) good = FALSE;
else good = goodpos(nx, ny, mon, gpflags);
good = (!in_mklev && cansee(nx,ny)) ? FALSE
: goodpos(nx, ny, mon, gpflags);
} while ((++tryct < 50) && !good);
if (!good) {
/* else go through all map positions, twice, first round
ignoring positions in sight, and pick first good one.
@@ -968,12 +969,14 @@ coord *cc;
int yofs = ny;
int dx,dy;
int bl = (in_mklev || Blind) ? 1 : 0;
for ( ; bl < 2; bl++) {
for (dx = 0; dx < COLNO; dx++)
for (dy = 0; dy < ROWNO; dy++) {
nx = ((dx + xofs) % (COLNO - 1)) + 1;
ny = ((dy + yofs) % (ROWNO - 1)) + 1;
if ((bl == 0) && cansee(nx,ny)) continue;
if (bl == 0 && cansee(nx,ny))
continue;
if (goodpos(nx, ny, mon, gpflags))
goto gotgood;
}
@@ -1008,16 +1011,16 @@ coord *cc;
/*
* called with [x,y] = coordinates;
* [0,0] means anyplace
* [u.ux,u.uy] means: near player (if !in_mklev)
* [0,0] means anyplace
* [u.ux,u.uy] means: near player (if !in_mklev)
*
* In case we make a monster group, only return the one at [x,y].
* In case we make a monster group, only return the one at [x,y].
*/
struct monst *
makemon(ptr, x, y, mmflags)
register struct permonst *ptr;
register int x, y;
register int mmflags;
int mmflags;
{
register struct monst *mtmp;
int mndx, mcham, ct, mitem;
@@ -1033,8 +1036,9 @@ register int mmflags;
struct monst fakemon;
fakemon.data = ptr; /* set up for goodpos */
if (!makemon_rnd_goodpos(ptr ? &fakemon : (struct monst *)0, gpflags, &cc))
return ((struct monst *) 0);
if (!makemon_rnd_goodpos(ptr ? &fakemon : (struct monst *)0,
gpflags, &cc))
return (struct monst *) 0;
x = cc.x;
y = cc.y;
} else if (byyou && !in_mklev) {
@@ -1044,7 +1048,7 @@ register int mmflags;
x = bypos.x;
y = bypos.y;
} else
return ((struct monst *) 0);
return (struct monst *) 0;
}
/* Does monster already exist at the position? */
@@ -1055,9 +1059,9 @@ register int mmflags;
x = bypos.x;
y = bypos.y;
} else
return ((struct monst *) 0);
return (struct monst *) 0;
} else
return ((struct monst *) 0);
return (struct monst *) 0;
}
if (ptr) {
@@ -1065,7 +1069,7 @@ register int mmflags;
/* if you are to make a specific monster and it has
already been genocided, return */
if (mvitals[mndx].mvflags & G_GENOD)
return ((struct monst *) 0);
return (struct monst *) 0;
if (wizard && (mvitals[mndx].mvflags & G_EXTINCT))
debugpline1("Explicitly creating extinct monster %s.",
mons[mndx].mname);
@@ -1081,7 +1085,7 @@ register int mmflags;
do {
if (!(ptr = rndmonst())) {
debugpline0("Warning: no monster.");
return ((struct monst *) 0); /* no more monsters! */
return (struct monst *) 0; /* no more monsters! */
}
fakemon.data = ptr; /* set up for goodpos */
} while (++tryct <= 50
@@ -1227,8 +1231,9 @@ register int mmflags;
(void) mongets(mtmp, mitem);
if (in_mklev) {
if (((is_ndemon(ptr)) || (mndx == PM_WUMPUS) || (mndx == PM_LONG_WORM)
|| (mndx == PM_GIANT_EEL)) && !u.uhave.amulet && rn2(5))
if ((is_ndemon(ptr) || mndx == PM_WUMPUS
|| mndx == PM_LONG_WORM || mndx == PM_GIANT_EEL)
&& !u.uhave.amulet && rn2(5))
mtmp->msleeping = TRUE;
} else {
if (byyou) {
@@ -1246,8 +1251,7 @@ register int mmflags;
if (mndx == PM_LONG_WORM && (mtmp->wormno = get_wormno()) != 0)
#else
/* DICE 3.0 doesn't like assigning and comparing mtmp->wormno in the
* same expression.
*/
same expression. */
if (mndx == PM_LONG_WORM
&& (mtmp->wormno = get_wormno(), mtmp->wormno != 0))
#endif
@@ -1310,7 +1314,7 @@ register int mmflags;
if (!in_mklev)
newsym(mtmp->mx, mtmp->my); /* make sure the mon shows up */
return (mtmp);
return mtmp;
}
int
@@ -1365,15 +1369,15 @@ int mndx;
if (mvitals[mndx].mvflags & G_GONE)
return TRUE;
if (Inhell)
return (mons[mndx].maligntyp > A_NEUTRAL);
return (boolean) (mons[mndx].maligntyp > A_NEUTRAL);
else
return ((mons[mndx].geno & G_HELL) != 0);
return (boolean) ((mons[mndx].geno & G_HELL) != 0);
}
/*
* shift the probability of a monster's generation by
* comparing the dungeon alignment and monster alignment.
* return an integer in the range of 0-5.
* shift the probability of a monster's generation by
* comparing the dungeon alignment and monster alignment.
* return an integer in the range of 0-5.
*/
STATIC_OVL int
align_shift(ptr)
@@ -1446,11 +1450,9 @@ rndmonst()
elemlevel = In_endgame(&u.uz) && !Is_astralevel(&u.uz);
/*
* Find out how many monsters exist in the range we have
*selected.
* Find out how many monsters exist in the range we have selected.
*/
/* (`mndx' initialized above) */
for (; mndx < SPECIAL_PM; mndx++) {
for ( ; mndx < SPECIAL_PM; mndx++) { /* (`mndx' initialized above) */
ptr = &mons[mndx];
rndmonst_state.mchoices[mndx] = 0;
if (tooweak(mndx, minmlev) || toostrong(mndx, maxmlev))
@@ -1470,8 +1472,8 @@ rndmonst()
rndmonst_state.mchoices[mndx] = (char) ct;
}
/*
* Possible modification: if choice_count is "too low",
* expand minmlev..maxmlev range and try again.
* Possible modification: if choice_count is "too low",
* expand minmlev..maxmlev range and try again.
*/
} /* choice_count+mchoices[] recalc */
@@ -1482,7 +1484,7 @@ rndmonst()
}
/*
* Now, select a monster at random.
* Now, select a monster at random.
*/
ct = rnd(rndmonst_state.choice_count);
for (mndx = LOW_PM; mndx < SPECIAL_PM; mndx++)
@@ -1532,13 +1534,11 @@ int mndx, mvflagsmask, genomask;
return TRUE;
}
/* The routine below is used to make one of the multiple types
* of a given monster class. The second parameter specifies a
* special casing bit mask to allow the normal genesis
* masks to be deactivated. Returns 0 if no monsters
* in that class can be made.
/* Make one of the multiple types of a given monster class.
* The second parameter specifies a special casing bit mask
* to allow the normal genesis masks to be deactivated.
* Returns Null if no monsters in that class can be made.
*/
struct permonst *
mkclass(class, spc)
char class;
@@ -1550,10 +1550,10 @@ int spc;
maxmlev = level_difficulty() >> 1;
if (class < 1 || class >= MAXMCLASSES) {
impossible("mkclass called with bad class!");
return ((struct permonst *) 0);
return (struct permonst *) 0;
}
/* Assumption #1: monsters of a given class are contiguous in the
* mons[] array.
/* Assumption #1: monsters of a given class are contiguous in the
* mons[] array.
*/
for (first = LOW_PM; first < SPECIAL_PM; first++)
if (mons[first].mlet == class)
@@ -1569,12 +1569,11 @@ int spc;
break;
num += mons[last].geno & G_FREQ;
}
if (!num)
return ((struct permonst *) 0);
return (struct permonst *) 0;
/* Assumption #2: monsters of a given class are presented in ascending
* order of strength.
/* Assumption #2: monsters of a given class are presented in ascending
* order of strength.
*/
for (num = rnd(num); num > 0; first++)
if (mk_gen_ok(first, G_GONE, mask)) {
@@ -1588,14 +1587,15 @@ int spc;
}
first--; /* correct an off-by-one error */
return (&mons[first]);
return &mons[first];
}
/* like mkclass(), but excludes difficulty considerations; used when
player with polycontrol picks a class instead of a specific type;
genocided types are avoided but extinct ones are acceptable; we don't
check polyok() here--caller accepts some choices !polyok() would reject */
int mkclass_poly(class)
int
mkclass_poly(class)
int class;
{
register int first, last, num = 0;
@@ -1620,7 +1620,9 @@ int class;
return first;
}
int adj_lev(ptr) /* adjust strength of monsters based on u.uz and u.ulevel */
/* adjust strength of monsters based on u.uz and u.ulevel */
int
adj_lev(ptr)
register struct permonst *ptr;
{
int tmp, tmp2;
@@ -1636,7 +1638,7 @@ register struct permonst *ptr;
}
if ((tmp = ptr->mlevel) > 49)
return (50); /* "special" demons/devils */
return 50; /* "special" demons/devils */
tmp2 = (level_difficulty() - tmp);
if (tmp2 < 0)
tmp--; /* if mlevel > u.uz decrement tmp */
@@ -1653,8 +1655,10 @@ register struct permonst *ptr;
return ((tmp > tmp2) ? tmp2 : (tmp > 0 ? tmp : 0)); /* 0 lower limit */
}
/* monster earned experience and will gain some hit points; it might also
grow into a bigger monster (baby to adult, soldier to officer, etc) */
struct permonst *
grow_up(mtmp, victim) /* `mtmp' might "grow up" into a bigger version */
grow_up(mtmp, victim)
struct monst *mtmp, *victim;
{
int oldtype, newtype, max_increase, cur_increase, lev_limit, hp_threshold;
@@ -1663,7 +1667,7 @@ struct monst *mtmp, *victim;
/* monster died after killing enemy but before calling this function */
/* currently possible if killing a gas spore */
if (mtmp->mhp <= 0)
return ((struct permonst *) 0);
return (struct permonst *) 0;
/* note: none of the monsters with special hit point calculations
have both little and big forms */
@@ -1674,12 +1678,12 @@ struct monst *mtmp, *victim;
/* growth limits differ depending on method of advancement */
if (victim) { /* killed a monster */
/*
* The HP threshold is the maximum number of hit points for the
* current level; once exceeded, a level will be gained.
* Possible bug: if somehow the hit points are already higher
* than that, monster will gain a level without any increase in HP.
*/
/*
* The HP threshold is the maximum number of hit points for the
* current level; once exceeded, a level will be gained.
* Possible bug: if somehow the hit points are already higher
* than that, monster will gain a level without any increase in HP.
*/
hp_threshold = mtmp->m_lev * 8; /* normal limit */
if (!mtmp->m_lev)
hp_threshold = 4;
@@ -1755,7 +1759,7 @@ struct monst *mtmp, *victim;
int
mongets(mtmp, otyp)
register struct monst *mtmp;
register int otyp;
int otyp;
{
register struct obj *otmp;
int spe;
@@ -1800,9 +1804,9 @@ register int otyp;
spe = otmp->spe;
(void) mpickobj(mtmp, otmp); /* might free otmp */
return (spe);
} else
return (0);
return spe;
}
return 0;
}
int
@@ -1838,8 +1842,8 @@ int type;
}
/*
* Alignment vs. yours determines monster's attitude to you.
* ( some "animal" types are co-aligned, but also hungry )
* Alignment vs. yours determines monster's attitude to you.
* (Some "animal" types are co-aligned, but also hungry.)
*/
boolean
peace_minded(ptr)
@@ -1872,15 +1876,15 @@ register struct permonst *ptr;
/* minions are hostile to players that have strayed at all */
if (is_minion(ptr))
return ((boolean)(u.ualign.record >= 0));
return (boolean) (u.ualign.record >= 0);
/* Last case: a chance of a co-aligned monster being
* hostile. This chance is greater if the player has strayed
* (u.ualign.record negative) or the monster is not strongly aligned.
*/
return (
(boolean)(!!rn2(16 + (u.ualign.record < -15 ? -15 : u.ualign.record))
&& !!rn2(2 + abs(mal))));
return (boolean) (!!rn2(16 + (u.ualign.record < -15 ? -15
: u.ualign.record))
&& !!rn2(2 + abs(mal)));
}
/* Set malign to have the proper effect on player alignment if monster is
@@ -1890,8 +1894,8 @@ register struct permonst *ptr;
* greater than the bonus for killing a hostile monster to maintain balance.
* Rules:
* it's bad to kill peaceful monsters, potentially worse to kill always-
* peaceful monsters
* it's never bad to kill a hostile monster, although it may not be good
* peaceful monsters;
* it's never bad to kill a hostile monster, although it may not be good.
*/
void
set_malign(mtmp)
@@ -2085,8 +2089,7 @@ register struct monst *mtmp;
}
}
/* release a monster from a bag of tricks; return number of monsters created
*/
/* release monster frome bag of tricks; return number of monsters created */
int
bagotricks(bag, tipping, seencount)
struct obj *bag;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 monmove.c $NHDT-Date: 1446604115 2015/11/04 02:28:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.77 $ */
/* NetHack 3.6 monmove.c $NHDT-Date: 1446808446 2015/11/06 11:14:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.78 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -567,17 +567,15 @@ toofar:
if (tmp != 2)
distfleeck(mtmp, &inrange, &nearby, &scared); /* recalc */
switch (tmp) {
switch (tmp) { /* for pets, cases 0 and 3 are equivalent */
case 0: /* no movement, but it can still attack you */
case 3: /* absolutely no movement */
/* for pets, case 0 and 3 are equivalent */
/* vault guard might have vanished */
if (mtmp->isgd
&& (mtmp->mhp < 1 || (mtmp->mx == 0 && mtmp->my == 0)))
if (mtmp->isgd && (mtmp->mhp < 1 || !mtmp->mx == 0))
return 1; /* behave as if it died */
/* During hallucination, monster appearance should
* still change - even if it doesn't move.
*/
/* During hallucination, monster appearance should
* still change - even if it doesn't move.
*/
if (Hallucination)
newsym(mtmp->mx, mtmp->my);
break;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mthrowu.c $NHDT-Date: 1446604116 2015/11/04 02:28:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.61 $ */
/* NetHack 3.6 mthrowu.c $NHDT-Date: 1446808447 2015/11/06 11:14:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -135,9 +135,9 @@ int
ohitmon(mtmp, otmp, range, verbose)
struct monst *mtmp; /* accidental target, located at <bhitpos.x,.y> */
struct obj *otmp; /* missile; might be destroyed by drop_throw */
int range; /* how much farther will object travel if it misses */
/* Use -1 to signify to keep going even after hit, */
/* unless its gone (used for rolling_boulder_traps) */
int range; /* how much farther will object travel if it misses;
use -1 to signify to keep going even after hit,
unless it's gone (used for rolling_boulder_traps) */
boolean verbose; /* give message(s) even when you can't see what happened */
{
int damage, tmp;

View File

@@ -1,5 +1,5 @@
/* NetHack 3.6 music.c $NHDT-Date: 1432512773 2015/05/25 00:12:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.38 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack 3.6 music.c $NHDT-Date: 1446808448 2015/11/06 11:14:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
/*
@@ -8,23 +8,22 @@
*
* Actually the list of instruments / effects is :
*
* (wooden) flute may calm snakes if player has enough dexterity
* magic flute may put monsters to sleep: area of effect depends
* on player level.
* (tooled) horn Will awaken monsters: area of effect depends on
*player
* level. May also scare monsters.
* fire horn Acts like a wand of fire.
* frost horn Acts like a wand of cold.
* bugle Will awaken soldiers (if any): area of effect depends
* on player level.
* (wooden) harp May calm nymph if player has enough dexterity.
* magic harp Charm monsters: area of effect depends on player
* level.
* (leather) drum Will awaken monsters like the horn.
* drum of earthquake Will initiate an earthquake whose intensity depends
* on player level. That is, it creates random pits
* called here chasms.
* (wooden) flute may calm snakes if player has enough dexterity
* magic flute may put monsters to sleep: area of effect depends
* on player level.
* (tooled) horn Will awaken monsters: area of effect depends on
* player level. May also scare monsters.
* fire horn Acts like a wand of fire.
* frost horn Acts like a wand of cold.
* bugle Will awaken soldiers (if any): area of effect depends
* on player level.
* (wooden) harp May calm nymph if player has enough dexterity.
* magic harp Charm monsters: area of effect depends on player
* level.
* (leather) drum Will awaken monsters like the horn.
* drum of earthquake Will initiate an earthquake whose intensity depends
* on player level. That is, it creates random pits
* called here chasms.
*/
#include "hack.h"
@@ -73,7 +72,8 @@ int distance;
mtmp->mcanmove = 1;
mtmp->mfrozen = 0;
/* may scare some monsters -- waiting monsters excluded */
if (!unique_corpstat(mtmp->data) && (mtmp->mstrategy & STRAT_WAITMASK) != 0)
if (!unique_corpstat(mtmp->data)
&& (mtmp->mstrategy & STRAT_WAITMASK) != 0)
mtmp->mstrategy &= ~STRAT_WAITMASK;
else if (distm < distance / 3
&& !resist(mtmp, TOOL_CLASS, 0, NOTELL))
@@ -160,7 +160,7 @@ int distance;
if (canseemon(mtmp))
pline(
"%s listens cheerfully to the music, then seems quieter.",
Monnam(mtmp));
Monnam(mtmp));
}
}
}
@@ -195,7 +195,8 @@ struct monst *bugler; /* monster that played instrument */
mtmp->mcanmove = 1;
mtmp->mfrozen = 0;
/* may scare some monsters -- waiting monsters excluded */
if (!unique_corpstat(mtmp->data) && (mtmp->mstrategy & STRAT_WAITMASK) != 0)
if (!unique_corpstat(mtmp->data)
&& (mtmp->mstrategy & STRAT_WAITMASK) != 0)
mtmp->mstrategy &= ~STRAT_WAITMASK;
else if (distm < distance / 3
&& !resist(mtmp, TOOL_CLASS, 0, NOTELL))
@@ -207,7 +208,6 @@ struct monst *bugler; /* monster that played instrument */
/* Charm monsters in range. Note that they may resist the spell.
* If swallowed, range is reduced to 0.
*/
STATIC_OVL void
charm_monsters(distance)
int distance;
@@ -234,7 +234,6 @@ int distance;
/* Generate earthquake :-) of desired force.
* That is: create random chasms (pits).
*/
STATIC_OVL void
do_earthquake(force)
int force;
@@ -338,7 +337,6 @@ int force;
/* We have to check whether monsters or player
falls in a chasm... */
if (mtmp) {
if (!is_flyer(mtmp->data)
&& !is_clinger(mtmp->data)) {
@@ -431,7 +429,6 @@ int force;
/*
* The player is trying to extract something from his/her instrument.
*/
STATIC_OVL int
do_improvisation(instr)
struct obj *instr;
@@ -497,9 +494,9 @@ struct obj *instr;
} else if (!u.dx && !u.dy && !u.dz) {
if ((damage = zapyourself(instr, TRUE)) != 0) {
char buf[BUFSZ];
Sprintf(buf, "using a magical horn on %sself", uhim());
losehp(damage, buf, KILLED_BY); /* frost damage */
/* fire damage */
losehp(damage, buf, KILLED_BY); /* fire or frost damage */
}
} else {
buzz((instr->otyp == FROST_HORN) ? AD_COLD - 1 : AD_FIRE - 1,
@@ -563,7 +560,6 @@ struct obj *instr;
/*
* So you want music...
*/
int
do_play_instrument(instr)
struct obj *instr;
@@ -575,13 +571,13 @@ struct obj *instr;
if (Underwater) {
You_cant("play music underwater!");
return (0);
return 0;
} else if ((instr->otyp == WOODEN_FLUTE || instr->otyp == MAGIC_FLUTE
|| instr->otyp == TOOLED_HORN || instr->otyp == FROST_HORN
|| instr->otyp == FIRE_HORN || instr->otyp == BUGLE)
&& !can_blow(&youmonst)) {
You("are incapable of playing %s.", the(distant_name(instr, xname)));
return (0);
return 0;
}
if (instr->otyp != LEATHER_DRUM && instr->otyp != DRUM_OF_EARTHQUAKE) {
c = ynq("Improvise?");
@@ -634,6 +630,7 @@ struct obj *instr;
{
char nbuf[20];
int i;
for (i = 0; buf[i] && i < 5; ++i) {
nbuf[i * 2] = buf[i];
nbuf[(i * 2) + 1] = 'h';
@@ -799,9 +796,9 @@ char *buf;
#define noDEBUG
/* emit tone of frequency hz for given number of ticks */
STATIC_OVL void
tone(hz, ticks)
/* emit tone of frequency hz for given number of ticks */
unsigned int hz, ticks;
{
ioctl(0, KDMKTONE, hz | ((ticks * 10) << 16));
@@ -811,9 +808,9 @@ unsigned int hz, ticks;
nap(ticks * 10);
}
/* rest for given number of ticks */
STATIC_OVL void
rest(ticks)
/* rest for given number of ticks */
int ticks;
{
nap(ticks * 10);
@@ -852,8 +849,10 @@ char *buf;
playstring(buf, strlen(buf));
}
#ifdef DEBUG
main(argc, argv) char *argv[];
#ifdef VPIX_DEBUG
main(argc, argv)
int argc;
char *argv[];
{
if (argc == 2) {
playinit();

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 options.c $NHDT-Date: 1446336796 2015/11/01 00:13:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.234 $ */
/* NetHack 3.6 options.c $NHDT-Date: 1446808448 2015/11/06 11:14:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.235 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -427,26 +427,26 @@ static char def_inv_order[MAXOCLASSES] = {
/*
* Default menu manipulation command accelerators. These may _not_ be:
*
* + a number - reserved for counts
* + an upper or lower case US ASCII letter - used for accelerators
* + ESC - reserved for escaping the menu
* + NULL, CR or LF - reserved for commiting the selection(s). NULL
* is kind of odd, but the tty's xwaitforspace() will return it if
* someone hits a <ret>.
* + a default object class symbol - used for object class accelerators
* + a number - reserved for counts
* + an upper or lower case US ASCII letter - used for accelerators
* + ESC - reserved for escaping the menu
* + NULL, CR or LF - reserved for commiting the selection(s). NULL
* is kind of odd, but the tty's xwaitforspace() will return it if
* someone hits a <ret>.
* + a default object class symbol - used for object class accelerators
*
* Standard letters (for now) are:
*
* < back 1 page
* > forward 1 page
* ^ first page
* | last page
* : search
* < back 1 page
* > forward 1 page
* ^ first page
* | last page
* : search
*
* page all
* , select .
* \ deselect -
* ~ invert @
* page all
* , select .
* \ deselect -
* ~ invert @
*
* The command name list is duplicated in the compopt array.
*/
@@ -493,8 +493,8 @@ STATIC_DCL int FDECL(change_inv_order, (char *));
STATIC_DCL void FDECL(oc_to_str, (char *, char *));
STATIC_DCL int FDECL(feature_alert_opts, (char *, const char *));
STATIC_DCL const char *FDECL(get_compopt_value, (const char *, char *));
STATIC_DCL boolean
FDECL(special_handling, (const char *, BOOLEAN_P, BOOLEAN_P));
STATIC_DCL boolean FDECL(special_handling, (const char *,
BOOLEAN_P, BOOLEAN_P));
STATIC_DCL void FDECL(warning_opts, (char *, const char *));
STATIC_DCL boolean FDECL(duplicate_opt_detection, (const char *, int));
STATIC_DCL void FDECL(complain_about_duplicate, (const char *, int));
@@ -525,7 +525,8 @@ reglyph_darkroom()
for (y = 0; y < ROWNO; y++) {
struct rm *lev = &levl[x][y];
if (!flags.dark_room || !iflags.use_color || Is_rogue_level(&u.uz)) {
if (!flags.dark_room || !iflags.use_color
|| Is_rogue_level(&u.uz)) {
if (lev->glyph == cmap_to_glyph(S_darkroom))
lev->glyph = lev->waslit ? cmap_to_glyph(S_room)
: cmap_to_glyph(S_stone);
@@ -1069,8 +1070,8 @@ const char *optn;
if (!initial) {
Sprintf(buf, "%lu.%lu.%lu", FEATURE_NOTICE_VER_MAJ,
FEATURE_NOTICE_VER_MIN, FEATURE_NOTICE_VER_PATCH);
pline("Feature change alerts disabled for NetHack %s features and "
"prior.",
pline(
"Feature change alerts disabled for NetHack %s features and prior.",
buf);
}
return 1;
@@ -1240,7 +1241,7 @@ int clr;
for (i = 0; i < SIZE(colornames); i++)
if (colornames[i].color == clr)
return colornames[i].name;
return NULL;
return (char *) 0;
}
const char *
@@ -1252,7 +1253,7 @@ int attr;
for (i = 0; i < SIZE(attrnames); i++)
if (attrnames[i].attr == attr)
return attrnames[i].name;
return NULL;
return (char *) 0;
}
int
@@ -1332,9 +1333,9 @@ int typ;
int i;
for (i = 0; i < SIZE(msgtype_names); i++)
if (msgtype_names[i].descr && msgtype_names[i].msgtyp == typ)
return msgtype_names[i].name;
return NULL;
if (msgtype_names[i].descr && msgtype_names[i].msgtyp == typ)
return msgtype_names[i].name;
return (char *) 0;
}
int
@@ -1349,11 +1350,11 @@ query_msgtype()
start_menu(tmpwin);
any = zeroany;
for (i = 0; i < SIZE(msgtype_names); i++)
if (msgtype_names[i].descr) {
any.a_int = msgtype_names[i].msgtyp + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
if (msgtype_names[i].descr) {
any.a_int = msgtype_names[i].msgtyp + 1;
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE,
msgtype_names[i].descr, MENU_UNSELECTED);
}
}
end_menu(tmpwin, "How to show the message");
pick_cnt = select_menu(tmpwin, PICK_ONE, &picks);
destroy_nhwindow(tmpwin);
@@ -1378,7 +1379,8 @@ char *pattern;
tmp->msgtype = typ;
tmp->regex = regex_init();
if (!regex_compile(pattern, tmp->regex)) {
static const char *re_error = "MSGTYPE regex error";
static const char *re_error = "MSGTYPE regex error";
if (!iflags.window_inited)
raw_printf("\n%s: %s\n", re_error, regex_error_desc(tmp->regex));
else
@@ -1397,17 +1399,15 @@ char *pattern;
void
msgtype_free()
{
struct plinemsg_type *tmp = plinemsg_types;
struct plinemsg_type *tmp2;
struct plinemsg_type *tmp, *tmp2 = 0;
while (tmp) {
free(tmp->pattern);
regex_free(tmp->regex);
tmp2 = tmp;
tmp = tmp->next;
free(tmp2);
for (tmp = plinemsg_types; tmp; tmp = tmp2) {
tmp2 = tmp->next;
free((genericptr_t) tmp->pattern);
regex_free(tmp->regex);
free((genericptr_t) tmp);
}
plinemsg_types = NULL;
plinemsg_types = (struct plinemsg_type *) 0;
}
void
@@ -1420,9 +1420,10 @@ int idx; /* 0 .. */
while (tmp) {
if (idx == 0) {
struct plinemsg_type *next = tmp->next;
regex_free(tmp->regex);
free(tmp->pattern);
free(tmp);
free((genericptr_t) tmp->pattern);
free((genericptr_t) tmp);
if (prev)
prev->next = next;
else
@@ -1442,8 +1443,9 @@ const char *msg;
struct plinemsg_type *tmp = plinemsg_types;
while (tmp) {
if (regex_match(msg, tmp->regex)) return tmp->msgtype;
tmp = tmp->next;
if (regex_match(msg, tmp->regex))
return tmp->msgtype;
tmp = tmp->next;
}
return MSGTYP_NORMAL;
}
@@ -1455,8 +1457,8 @@ msgtype_count()
struct plinemsg_type *tmp = plinemsg_types;
while (tmp) {
c++;
tmp = tmp->next;
c++;
tmp = tmp->next;
}
return c;
}
@@ -1469,15 +1471,16 @@ char *str;
char msgtype[11];
if (sscanf(str, "%10s \"%255[^\"]\"", msgtype, pattern) == 2) {
int typ = -1;
int i;
for (i = 0; i < SIZE(msgtype_names); i++)
if (!strncmpi(msgtype_names[i].name, msgtype, strlen(msgtype))) {
typ = msgtype_names[i].msgtyp;
break;
}
if (typ != -1)
return msgtype_add(typ, pattern);
int typ = -1;
int i;
for (i = 0; i < SIZE(msgtype_names); i++)
if (!strncmpi(msgtype_names[i].name, msgtype, strlen(msgtype))) {
typ = msgtype_names[i].msgtyp;
break;
}
if (typ != -1)
return msgtype_add(typ, pattern);
}
return FALSE;
}
@@ -1492,7 +1495,7 @@ int c, a;
if (!str)
return FALSE;
tmp = (struct menucoloring *) alloc(sizeof(struct menucoloring));
tmp = (struct menucoloring *) alloc(sizeof (struct menucoloring));
tmp->match = regex_init();
if (!regex_compile(str, tmp->match)) {
if (!iflags.window_inited)
@@ -1598,9 +1601,10 @@ free_menu_coloring()
while (tmp) {
struct menucoloring *tmp2 = tmp->next;
regex_free(tmp->match);
free(tmp->origstr);
free(tmp);
free((genericptr_t) tmp->origstr);
free((genericptr_t) tmp);
tmp = tmp2;
}
}
@@ -1615,9 +1619,10 @@ int idx; /* 0 .. */
while (tmp) {
if (idx == 0) {
struct menucoloring *next = tmp->next;
regex_free(tmp->match);
free(tmp->origstr);
free(tmp);
free((genericptr_t) tmp->origstr);
free((genericptr_t) tmp);
if (prev)
prev->next = next;
else
@@ -1861,8 +1866,8 @@ boolean tinitial, tfrom_file;
break;
case 'h': /* horse */
case 'q': /* quadruped */
/* avoids giving "unrecognized type of pet" but
pet_type(dog.c) won't actually honor this */
/* avoids giving "unrecognized type of pet" but
pet_type(dog.c) won't actually honor this */
preferred_pet = 'h';
break;
case 'n': /* no pet */
@@ -2054,6 +2059,7 @@ boolean tinitial, tfrom_file;
/* allow option to be silently ignored by non-tty ports */
#ifdef TTY_GRAPHICS
int tmp;
if (duplicate)
complain_about_duplicate(opts, 1);
if (!(op = string_for_opt(opts, TRUE))) {
@@ -2244,8 +2250,8 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, "fruit", 2, TRUE)) {
struct fruit *forig = 0;
char empty_str = '\0';
if (duplicate)
complain_about_duplicate(opts, 1);
op = string_for_opt(opts, negated);
@@ -2320,7 +2326,7 @@ boolean tinitial, tfrom_file;
bad_negation(fullname, FALSE);
return;
}
/* if (!(opts = string_for_env_opt(fullname, opts, FALSE)))
/* if (!(opts = string_for_env_opt(fullname, opts, FALSE)))
*/
if (!(opts = string_for_opt(opts, FALSE)))
return;
@@ -2670,17 +2676,17 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, "disclose", 7, TRUE)) {
/*
* The order that the end_disclose options are stored:
* inventory, attribs, vanquished, genocided,
* conduct, overview.
* inventory, attribs, vanquished, genocided,
* conduct, overview.
* There is an array in flags:
* end_disclose[NUM_DISCLOSURE_OPT];
* end_disclose[NUM_DISCLOSURE_OPT];
* with option settings for the each of the following:
* iagvc [see disclosure_options in decl.c]:
* Legal setting values in that array are:
* DISCLOSE_PROMPT_DEFAULT_YES ask with default answer yes
* DISCLOSE_PROMPT_DEFAULT_NO ask with default answer no
* DISCLOSE_YES_WITHOUT_PROMPT always disclose and don't ask
* DISCLOSE_NO_WITHOUT_PROMPT never disclose and don't ask
* DISCLOSE_PROMPT_DEFAULT_YES ask with default answer yes
* DISCLOSE_PROMPT_DEFAULT_NO ask with default answer no
* DISCLOSE_YES_WITHOUT_PROMPT always disclose and don't ask
* DISCLOSE_NO_WITHOUT_PROMPT never disclose and don't ask
*
* Those setting values can be used in the option
* string as a prefix to get the desired behaviour.
@@ -3186,6 +3192,7 @@ boolean tinitial, tfrom_file;
fullname = "DECgraphics";
if (match_optname(opts, fullname, 3, TRUE)) {
boolean badflag = FALSE;
if (duplicate)
complain_about_duplicate(opts, 1);
if (!negated) {
@@ -3212,6 +3219,7 @@ boolean tinitial, tfrom_file;
if (match_optname(opts, fullname, 3, TRUE)) {
const char *sym_name = fullname;
boolean badflag = FALSE;
if (duplicate)
complain_about_duplicate(opts, 1);
if (!negated) {
@@ -3246,6 +3254,7 @@ boolean tinitial, tfrom_file;
fullname = "MACgraphics";
if (match_optname(opts, fullname, 3, TRUE)) {
boolean badflag = FALSE;
if (duplicate)
complain_about_duplicate(opts, 1);
if (!negated) {
@@ -3271,6 +3280,7 @@ boolean tinitial, tfrom_file;
return;
}
#endif
/* OK, if we still haven't recognized the option, check the boolean
* options list
*/
@@ -3638,27 +3648,27 @@ doset()
*/
for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx) {
opt_indx = pick_list[pick_idx].item.a_int - 1;
if (opt_indx == -2) { /* -3 due to -1 offset for select_menu() */
if (opt_indx == -2) {
/* -2 due to -1 offset for select_menu() */
(void) special_handling("autopickup_exception", setinitial,
fromfile);
} else
#ifdef STATUS_VIA_WINDOWPORT
#ifdef STATUS_HILITES
if (opt_indx
== -3) { /* -3 due to -1 offset for select_menu() */
if (!status_hilite_menu())
} else if (opt_indx == -3) {
/* -3 due to -1 offset for select_menu() */
if (!status_hilite_menu()) {
pline("Bad status hilite(s) specified.");
else {
} else {
if (wc2_supported("status_hilites"))
preference_update("status_hilites");
}
} else
#endif
#endif
if (opt_indx == -4) {
(void) special_handling("menucolors", setinitial, fromfile);
} else if (opt_indx == -5) {
(void) special_handling("msgtype", setinitial, fromfile);
} else if (opt_indx == -4) {
(void) special_handling("menucolors", setinitial,
fromfile);
} else if (opt_indx == -5) {
(void) special_handling("msgtype", setinitial, fromfile);
} else if (opt_indx < boolcount) {
/* boolean option */
Sprintf(buf, "%s%s", *boolopt[opt_indx].addr ? "!" : "",
@@ -4059,27 +4069,27 @@ boolean setinitial, setfromfile;
if (mhattr != -1)
iflags.menu_headings = mhattr;
} else if (!strcmp("msgtype", optname)) {
int opt_idx, nmt, mttyp;
char mtbuf[BUFSZ];
int opt_idx, nmt, mttyp;
char mtbuf[BUFSZ];
msgtypes_again:
nmt = msgtype_count();
opt_idx = handle_add_list_remove("message type", nmt);
if (opt_idx == 3) {
; /* done--fall through to function exit */
} else if (opt_idx == 0) { /* add new */
getlin("What new message pattern?", mtbuf);
if (*mtbuf == '\033' || !*mtbuf)
goto msgtypes_again;
mttyp = query_msgtype();
if (mttyp == -1)
goto msgtypes_again;
nmt = msgtype_count();
opt_idx = handle_add_list_remove("message type", nmt);
if (opt_idx == 3) {
; /* done--fall through to function exit */
} else if (opt_idx == 0) { /* add new */
getlin("What new message pattern?", mtbuf);
if (*mtbuf == '\033' || !*mtbuf)
goto msgtypes_again;
mttyp = query_msgtype();
if (mttyp == -1)
goto msgtypes_again;
if (!msgtype_add(mttyp, mtbuf)) {
pline("Error adding the message type.");
wait_synch();
goto msgtypes_again;
}
} else { /* list or remove */
pline("Error adding the message type.");
wait_synch();
goto msgtypes_again;
}
} else { /* list or remove */
int pick_idx, pick_cnt;
int mt_idx;
menu_item *pick_list = (menu_item *) 0;
@@ -4091,7 +4101,8 @@ boolean setinitial, setfromfile;
mt_idx = 0;
while (tmp) {
const char *mtype = msgtype2name(tmp->msgtype);
any.a_int = (++mt_idx);
any.a_int = ++mt_idx;
Sprintf(mtbuf, "%-5s \"%s\"", mtype, tmp->pattern);
add_menu(tmpwin, NO_GLYPH, &any, 0, 0, ATR_NONE, mtbuf,
MENU_UNSELECTED);
@@ -4100,8 +4111,9 @@ boolean setinitial, setfromfile;
Sprintf(mtbuf, "%s message types",
(opt_idx == 1) ? "List of" : "Remove which");
end_menu(tmpwin, mtbuf);
pick_cnt = select_menu(
tmpwin, (opt_idx == 1) ? PICK_NONE : PICK_ANY, &pick_list);
pick_cnt = select_menu(tmpwin,
(opt_idx == 1) ? PICK_NONE : PICK_ANY,
&pick_list);
if (pick_cnt > 0) {
for (pick_idx = 0; pick_idx < pick_cnt; ++pick_idx)
free_one_msgtype(pick_list[pick_idx].item.a_int - 1
@@ -4112,7 +4124,7 @@ boolean setinitial, setfromfile;
destroy_nhwindow(tmpwin);
if (pick_cnt >= 0)
goto msgtypes_again;
}
}
} else if (!strcmp("menucolors", optname)) {
int opt_idx, nmc, mcclr, mcattr;
char mcbuf[BUFSZ];
@@ -4535,39 +4547,34 @@ char *buf;
else if (!strcmp(optname, "horsename"))
Sprintf(buf, "%s", horsename[0] ? horsename : none);
else if (!strcmp(optname, "map_mode"))
Sprintf(
buf, "%s",
iflags.wc_map_mode == MAP_MODE_TILES
? "tiles"
: iflags.wc_map_mode == MAP_MODE_ASCII4x6
? "ascii4x6"
: iflags.wc_map_mode == MAP_MODE_ASCII6x8
? "ascii6x8"
: iflags.wc_map_mode == MAP_MODE_ASCII8x8
? "ascii8x8"
: iflags.wc_map_mode == MAP_MODE_ASCII16x8
? "ascii16x8"
: iflags.wc_map_mode
== MAP_MODE_ASCII7x12
? "ascii7x12"
: iflags.wc_map_mode
== MAP_MODE_ASCII8x12
? "ascii8x12"
: iflags.wc_map_mode
== MAP_MODE_ASCII16x12
? "ascii16x12"
: iflags.wc_map_mode
== MAP_MODE_ASCII12x16
? "ascii12x16"
: iflags.wc_map_mode
== MAP_MODE_ASCII10x18
? "asci"
"i10x"
"18"
: iflags.wc_map_mode
== MAP_MODE_ASCII_FIT_TO_SCREEN
? "fit_to_screen"
: defopt);
Sprintf(buf, "%s",
iflags.wc_map_mode == MAP_MODE_TILES
? "tiles"
: iflags.wc_map_mode == MAP_MODE_ASCII4x6
? "ascii4x6"
: iflags.wc_map_mode == MAP_MODE_ASCII6x8
? "ascii6x8"
: iflags.wc_map_mode == MAP_MODE_ASCII8x8
? "ascii8x8"
: iflags.wc_map_mode == MAP_MODE_ASCII16x8
? "ascii16x8"
: iflags.wc_map_mode == MAP_MODE_ASCII7x12
? "ascii7x12"
: iflags.wc_map_mode == MAP_MODE_ASCII8x12
? "ascii8x12"
: iflags.wc_map_mode
== MAP_MODE_ASCII16x12
? "ascii16x12"
: iflags.wc_map_mode
== MAP_MODE_ASCII12x16
? "ascii12x16"
: iflags.wc_map_mode
== MAP_MODE_ASCII10x18
? "ascii10x18"
: iflags.wc_map_mode
== MAP_MODE_ASCII_FIT_TO_SCREEN
? "fit_to_screen"
: defopt);
else if (!strcmp(optname, "menustyle"))
Sprintf(buf, "%s", menutype[(int) flags.menu_style]);
else if (!strcmp(optname, "menu_deselect_all"))
@@ -4623,17 +4630,16 @@ char *buf;
: Cmd.swap_yz ? 5 : 0;
Strcpy(buf, numpadmodes[indx]);
} else if (!strcmp(optname, "objects"))
} else if (!strcmp(optname, "objects")) {
Sprintf(buf, "%s", to_be_done);
else if (!strcmp(optname, "packorder")) {
} else if (!strcmp(optname, "packorder")) {
oc_to_str(flags.inv_order, ocl);
Sprintf(buf, "%s", ocl);
}
#ifdef CHANGE_COLOR
else if (!strcmp(optname, "palette"))
} else if (!strcmp(optname, "palette")) {
Sprintf(buf, "%s", get_color_string());
#endif
else if (!strcmp(optname, "paranoid_confirmation")) {
} else if (!strcmp(optname, "paranoid_confirmation")) {
char tmpbuf[QBUFSZ];
tmpbuf[0] = '\0';
@@ -4652,36 +4658,33 @@ char *buf;
if (ParanoidRemove)
Strcat(tmpbuf, " Remove");
Strcpy(buf, tmpbuf[0] ? &tmpbuf[1] : "none");
} else if (!strcmp(optname, "pettype"))
Sprintf(buf, "%s",
(preferred_pet == 'c')
? "cat"
: (preferred_pet == 'd')
? "dog"
: (preferred_pet == 'h')
? "horse"
: (preferred_pet == 'n') ? "none" : "random");
else if (!strcmp(optname, "pickup_burden"))
} else if (!strcmp(optname, "pettype")) {
Sprintf(buf, "%s", (preferred_pet == 'c') ? "cat"
: (preferred_pet == 'd') ? "dog"
: (preferred_pet == 'h') ? "horse"
: (preferred_pet == 'n') ? "none"
: "random");
} else if (!strcmp(optname, "pickup_burden")) {
Sprintf(buf, "%s", burdentype[flags.pickup_burden]);
else if (!strcmp(optname, "pickup_types")) {
} else if (!strcmp(optname, "pickup_types")) {
oc_to_str(flags.pickup_types, ocl);
Sprintf(buf, "%s", ocl[0] ? ocl : "all");
} else if (!strcmp(optname, "pile_limit"))
} else if (!strcmp(optname, "pile_limit")) {
Sprintf(buf, "%d", flags.pile_limit);
else if (!strcmp(optname, "playmode")) {
} else if (!strcmp(optname, "playmode")) {
Strcpy(buf, wizard ? "debug" : discover ? "explore" : "normal");
} else if (!strcmp(optname, "race"))
} else if (!strcmp(optname, "race")) {
Sprintf(buf, "%s", rolestring(flags.initrace, races, noun));
else if (!strcmp(optname, "roguesymset")) {
} else if (!strcmp(optname, "roguesymset")) {
Sprintf(buf, "%s",
symset[ROGUESET].name ? symset[ROGUESET].name : "default");
if (currentgraphics == ROGUESET && symset[ROGUESET].name)
Strcat(buf, ", active");
} else if (!strcmp(optname, "role"))
} else if (!strcmp(optname, "role")) {
Sprintf(buf, "%s", rolestring(flags.initrole, roles, name.m));
else if (!strcmp(optname, "runmode"))
} else if (!strcmp(optname, "runmode")) {
Sprintf(buf, "%s", runmodes[flags.runmode]);
else if (!strcmp(optname, "scores")) {
} else if (!strcmp(optname, "scores")) {
Sprintf(buf, "%d top/%d around%s", flags.end_top, flags.end_around,
flags.end_own ? "/own" : "");
} else if (!strcmp(optname, "scroll_amount")) {
@@ -4696,19 +4699,20 @@ char *buf;
Strcpy(buf, defopt);
} else if (!strcmp(optname, "sortloot")) {
char *sortname = (char *) NULL;
for (i = 0; i < SIZE(sortltype) && sortname == (char *) NULL; i++) {
if (flags.sortloot == sortltype[i][0])
sortname = (char *) sortltype[i];
}
if (sortname != (char *) NULL)
Sprintf(buf, "%s", sortname);
} else if (!strcmp(optname, "player_selection"))
} else if (!strcmp(optname, "player_selection")) {
Sprintf(buf, "%s", iflags.wc_player_selection ? "prompts" : "dialog");
#ifdef MSDOS
else if (!strcmp(optname, "soundcard"))
} else if (!strcmp(optname, "soundcard")) {
Sprintf(buf, "%s", to_be_done);
#endif
else if (!strcmp(optname, "suppress_alert")) {
} else if (!strcmp(optname, "suppress_alert")) {
if (flags.suppress_alert == 0L)
Strcpy(buf, none);
else
@@ -4719,10 +4723,10 @@ char *buf;
symset[PRIMARY].name ? symset[PRIMARY].name : "default");
if (currentgraphics == PRIMARY && symset[PRIMARY].name)
Strcat(buf, ", active");
} else if (!strcmp(optname, "tile_file"))
} else if (!strcmp(optname, "tile_file")) {
Sprintf(buf, "%s",
iflags.wc_tile_file ? iflags.wc_tile_file : defopt);
else if (!strcmp(optname, "tile_height")) {
} else if (!strcmp(optname, "tile_height")) {
if (iflags.wc_tile_height)
Sprintf(buf, "%d", iflags.wc_tile_height);
else
@@ -4732,22 +4736,21 @@ char *buf;
Sprintf(buf, "%d", iflags.wc_tile_width);
else
Strcpy(buf, defopt);
} else if (!strcmp(optname, "traps"))
} else if (!strcmp(optname, "traps")) {
Sprintf(buf, "%s", to_be_done);
else if (!strcmp(optname, "vary_msgcount")) {
} else if (!strcmp(optname, "vary_msgcount")) {
if (iflags.wc_vary_msgcount)
Sprintf(buf, "%d", iflags.wc_vary_msgcount);
else
Strcpy(buf, defopt);
}
#ifdef MSDOS
else if (!strcmp(optname, "video"))
} else if (!strcmp(optname, "video")) {
Sprintf(buf, "%s", to_be_done);
#endif
#ifdef VIDEOSHADES
else if (!strcmp(optname, "videoshades"))
} else if (!strcmp(optname, "videoshades")) {
Sprintf(buf, "%s-%s-%s", shade[0], shade[1], shade[2]);
else if (!strcmp(optname, "videocolors"))
} else if (!strcmp(optname, "videocolors")) {
Sprintf(buf, "%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d-%d",
ttycolors[CLR_RED], ttycolors[CLR_GREEN],
ttycolors[CLR_BROWN], ttycolors[CLR_BLUE],
@@ -4756,9 +4759,9 @@ char *buf;
ttycolors[CLR_YELLOW], ttycolors[CLR_BRIGHT_BLUE],
ttycolors[CLR_BRIGHT_MAGENTA], ttycolors[CLR_BRIGHT_CYAN]);
#endif /* VIDEOSHADES */
else if (!strcmp(optname, "windowtype"))
} else if (!strcmp(optname, "windowtype")) {
Sprintf(buf, "%s", windowprocs.name);
else if (!strcmp(optname, "windowcolors"))
} else if (!strcmp(optname, "windowcolors")) {
Sprintf(
buf, "%s/%s %s/%s %s/%s %s/%s",
iflags.wc_foregrnd_menu ? iflags.wc_foregrnd_menu : defbrief,
@@ -4772,12 +4775,12 @@ char *buf;
iflags.wc_foregrnd_text ? iflags.wc_foregrnd_text : defbrief,
iflags.wc_backgrnd_text ? iflags.wc_backgrnd_text : defbrief);
#ifdef PREFIXES_IN_USE
else {
} else {
for (i = 0; i < PREFIX_COUNT; ++i)
if (!strcmp(optname, fqn_prefix_names[i]) && fqn_prefix[i])
Sprintf(buf, "%s", fqn_prefix[i]);
}
#endif
}
if (buf[0])
return buf;
@@ -5229,19 +5232,19 @@ nonew:
* (Benefits users whose first exposure to NetHack is via tiles).
*
* prompt
* The title at the top of the menu.
* The title at the top of the menu.
*
* category: 0 = monster class
* 1 = object class
* 1 = object class
*
* way
* FALSE = PICK_ONE, TRUE = PICK_ANY
* FALSE = PICK_ONE, TRUE = PICK_ANY
*
* class_list
* a null terminated string containing the list of choices.
* a null terminated string containing the list of choices.
*
* class_selection
* a null terminated string containing the selected characters.
* a null terminated string containing the selected characters.
*
* Returns number selected.
*/
@@ -5380,6 +5383,7 @@ const char *optnam;
int status;
{
int k;
if (SET__IS_VALUE_VALID(status)) {
impossible("set_option_mod_status: status out of range %d.", status);
return;
@@ -5413,6 +5417,7 @@ unsigned long optmask;
int status;
{
int k = 0;
if (SET__IS_VALUE_VALID(status)) {
impossible("set_wc_option_mod_status: status out of range %d.",
status);
@@ -5431,6 +5436,7 @@ is_wc_option(optnam)
const char *optnam;
{
int k = 0;
while (wc_options[k].wc_name) {
if (strcmp(wc_options[k].wc_name, optnam) == 0)
return TRUE;
@@ -5444,6 +5450,7 @@ wc_supported(optnam)
const char *optnam;
{
int k = 0;
while (wc_options[k].wc_name) {
if (!strcmp(wc_options[k].wc_name, optnam)
&& (windowprocs.wincap & wc_options[k].wc_bit))
@@ -5470,6 +5477,7 @@ unsigned long optmask;
int status;
{
int k = 0;
if (SET__IS_VALUE_VALID(status)) {
impossible("set_wc2_option_mod_status: status out of range %d.",
status);
@@ -5488,6 +5496,7 @@ is_wc2_option(optnam)
const char *optnam;
{
int k = 0;
while (wc2_options[k].wc_name) {
if (strcmp(wc2_options[k].wc_name, optnam) == 0)
return TRUE;
@@ -5501,6 +5510,7 @@ wc2_supported(optnam)
const char *optnam;
{
int k = 0;
while (wc2_options[k].wc_name) {
if (!strcmp(wc2_options[k].wc_name, optnam)
&& (windowprocs.wincap2 & wc2_options[k].wc_bit))
@@ -5516,6 +5526,7 @@ int opttype;
char *fontname;
{
char **fn = (char **) 0;
if (!fontname)
return;
switch (opttype) {
@@ -5554,7 +5565,6 @@ char *op;
* menu white/black message green/yellow status white/blue text
* white/black
*/
int j;
char buf[BUFSZ];
char *wn, *tfg, *tbg, *newop;