Merge branch 'master' into derek-farming

* master: (49 commits)
  Fix 'fetch' syntax, include sparkly 'git log' trick
  Show object symbols in menu headings
  Fix a memory leak on termination.
  ...

Conflicts:
	include/obj.h
	src/do.c
	src/files.c
	src/hack.c
	src/invent.c
	src/mkobj.c
	src/mon.c
	src/objnam.c
This commit is contained in:
Derek S. Ray
2015-03-25 17:23:59 -04:00
85 changed files with 2536 additions and 835 deletions
+7
View File
@@ -533,6 +533,13 @@ newgame()
#endif
program_state.something_worth_saving++; /* useful data now exists */
urealtime.realtime = (time_t)0L;
#if defined(BSD) && !defined(POSIX_TYPES)
(void) time((long *)&urealtime.restored);
#else
(void) time(&urealtime.restored);
#endif
/* Success! */
welcome(TRUE);
return;
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 apply.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 apply.c $NHDT-Date: 1426465431 2015/03/16 00:23:51 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.173 $ */
/* NetHack 3.5 apply.c $Date: 2012/05/01 02:22:32 $ $Revision: 1.168 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1770,7 +1770,7 @@ long timeout;
char monnambuf[BUFSZ], carriedby[BUFSZ];
if (!figurine) {
debugpline("null figurine in fig_transform()");
debugpline0("null figurine in fig_transform()");
return;
}
silent = (timeout != monstermoves); /* happened while away */
+13 -12
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 attrib.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 attrib.c $NHDT-Date: 1426465433 2015/03/16 00:23:53 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.34 $ */
/* NetHack 3.5 attrib.c $Date: 2011/10/01 00:25:55 $ $Revision: 1.30 $ */
/* Copyright 1988, 1989, 1990, 1992, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */
@@ -347,7 +347,7 @@ exercise(i, inc_or_dec)
int i;
boolean inc_or_dec;
{
debugpline("Exercise:");
debugpline0("Exercise:");
if (i == A_INT || i == A_CHA) return; /* can't exercise these */
/* no physical exercise while polymorphed; the body's temporary */
@@ -364,7 +364,7 @@ boolean inc_or_dec;
* Note: *YES* ACURR is the right one to use.
*/
AEXE(i) += (inc_or_dec) ? (rn2(19) > ACURR(i)) : -rn2(2);
debugpline("%s, %s AEXE = %d",
debugpline3("%s, %s AEXE = %d",
(i == A_STR) ? "Str" : (i == A_WIS) ? "Wis" :
(i == A_DEX) ? "Dex" : "Con",
(inc_or_dec) ? "inc" : "dec", AEXE(i));
@@ -392,7 +392,7 @@ exerper()
(u.uhunger > 50) ? HUNGRY :
(u.uhunger > 0) ? WEAK : FAINTING;
debugpline("exerper: Hunger checks");
debugpline0("exerper: Hunger checks");
switch (hs) {
case SATIATED: exercise(A_DEX, FALSE);
if (Role_if(PM_MONK))
@@ -408,7 +408,7 @@ exerper()
}
/* Encumberance Checks */
debugpline("exerper: Encumber checks");
debugpline0("exerper: Encumber checks");
switch (near_capacity()) {
case MOD_ENCUMBER: exercise(A_STR, TRUE); break;
case HVY_ENCUMBER: exercise(A_STR, TRUE);
@@ -421,7 +421,7 @@ exerper()
/* status checks */
if(!(moves % 5)) {
debugpline("exerper: Status checks");
debugpline0("exerper: Status checks");
if ((HClairvoyant & (INTRINSIC|TIMEOUT)) &&
!BClairvoyant) exercise(A_WIS, TRUE);
if (HRegeneration) exercise(A_STR, TRUE);
@@ -453,10 +453,10 @@ exerchk()
exerper();
if(moves >= context.next_attrib_check)
debugpline("exerchk: ready to test. multi = %d.", multi);
debugpline1("exerchk: ready to test. multi = %d.", multi);
/* Are we ready for a test? */
if(moves >= context.next_attrib_check && !multi) {
debugpline("exerchk: testing.");
debugpline0("exerchk: testing.");
/*
* Law of diminishing returns (Part II):
*
@@ -483,7 +483,7 @@ exerchk()
exercise/abuse gradually wears off without impact then */
if (Upolyd && i != A_WIS) goto nextattrib;
debugpline("exerchk: testing %s (%d).",
debugpline2("exerchk: testing %s (%d).",
(i == A_STR) ? "Str" : (i == A_INT) ? "Int?" :
(i == A_WIS) ? "Wis" : (i == A_DEX) ? "Dex" :
(i == A_CON) ? "Con" : (i == A_CHA) ? "Cha?" : "???",
@@ -497,9 +497,9 @@ exerchk()
if (rn2(AVAL) > ((i != A_WIS) ? (abs(ax) * 2 / 3) : abs(ax)))
goto nextattrib;
debugpline("exerchk: changing %d.", i);
debugpline1("exerchk: changing %d.", i);
if(adjattrib(i, mod_val, -1)) {
debugpline("exerchk: changed %d.", i);
debugpline1("exerchk: changed %d.", i);
/* if you actually changed an attrib - zero accumulation */
AEXE(i) = ax = 0;
/* then print an explanation */
@@ -513,7 +513,8 @@ exerchk()
AEXE(i) = (abs(ax) / 2) * mod_val;
}
context.next_attrib_check += rn1(200,800);
debugpline("exerchk: next check at %ld.", context.next_attrib_check);
debugpline1("exerchk: next check at %ld.",
context.next_attrib_check);
}
}
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 bones.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 bones.c $NHDT-Date: 1426465433 2015/03/16 00:23:53 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.45 $ */
/* NetHack 3.5 bones.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.39 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
/* NetHack may be freely redistributed. See license for details. */
@@ -584,7 +584,7 @@ getbones()
if (has_mname(mtmp)) sanitize_name(MNAME(mtmp));
if (mtmp->mhpmax == DEFUNCT_MONSTER) {
if (wizard)
debugpline("Removing defunct monster %s from bones.",
debugpline1("Removing defunct monster %s from bones.",
mtmp->data->mname);
mongone(mtmp);
} else
+26 -25
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 dbridge.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 dbridge.c $NHDT-Date: 1426465433 2015/03/16 00:23:53 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.23 $ */
/* NetHack 3.5 dbridge.c $Date: 2012/02/01 00:49:16 $ $Revision: 1.21 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -267,7 +267,7 @@ int x, y;
(occupants[entitycnt].ex == x) &&
(occupants[entitycnt].ey == y))
break;
debugpline("entitycnt = %d", entitycnt);
debugpline1("entitycnt = %d", entitycnt);
#ifdef D_DEBUG
wait_synch();
#endif
@@ -467,7 +467,7 @@ boolean chunks;
int misses;
if (chunks)
debugpline("Do chunks miss?");
debugpline0("Do chunks miss?");
if (automiss(etmp))
return(TRUE);
@@ -487,7 +487,7 @@ boolean chunks;
if (is_db_wall(etmp->ex, etmp->ey))
misses -= 3; /* less airspace */
debugpline("Miss chance = %d (out of 8)", misses);
debugpline1("Miss chance = %d (out of 8)", misses);
return((boolean)((misses >= rnd(8))? TRUE : FALSE));
}
@@ -516,7 +516,8 @@ struct entity *etmp;
if (is_db_wall(etmp->ex, etmp->ey))
tmp -= 2; /* less room to maneuver */
debugpline("%s to jump (%d chances in 10)", E_phrase(etmp, "try"), tmp);
debugpline2("%s to jump (%d chances in 10)",
E_phrase(etmp, "try"), tmp);
return((boolean)((tmp >= rnd(10))? TRUE : FALSE));
}
@@ -550,12 +551,11 @@ struct entity *etmp;
pline_The("portcullis misses %s!",
e_nam(etmp));
else
debugpline("The drawbridge misses %s!",
e_nam(etmp));
debugpline1("The drawbridge misses %s!", e_nam(etmp));
if (e_survives_at(etmp, oldx, oldy))
return;
else {
debugpline("Mon can't survive here");
debugpline0("Mon can't survive here");
if (at_portcullis)
must_jump = TRUE;
else
@@ -574,7 +574,7 @@ struct entity *etmp;
if (at_portcullis) {
if (e_jumps(etmp)) {
relocates = TRUE;
debugpline("Jump succeeds!");
debugpline0("Jump succeeds!");
} else {
if (e_inview)
pline("%s crushed by the falling portcullis!",
@@ -587,7 +587,7 @@ struct entity *etmp;
}
} else { /* tries to jump off bridge to original square */
relocates = !e_jumps(etmp);
debugpline("Jump %s!", (relocates)? "fails" : "succeeds");
debugpline1("Jump %s!", (relocates)? "fails" : "succeeds");
}
}
@@ -597,13 +597,13 @@ struct entity *etmp;
* would be inaccessible (i.e. etmp started on drawbridge square) or
* unnecessary (i.e. etmp started here) in such a situation.
*/
debugpline("Doing relocation.");
debugpline0("Doing relocation.");
newx = oldx;
newy = oldy;
(void)find_drawbridge(&newx, &newy);
if ((newx == oldx) && (newy == oldy))
get_wall_for_db(&newx, &newy);
debugpline("Checking new square for occupancy.");
debugpline0("Checking new square for occupancy.");
if (relocates && (e_at(newx, newy))) {
/*
@@ -614,22 +614,22 @@ struct entity *etmp;
struct entity *other;
other = e_at(newx, newy);
debugpline("New square is occupied by %s", e_nam(other));
debugpline1("New square is occupied by %s", e_nam(other));
if (e_survives_at(other, newx, newy) && automiss(other)) {
relocates = FALSE; /* "other" won't budge */
debugpline("%s suicide.", E_phrase(etmp, "commit"));
debugpline1("%s suicide.", E_phrase(etmp, "commit"));
} else {
debugpline("Handling %s", e_nam(other));
debugpline1("Handling %s", e_nam(other));
while ((e_at(newx, newy) != 0) &&
(e_at(newx, newy) != etmp))
do_entity(other);
debugpline("Checking existence of %s", e_nam(etmp));
debugpline1("Checking existence of %s", e_nam(etmp));
#ifdef D_DEBUG
wait_synch();
#endif
if (e_at(oldx, oldy) != etmp) {
debugpline("%s moved or died in recursion somewhere",
debugpline1("%s moved or died in recursion somewhere",
E_phrase(etmp, "have"));
#ifdef D_DEBUG
wait_synch();
@@ -639,7 +639,7 @@ struct entity *etmp;
}
}
if (relocates && !e_at(newx, newy)) {/* if e_at() entity = worm tail */
debugpline("Moving %s", e_nam(etmp));
debugpline1("Moving %s", e_nam(etmp));
if (!is_u(etmp)) {
remove_monster(etmp->ex, etmp->ey);
place_monster(etmp->emon, newx, newy);
@@ -652,12 +652,12 @@ struct entity *etmp;
etmp->ey = newy;
e_inview = e_canseemon(etmp);
}
debugpline("Final disposition of %s", e_nam(etmp));
debugpline1("Final disposition of %s", e_nam(etmp));
#ifdef D_DEBUG
wait_synch();
#endif
if (is_db_wall(etmp->ex, etmp->ey)) {
debugpline("%s in portcullis chamber", E_phrase(etmp, "are"));
debugpline1("%s in portcullis chamber", E_phrase(etmp, "are"));
#ifdef D_DEBUG
wait_synch();
#endif
@@ -678,9 +678,9 @@ struct entity *etmp;
e_died(etmp, 0, CRUSHING); /* no message */
return;
}
debugpline("%s in here", E_phrase(etmp, "survive"));
debugpline1("%s in here", E_phrase(etmp, "survive"));
} else {
debugpline("%s on drawbridge square", E_phrase(etmp, "are"));
debugpline1("%s on drawbridge square", E_phrase(etmp, "are"));
if (is_pool(etmp->ex, etmp->ey) && !e_inview)
if (!Deaf)
You_hear("a splash.");
@@ -691,7 +691,8 @@ struct entity *etmp;
E_phrase(etmp, "fall"));
return;
}
debugpline("%s cannot survive on the drawbridge square",E_phrase(etmp, NULL));
debugpline1("%s cannot survive on the drawbridge square",
E_phrase(etmp, NULL));
if (is_pool(etmp->ex, etmp->ey) || is_lava(etmp->ex, etmp->ey))
if (e_inview && !is_u(etmp)) {
/* drown() will supply msgs if nec. */
@@ -907,7 +908,7 @@ int x,y;
if (etmp1->edata) {
e_inview = e_canseemon(etmp1);
if (e_missed(etmp1, TRUE)) {
debugpline("%s spared!", E_phrase(etmp1, "are"));
debugpline1("%s spared!", E_phrase(etmp1, "are"));
/* if there is water or lava here, fall in now */
if (is_u(etmp1))
spoteffects(FALSE);
@@ -925,7 +926,7 @@ int x,y;
if (!Deaf && !is_u(etmp1) && !is_pool(x,y))
You_hear("a crushing sound.");
else
debugpline("%s from shrapnel",
debugpline1("%s from shrapnel",
E_phrase(etmp1, "die"));
}
killer.format = KILLED_BY_AN;
+5 -2
View File
@@ -136,6 +136,7 @@ NEARDATA struct sysflag sysflags = DUMMY;
NEARDATA struct instance_flags iflags = DUMMY;
NEARDATA struct you u = DUMMY;
NEARDATA time_t ubirthday = DUMMY;
NEARDATA struct u_realtime urealtime = DUMMY;
schar lastseentyp[COLNO][ROWNO] = {DUMMY}; /* last seen/touched dungeon typ */
@@ -267,12 +268,14 @@ char toplines[TBUFSZ];
struct tc_gbl_data tc_gbl_data = { 0,0, 0,0 }; /* AS,AE, LI,CO */
char *fqn_prefix[PREFIX_COUNT] = { (char *)0, (char *)0, (char *)0, (char *)0,
(char *)0, (char *)0, (char *)0, (char *)0, (char *)0 };
(char *)0, (char *)0, (char *)0, (char *)0,
(char *)0 , (char *)0 };
#ifdef PREFIXES_IN_USE
char *fqn_prefix_names[PREFIX_COUNT] = { "hackdir", "leveldir", "savedir",
"bonesdir", "datadir", "scoredir",
"lockdir", "configdir", "troubledir" };
"lockdir", "sysconfdir", "configdir",
"troubledir" };
#endif
NEARDATA struct savefile_info sfcap = {
+9 -9
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 dig.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 dig.c $NHDT-Date: 1426465434 2015/03/16 00:23:54 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.73 $ */
/* NetHack 3.5 dig.c $Date: 2012/02/16 03:01:37 $ $Revision: 1.67 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1689,7 +1689,7 @@ bury_an_obj(otmp)
struct obj *otmp2;
boolean under_ice;
debugpline("bury_an_obj: %s", xname(otmp));
debugpline1("bury_an_obj: %s", xname(otmp));
if (otmp == uball) {
unpunish();
u.utrap = rn1(50,20);
@@ -1752,7 +1752,7 @@ int x, y;
struct obj *otmp, *otmp2;
if(level.objects[x][y] != (struct obj *)0)
debugpline("bury_objs: at %d, %d", x, y);
debugpline2("bury_objs: at <%d,%d>", x, y);
for (otmp = level.objects[x][y]; otmp; otmp = otmp2)
otmp2 = bury_an_obj(otmp);
@@ -1769,7 +1769,7 @@ int x, y;
struct obj *otmp, *otmp2, *bball;
coord cc;
debugpline("unearth_objs: at %d, %d", x, y);
debugpline2("unearth_objs: at <%d,%d>", x, y);
cc.x = x; cc.y = y;
bball = buried_ball(&cc);
for (otmp = level.buriedobjlist; otmp; otmp = otmp2) {
@@ -1878,7 +1878,7 @@ void
bury_monst(mtmp)
struct monst *mtmp;
{
debugpline("bury_monst: %s", mon_nam(mtmp));
debugpline1("bury_monst: %s", mon_nam(mtmp));
if(canseemon(mtmp)) {
if(is_flyer(mtmp->data) || is_floater(mtmp->data)) {
pline_The("%s opens up, but %s is not swallowed!",
@@ -1897,7 +1897,7 @@ struct monst *mtmp;
void
bury_you()
{
debugpline("bury_you");
debugpline0("bury_you");
if (!Levitation && !Flying) {
if(u.uswallow)
You_feel("a sensation like falling into a trap!");
@@ -1914,7 +1914,7 @@ bury_you()
void
unearth_you()
{
debugpline("unearth_you");
debugpline0("unearth_you");
u.uburied = FALSE;
under_ground(0);
if(!uamul || uamul->otyp != AMULET_OF_STRANGULATION)
@@ -1925,7 +1925,7 @@ unearth_you()
void
escape_tomb()
{
debugpline("escape_tomb");
debugpline0("escape_tomb");
if ((Teleportation || can_teleport(youmonst.data)) &&
(Teleport_control || rn2(3) < Luck+2)) {
You("attempt a teleport spell.");
@@ -1957,7 +1957,7 @@ bury_obj(otmp)
struct obj *otmp;
{
debugpline("bury_obj");
debugpline0("bury_obj");
if(cansee(otmp->ox, otmp->oy))
pline_The("objects on the %s tumble into a hole!",
surface(otmp->ox, otmp->oy));
+23 -14
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 do.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 do.c $NHDT-Date: 1426991040 2015/03/22 02:24:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.111 $ */
/* NetHack 3.5 do.c $Date: 2014/11/18 03:10:39 $ $Revision: 1.101 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -230,10 +230,15 @@ doaltarobj(obj) /* obj is an object dropped on an altar */
if (Blind)
return;
/* KMH, conduct */
u.uconduct.gnostic++;
if (obj->oclass != COIN_CLASS) {
/* KMH, conduct */
u.uconduct.gnostic++;
} else {
/* coins don't have bless/curse status */
obj->blessed = obj->cursed = 0;
}
if ((obj->blessed || obj->cursed) && obj->oclass != COIN_CLASS) {
if (obj->blessed || obj->cursed) {
There("is %s flash as %s %s the altar.",
an(hcolor(obj->blessed ? NH_AMBER : NH_BLACK)),
doname(obj), otense(obj, "hit"));
@@ -241,7 +246,7 @@ doaltarobj(obj) /* obj is an object dropped on an altar */
} else {
pline("%s %s on the altar.", Doname2(obj),
otense(obj, "land"));
obj->bknown = 1;
if (obj->oclass != COIN_CLASS) obj->bknown = 1;
}
}
@@ -1017,15 +1022,18 @@ boolean at_stairs, falling, portal;
/* If you have the amulet and are trying to get out of Gehennom, going
* up a set of stairs sometimes does some very strange things!
* Biased against law and towards chaos, but not nearly as strongly
* as it used to be (prior to 3.2.0).
* Odds: old new
* "up" L N C "up" L N C
* +1 75.0 75.0 75.0 +1 75.0 75.0 75.0
* 0 0.0 12.5 25.0 0 6.25 8.33 12.5
* -1 8.33 4.17 0.0 -1 6.25 8.33 12.5
* -2 8.33 4.17 0.0 -2 6.25 8.33 0.0
* -3 8.33 4.17 0.0 -3 6.25 0.0 0.0
* Biased against law and towards chaos. (The chance to be sent
* down multiple levels when attempting to go up are significantly
* less than the corresponding comment in older versions indicated
* due to overlooking the effect of the call to assign_rnd_lvl().)
*
* Odds for making it to the next level up, or of being sent down:
* "up" L N C
* +1 75.0 75.0 75.0
* 0 6.25 8.33 12.5
* -1 11.46 12.50 12.5
* -2 5.21 4.17 0.0
* -3 2.08 0.0 0.0
*/
if (Inhell && up && u.uhave.amulet && !newdungeon && !portal &&
(dunlev(&u.uz) < dunlevs_in_dungeon(&u.uz)-3)) {
@@ -1324,6 +1332,7 @@ boolean at_stairs, falling, portal;
#endif
You_hear("groans and moans everywhere.");
} else pline("It is hot here. You smell smoke...");
u.uachieve.enter_gehennom = 1;
}
/* in case we've managed to bypass the Valley's stairway down */
if (Inhell && !Is_valley(&u.uz)) u.uevent.gehennom_entered = 1;
+49 -101
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 do_name.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 do_name.c $NHDT-Date: 1426558927 2015/03/17 02:22:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.53 $ */
/* NetHack 3.5 do_name.c $Date: 2012/01/29 03:00:17 $ $Revision: 1.49 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -56,8 +56,8 @@ const char *goal;
}
int
getpos(cc, force, goal)
coord *cc;
getpos(ccp, force, goal)
coord *ccp;
boolean force;
const char *goal;
{
@@ -75,8 +75,8 @@ const char *goal;
pline("(For instructions type a ?)");
msg_given = TRUE;
}
cx = cc->x;
cy = cc->y;
cx = ccp->x;
cy = ccp->y;
#ifdef CLIPPING
cliparound(cx, cy);
#endif
@@ -97,6 +97,7 @@ const char *goal;
int sym = 0;
char tmpbuf[BUFSZ];
const char *firstmatch = NULL;
cc.x = cx;
cc.y = cy;
if (do_screen_description(cc, TRUE, sym, tmpbuf, &firstmatch)) {
@@ -203,9 +204,25 @@ const char *goal;
lo_x = (pass == 0 && ty == lo_y) ? cx + 1 : 1;
hi_x = (pass == 1 && ty == hi_y) ? cx : COLNO - 1;
for (tx = lo_x; tx <= hi_x; tx++) {
k = levl[tx][ty].glyph;
/* look at dungeon feature, not at user-visible glyph */
k = back_to_glyph(tx,ty);
/* uninteresting background glyph */
if (glyph_is_cmap(k) &&
matching[glyph_to_cmap(k)]) {
(IS_DOOR(levl[tx][ty].typ) ||
glyph_to_cmap(k) == S_room ||
glyph_to_cmap(k) == S_corr ||
glyph_to_cmap(k) == S_litcorr)) {
/* what the hero remembers to be at tx,ty */
k = glyph_at(tx, ty);
}
if (glyph_is_cmap(k) &&
matching[glyph_to_cmap(k)] &&
levl[tx][ty].seenv &&
(!IS_WALL(levl[tx][ty].typ)) &&
(levl[tx][ty].typ != SDOOR) &&
glyph_to_cmap(k) != S_room &&
glyph_to_cmap(k) != S_corr &&
glyph_to_cmap(k) != S_litcorr) {
cx = tx, cy = ty;
if (msg_given) {
clear_nhwindow(WIN_MESSAGE);
@@ -250,8 +267,8 @@ const char *goal;
lock_mouse_cursor(FALSE);
#endif
if (msg_given) clear_nhwindow(WIN_MESSAGE);
cc->x = cx;
cc->y = cy;
ccp->x = cx;
ccp->y = cy;
return result;
}
@@ -792,10 +809,10 @@ boolean called;
/* Put the actual monster name or type into the buffer now */
/* Be sure to remember whether the buffer starts with a name */
if (do_hallu) {
const char *rname = rndmonnam();
char rnamecode;
char *rname = rndmonnam(&rnamecode);
Strcat(buf, rname);
name_at_start = bogon_is_pname(rname);
name_at_start = bogon_is_pname(rnamecode);
} else if (has_mname(mtmp)) {
char *name = MNAME(mtmp);
@@ -989,113 +1006,44 @@ char *outbuf;
return outbuf;
}
/*
* Name prefix codes (same as shknam.c):
* dash - female, personal name
* underscore _ female, general name
* plus + male, personal name
* vertical bar | male, general name
* equals = gender not specified, personal name
*/
static const char * const bogusmons[] = {
"jumbo shrimp", "giant pigmy", "gnu", "killer penguin",
"giant cockroach", "giant slug", "maggot", "pterodactyl",
"tyrannosaurus rex", "basilisk", "beholder", "nightmare",
"efreeti", "marid", "rot grub", "bookworm", "master lichen",
"shadow", "hologram", "jester", "attorney", "sleazoid",
"killer tomato", "amazon", "robot", "battlemech",
"rhinovirus", "harpy", "lion-dog", "rat-ant", "Y2K bug",
/* misc. */
"grue", "Christmas-tree monster", "luck sucker", "paskald",
"brogmoid", "dornbeast", /* Quendor (Zork, &c.) */
"Ancient Multi-Hued Dragon", "+Evil Iggy",
/* Moria */
"emu", "kestrel", "xeroc", "venus flytrap",
/* Rogue */
"creeping coins", /* Wizardry */
"hydra", "siren", /* Greek legend */
"killer bunny", /* Monty Python */
"rodent of unusual size", /* The Princess Bride */
"were-rabbit", /* Wallace & Gromit */
"+Smokey Bear", /* "Only you can prevent forest fires!" */
"Luggage", /* Discworld */
"Ent", /* Lord of the Rings */
"tangle tree", "nickelpede", "wiggle", /* Xanth */
"white rabbit", "snark", /* Lewis Carroll */
"pushmi-pullyu", /* Dr. Dolittle */
"smurf", /* The Smurfs */
"tribble", "Klingon", "Borg", /* Star Trek */
"Ewok", /* Star Wars */
"Totoro", /* Tonari no Totoro */
"ohmu", /* Nausicaa */
"youma", /* Sailor Moon */
"nyaasu", /* Pokemon (Meowth) */
"-Godzilla", "+King Kong", /* monster movies */
"earthquake beast", /* old L of SH */
"Invid", /* Robotech */
"Terminator", /* The Terminator */
"boomer", /* Bubblegum Crisis */
"Dalek", /* Dr. Who ("Exterminate!") */
"microscopic space fleet", "Ravenous Bugblatter Beast of Traal",
/* HGttG */
"teenage mutant ninja turtle", /* TMNT */
"samurai rabbit", /* Usagi Yojimbo */
"aardvark", /* Cerebus */
"=Audrey II", /* Little Shop of Horrors */
"witch doctor", "one-eyed one-horned flying purple people eater",
/* 50's rock 'n' roll */
"+Barney the dinosaur", /* saccharine kiddy TV */
"+Morgoth", /* Angband */
"Vorlon", /* Babylon 5 */
"questing beast", /* King Arthur */
"Predator", /* Movie */
"mother-in-law" /* common pest */
};
#define BOGUSMONSIZE 100 /* arbitrary */
/* return a random monster name, for hallucination */
const char *
rndmonnam()
char *
rndmonnam(code)
char *code;
{
const char *mname;
static char buf[BUFSZ];
char *mname = buf;
int name;
if (code) *code = '\0';
do {
name = rn1(SPECIAL_PM + SIZE(bogusmons) - LOW_PM, LOW_PM);
name = rn1(SPECIAL_PM + BOGUSMONSIZE - LOW_PM, LOW_PM);
} while (name < SPECIAL_PM &&
(type_is_pname(&mons[name]) || (mons[name].geno & G_NOGEN)));
if (name >= SPECIAL_PM) {
mname = bogusmons[name - SPECIAL_PM];
get_rnd_text(BOGUSMONFILE, buf);
/* strip prefix if present */
if (!letter(*mname)) ++mname;
if (!letter(*mname)) {
if (code) *code = *mname;
++mname;
}
} else {
mname = mons[name].mname;
Strcpy(buf, mons[name].mname);
}
return mname;
}
#undef BOGUSMONSIZE
/* scan bogusmons to check whether this name is in the list and has a prefix */
boolean
bogon_is_pname(mname)
const char *mname;
bogon_is_pname(code)
char code;
{
const char *bname;
int name;
if (!mname || !*mname) return FALSE;
if (!strncmpi(mname, "the ", 4)) mname += 4;
/* scan the bogusmons[] list; case sensitive here */
for (name = 0; name < SIZE(bogusmons); name++) {
bname = bogusmons[name];
/* we can skip all ordinary entries */
if (letter(*bname)) continue;
/* starts with a classification code; does rest of name match? */
if (!strcmp(mname, bname + 1))
return index("-+=", *bname) ? TRUE : FALSE;
}
return FALSE;
if (!code) return FALSE;
return index("-+=", code) ? TRUE : FALSE;
}
const char *
+1 -1
View File
@@ -391,7 +391,7 @@ Helmet_on(VOID_ARGS)
properties, including levitation; uarmh could get
dropped or destroyed here */
uchangealign((u.ualign.type != A_NEUTRAL) ? -u.ualign.type :
rn2(2) ? A_CHAOTIC : A_LAWFUL, 1);
(uarmh->o_id % 2) ? A_CHAOTIC : A_LAWFUL, 1);
/* makeknown(uarmh->otyp); -- moved below, after xname() */
/*FALLTHRU*/
case DUNCE_CAP:
+4 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 dungeon.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 dungeon.c $NHDT-Date: 1426465434 2015/03/16 00:23:54 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.39 $ */
/* NetHack 3.5 dungeon.c $Date: 2012/04/14 08:31:05 $ $Revision: 1.34 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -81,7 +81,7 @@ dumpit()
s_level *x;
branch *br;
if (!showdebug()) return;
if (!showdebug(__FILE__)) return;
for(i = 0; i < n_dgns; i++) {
fprintf(stderr, "\n#%d \"%s\" (%s):\n", i,
@@ -672,6 +672,8 @@ struct level_map {
{ "wizard1", &wiz1_level },
{ "wizard2", &wiz2_level },
{ "wizard3", &wiz3_level },
{ "minend", &mineend_level },
{ "soko1", &sokoend_level },
{ X_START, &qstart_level },
{ X_LOCATE, &qlocate_level },
{ X_GOAL, &nemesis_level },
+45 -41
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 eat.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 eat.c $NHDT-Date: 1426465435 2015/03/16 00:23:55 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.123 $ */
/* NetHack 3.5 eat.c $Date: 2012/02/01 00:49:16 $ $Revision: 1.116 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -284,11 +284,11 @@ recalc_wt()
{
struct obj *piece = context.victual.piece;
debugpline("Old weight = %d", piece->owt);
debugpline("Used time = %d, Req'd time = %d",
context.victual.usedtime, context.victual.reqtime);
debugpline1("Old weight = %d", piece->owt);
debugpline2("Used time = %d, Req'd time = %d",
context.victual.usedtime, context.victual.reqtime);
piece->owt = weight(piece);
debugpline("New weight = %d", piece->owt);
debugpline1("New weight = %d", piece->owt);
}
void
@@ -298,7 +298,7 @@ reset_eat() /* called when eating interrupted by an event */
* the round is spent eating.
*/
if(context.victual.eating && !context.victual.doreset) {
debugpline("reset_eat...");
debugpline0("reset_eat...");
context.victual.doreset = TRUE;
}
return;
@@ -313,7 +313,7 @@ register struct obj *otmp;
(void) splitobj(otmp, otmp->quan - 1L);
else
otmp = splitobj(otmp, 1L);
debugpline("split object,");
debugpline0("split object,");
}
if (!otmp->oeaten) {
@@ -374,7 +374,7 @@ struct obj *old_obj, *new_obj;
STATIC_OVL void
do_reset_eat()
{
debugpline("do_reset_eat...");
debugpline0("do_reset_eat...");
if (context.victual.piece) {
context.victual.o_id = 0;
context.victual.piece = touchfood(context.victual.piece);
@@ -717,39 +717,39 @@ register struct permonst *ptr;
switch (type) {
case FIRE_RES:
res = (ptr->mconveys & MR_FIRE) != 0;
if (res) debugpline("can get fire resistance");
if (res) debugpline0("can get fire resistance");
break;
case SLEEP_RES:
res = (ptr->mconveys & MR_SLEEP) != 0;
if (res) debugpline("can get sleep resistance");
if (res) debugpline0("can get sleep resistance");
break;
case COLD_RES:
res = (ptr->mconveys & MR_COLD) != 0;
if (res) debugpline("can get cold resistance");
if (res) debugpline0("can get cold resistance");
break;
case DISINT_RES:
res = (ptr->mconveys & MR_DISINT) != 0;
if (res) debugpline("can get disintegration resistance");
if (res) debugpline0("can get disintegration resistance");
break;
case SHOCK_RES: /* shock (electricity) resistance */
res = (ptr->mconveys & MR_ELEC) != 0;
if (res) debugpline("can get shock resistance");
if (res) debugpline0("can get shock resistance");
break;
case POISON_RES:
res = (ptr->mconveys & MR_POISON) != 0;
if (res) debugpline("can get poison resistance");
if (res) debugpline0("can get poison resistance");
break;
case TELEPORT:
res = can_teleport(ptr);
if (res) debugpline("can get teleport");
if (res) debugpline0("can get teleport");
break;
case TELEPORT_CONTROL:
res = control_teleport(ptr);
if (res) debugpline("can get teleport control");
if (res) debugpline0("can get teleport control");
break;
case TELEPAT:
res = telepathic(ptr);
if (res) debugpline("can get telepathy");
if (res) debugpline0("can get telepathy");
break;
default:
/* res stays 0 */
@@ -768,7 +768,7 @@ register struct permonst *ptr;
{
register int chance;
debugpline("Attempting to give intrinsic %d", type);
debugpline1("Attempting to give intrinsic %d", type);
/* some intrinsics are easier to get than others */
switch (type) {
case POISON_RES:
@@ -797,7 +797,7 @@ register struct permonst *ptr;
switch (type) {
case FIRE_RES:
debugpline("Trying to give fire resistance");
debugpline0("Trying to give fire resistance");
if(!(HFire_resistance & FROMOUTSIDE)) {
You(Hallucination ? "be chillin'." :
"feel a momentary chill.");
@@ -805,21 +805,21 @@ register struct permonst *ptr;
}
break;
case SLEEP_RES:
debugpline("Trying to give sleep resistance");
debugpline0("Trying to give sleep resistance");
if(!(HSleep_resistance & FROMOUTSIDE)) {
You_feel("wide awake.");
HSleep_resistance |= FROMOUTSIDE;
}
break;
case COLD_RES:
debugpline("Trying to give cold resistance");
debugpline0("Trying to give cold resistance");
if(!(HCold_resistance & FROMOUTSIDE)) {
You_feel("full of hot air.");
HCold_resistance |= FROMOUTSIDE;
}
break;
case DISINT_RES:
debugpline("Trying to give disintegration resistance");
debugpline0("Trying to give disintegration resistance");
if(!(HDisint_resistance & FROMOUTSIDE)) {
You_feel(Hallucination ?
"totally together, man." :
@@ -828,7 +828,7 @@ register struct permonst *ptr;
}
break;
case SHOCK_RES: /* shock (electricity) resistance */
debugpline("Trying to give shock resistance");
debugpline0("Trying to give shock resistance");
if(!(HShock_resistance & FROMOUTSIDE)) {
if (Hallucination)
You_feel("grounded in reality.");
@@ -838,7 +838,7 @@ register struct permonst *ptr;
}
break;
case POISON_RES:
debugpline("Trying to give poison resistance");
debugpline0("Trying to give poison resistance");
if(!(HPoison_resistance & FROMOUTSIDE)) {
You_feel(Poison_resistance ?
"especially healthy." : "healthy.");
@@ -846,7 +846,7 @@ register struct permonst *ptr;
}
break;
case TELEPORT:
debugpline("Trying to give teleport");
debugpline0("Trying to give teleport");
if(!(HTeleportation & FROMOUTSIDE)) {
You_feel(Hallucination ? "diffuse." :
"very jumpy.");
@@ -854,7 +854,7 @@ register struct permonst *ptr;
}
break;
case TELEPORT_CONTROL:
debugpline("Trying to give teleport control");
debugpline0("Trying to give teleport control");
if(!(HTeleport_control & FROMOUTSIDE)) {
You_feel(Hallucination ?
"centered in your personal space." :
@@ -863,7 +863,7 @@ register struct permonst *ptr;
}
break;
case TELEPAT:
debugpline("Trying to give telepathy");
debugpline0("Trying to give telepathy");
if(!(HTelepat & FROMOUTSIDE)) {
You_feel(Hallucination ?
"in touch with the cosmos." :
@@ -874,7 +874,7 @@ register struct permonst *ptr;
}
break;
default:
debugpline("Tried to give an impossible intrinsic");
debugpline0("Tried to give an impossible intrinsic");
break;
}
}
@@ -1005,7 +1005,7 @@ register int pm;
case PM_DISENCHANTER:
/* picks an intrinsic at random and removes it; there's
no feedback if hero already lacks the chosen ability */
debugpline("using attrcurse to strip an intrinsic");
debugpline0("using attrcurse to strip an intrinsic");
attrcurse();
break;
case PM_MIND_FLAYER:
@@ -1045,7 +1045,7 @@ register int pm;
if (conveys_STR) {
count = 1;
tmp = -1; /* use -1 as fake prop index for STR */
debugpline("\"Intrinsic\" strength, %d", tmp);
debugpline1("\"Intrinsic\" strength, %d", tmp);
}
for (i = 1; i <= LAST_PROP; i++) {
if (!intrinsic_possible(i, ptr)) continue;
@@ -1055,7 +1055,7 @@ register int pm;
of keeping the old choice (note that 1 in 1 and
0 in 1 are what we want for the first candidate) */
if (!rn2(count)) {
debugpline("Intrinsic %d replacing %d", i, tmp);
debugpline2("Intrinsic %d replacing %d", i, tmp);
tmp = i;
}
}
@@ -1252,7 +1252,7 @@ const char *mesg;
what = "chicken";
which = 1; /* suppress pluralization */
} else if (Hallucination) {
what = rndmonnam();
what = rndmonnam(NULL);
} else {
what = mons[mnum].mname;
if (the_unique_pm(&mons[mnum])) which = 2;
@@ -1599,11 +1599,12 @@ start_eating(otmp) /* called as you start to eat */
{
const char *old_nomovemsg, *save_nomovemsg;
debugpline("start_eating: %p (victual = %p)", otmp, context.victual.piece);
debugpline("reqtime = %d", context.victual.reqtime);
debugpline("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
debugpline("nmod = %d", context.victual.nmod);
debugpline("oeaten = %d", otmp->oeaten);
debugpline2("start_eating: %lx (victual = %lx)",
(unsigned long)otmp, (unsigned long)context.victual.piece);
debugpline1("reqtime = %d", context.victual.reqtime);
debugpline1("(original reqtime = %d)", objects[otmp->otyp].oc_delay);
debugpline1("nmod = %d", context.victual.nmod);
debugpline1("oeaten = %d", otmp->oeaten);
context.victual.fullwarn = context.victual.doreset = FALSE;
context.victual.eating = TRUE;
@@ -2443,11 +2444,14 @@ doeat() /* generic "eat" command funtion (see cmd.c) */
if (otmp->otyp == CORPSE) basenutrit = mons[otmp->corpsenm].cnutrit;
else basenutrit = objects[otmp->otyp].oc_nutrition;
debugpline("before rounddiv: context.victual.reqtime == %d", context.victual.reqtime);
debugpline("oeaten == %d, basenutrit == %d", otmp->oeaten, basenutrit);
debugpline1("before rounddiv: context.victual.reqtime == %d",
context.victual.reqtime);
debugpline2("oeaten == %d, basenutrit == %d",
otmp->oeaten, basenutrit);
context.victual.reqtime = (basenutrit == 0 ? 0 :
rounddiv(context.victual.reqtime * (long)otmp->oeaten, basenutrit));
debugpline("after rounddiv: context.victual.reqtime == %d", context.victual.reqtime);
debugpline1("after rounddiv: context.victual.reqtime == %d",
context.victual.reqtime);
/* calculate the modulo value (nutrit. units per round eating)
* note: this isn't exact - you actually lose a little nutrition
* due to this method.
@@ -2549,7 +2553,7 @@ register int num;
{
/* See comments in newuhs() for discussion on force_save_hs */
boolean iseating = (occupation == eatfood) || force_save_hs;
debugpline("lesshungry(%d)", num);
debugpline1("lesshungry(%d)", num);
u.uhunger += num;
if(u.uhunger >= 2000) {
if (!iseating || context.victual.canchoke) {
+1
View File
@@ -911,6 +911,7 @@ die:
topten figure it out separately and possibly getting different
time or even day if player is slow responding to --More-- */
endtime = getnow();
urealtime.realtime += (endtime - urealtime.restored);
/* Sometimes you die on the first move. Life's not fair.
* On those rare occasions you get hosed immediately, go out
+9 -64
View File
@@ -9,33 +9,6 @@
STATIC_VAR NEARDATA struct engr *head_engr;
/* random engravings */
static const char *random_mesg[] = {
"Elbereth",
/* trap engravings */
"Vlad was here", "ad aerarium",
/* take-offs and other famous engravings */
"Owlbreath", "Galadriel",
"Kilroy was here",
"A.S. ->", "<- A.S.", /* Journey to the Center of the Earth */
"You won't get it up the steps", /* Adventure */
"Lasciate ogni speranza o voi ch'entrate.", /* Inferno */
"Well Come", /* Prisoner */
"We apologize for the inconvenience.", /* So Long... */
"See you next Wednesday", /* Thriller */
"notary sojak", /* Smokey Stover */
"For a good time call 8?7-5309",
"Please don't feed the animals.", /* Various zoos around the world */
"Madam, in Eden, I'm Adam.", /* A palindrome */
"Two thumbs up!", /* Siskel & Ebert */
"Hello, World!", /* The First C Program */
#ifdef MAIL
"You've got mail!", /* AOL */
#endif
"As if!", /* Clueless */
"BAD WOLF", /* 200x incarnation of Dr.Who */
};
char *
random_engraving(outbuf)
char *outbuf;
@@ -44,8 +17,10 @@ char *outbuf;
/* a random engraving may come from the "rumors" file,
or from the list above */
if (!rn2(4) || !(rumor = getrumor(0, outbuf, TRUE)) || !*rumor)
Strcpy(outbuf, random_mesg[rn2(SIZE(random_mesg))]);
if (!rn2(4) || !(rumor = getrumor(0, outbuf, TRUE)) || !*rumor) {
char buf[BUFSZ];
Strcpy(outbuf, get_rnd_text(ENGRAVEFILE, buf));
}
wipeout_text(outbuf, (int)(strlen(outbuf) / 4), 0);
return outbuf;
@@ -1232,39 +1207,6 @@ struct engr *ep;
}
/* Epitaphs for random headstones */
static const char *epitaphs[] = {
"Rest in peace",
"R.I.P.",
"Rest In Pieces",
"Note -- there are NO valuable items in this grave",
"1994-1995. The Longest-Lived Hacker Ever",
"The Grave of the Unknown Hacker",
"We weren't sure who this was, but we buried him here anyway",
"Sparky -- he was a very good dog",
"Beware of Electric Third Rail",
"Made in Taiwan",
"Og friend. Og good dude. Og died. Og now food",
"Beetlejuice Beetlejuice Beetlejuice",
"Look out below!",
"Please don't dig me up. I'm perfectly happy down here. -- Resident",
"Postman, please note forwarding address: Gehennom, Asmodeus's Fortress, fifth lemure on the left",
"Mary had a little lamb/Its fleece was white as snow/When Mary was in trouble/The lamb was first to go",
"Be careful, or this could happen to you!",
"Soon you'll join this fellow in hell! -- the Wizard of Yendor",
"Caution! This grave contains toxic waste",
"Sum quod eris",
"Here lies an Atheist, all dressed up and no place to go",
"Here lies Ezekiel, age 102. The good die young.",
"Here lies my wife: Here let her lie! Now she's at rest and so am I.",
"Here lies Johnny Yeast. Pardon me for not rising.",
"He always lied while on the earth and now he's lying in it",
"I made an ash of myself",
"Soon ripe. Soon rotten. Soon gone. But not forgotten.",
"Here lies the body of Jonathan Blake. Stepped on the gas instead of the brake.",
"Go away!"
};
/* Create a headstone at the given location.
* The caller is responsible for newsym(x, y).
*/
@@ -1280,9 +1222,12 @@ const char *str;
levl[x][y].typ = GRAVE;
/* Engrave the headstone */
if (!str) str = epitaphs[rn2(SIZE(epitaphs))];
del_engr_at(x, y);
make_engr_at(x, y, str, 0L, HEADSTONE);
if (str) make_engr_at(x, y, str, 0L, HEADSTONE);
else {
char buf[BUFSZ];
make_engr_at(x, y, get_rnd_text(EPITAPHFILE, buf), 0L, HEADSTONE);
}
return;
}
+2 -2
View File
@@ -283,7 +283,7 @@ int expltype;
so avoid any which begins with a capital letter) */
do {
Sprintf(hallu_buf, "%s explosion",
s_suffix(rndmonnam()));
s_suffix(rndmonnam(NULL)));
} while (*hallu_buf != lowc(*hallu_buf));
str = hallu_buf;
}
@@ -365,7 +365,7 @@ int expltype;
if (do_hallu) { /* (see explanation above) */
do {
Sprintf(hallu_buf, "%s explosion",
s_suffix(rndmonnam()));
s_suffix(rndmonnam(NULL)));
} while (*hallu_buf != lowc(*hallu_buf));
str = hallu_buf;
}
+135 -14
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 files.c $NHDT-Date: 1426545233 2015/03/16 22:33:53 $ $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.133 $ */
/* NetHack 3.5 files.c $NHDT-Date: 1426969026 2015/03/21 20:17:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.137 $ */
/* NetHack 3.5 files.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.124 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -362,7 +362,9 @@ char *reasonbuf; /* reasonbuf must be at least BUFSZ, supplied by caller */
#if defined(NOCWD_ASSUMPTIONS)
for (prefcnt = 1; prefcnt < PREFIX_COUNT; prefcnt++) {
/* don't test writing to configdir or datadir; they're readonly */
if (prefcnt == CONFIGPREFIX || prefcnt == DATAPREFIX) continue;
if (prefcnt == SYSCONFPREFIX ||
prefcnt == CONFIGPREFIX ||
prefcnt == DATAPREFIX) continue;
filename = fqname("validate", prefcnt, 3);
if ((fp = fopen(filename, "w"))) {
fclose(fp);
@@ -1811,6 +1813,8 @@ const char *configfile =
# endif
#endif
/* used for messaging */
char lastconfigfile[BUFSZ];
#ifdef MSDOS
/* conflict with speed-dial under windows
@@ -1857,8 +1861,15 @@ int src;
/* fall through to standard names */
} else
#endif
if ((fp = fopenp(filename, "r")) != (FILE *)0) {
configfile = filename;
#ifdef PREFIXES_IN_USE
if (src == SET_IN_SYS) {
(void) strncpy(lastconfigfile,
fqname(filename, SYSCONFPREFIX, 0), BUFSZ-1);
} else
#endif
(void) strncpy(lastconfigfile, filename, BUFSZ-1);
lastconfigfile[BUFSZ-1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) {
return(fp);
#if defined(UNIX) || defined(VMS)
} else {
@@ -1876,6 +1887,13 @@ int src;
/* user's home directory should be where we look first here, too */
envp = nh_getenv("USERPROFILE");
# endif
/*
* TODO: uncomment this when you figure out where to put it
(void) strncpy(lastconfigfile,
fqname(configfile, CONFIGPREFIX, 0), BUFSZ-1);
lastconfigfile[BUFSZ-1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) {
*/
# ifdef WIN32
if (!envp) {
Strcpy(tmp_config, configfile);
@@ -1908,13 +1926,15 @@ int src;
#else
/* constructed full path names don't need fqname() */
# ifdef VMS
if ((fp = fopenp(fqname("nethackini", CONFIGPREFIX, 0), "r"))
!= (FILE *)0) {
configfile = "nethackini";
(void) strncpy(lastconfigfile, fqname("nethackini", CONFIGPREFIX, 0),
BUFSZ-1);
lastconfigfile[BUFSZ-1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) {
return(fp);
}
if ((fp = fopenp("sys$login:nethack.ini", "r")) != (FILE *)0) {
configfile = "nethack.ini";
(void) strncpy(lastconfigfile,"sys$login:nethack.ini", BUFSZ-1);
lastconfigfile[BUFSZ-1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) {
return(fp);
}
@@ -1923,6 +1943,9 @@ int src;
Strcpy(tmp_config, "NetHack.cnf");
else
Sprintf(tmp_config, "%s%s", envp, "NetHack.cnf");
(void) strncpy(lastconfigfile, tmp_config, BUFSZ-1);
lastconfigfile[BUFSZ-1] = '\0';
if ((fp = fopenp(tmp_config, "r")) != (FILE *)0)
return(fp);
# else /* should be only UNIX left */
@@ -1931,18 +1954,25 @@ int src;
Strcpy(tmp_config, ".nethackrc");
else
Sprintf(tmp_config, "%s/%s", envp, ".nethackrc");
if ((fp = fopenp(tmp_config, "r")) != (FILE *)0)
(void) strncpy(lastconfigfile, tmp_config, BUFSZ-1);
lastconfigfile[BUFSZ-1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0)
return(fp);
# if defined(__APPLE__)
/* try an alternative */
if (envp) {
Sprintf(tmp_config, "%s/%s", envp,
"Library/Preferences/NetHack Defaults");
if ((fp = fopenp(tmp_config, "r")) != (FILE *)0)
(void) strncpy(lastconfigfile, tmp_config, BUFSZ-1);
lastconfigfile[BUFSZ-1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0)
return(fp);
Sprintf(tmp_config, "%s/%s", envp,
"Library/Preferences/NetHack Defaults.txt");
if ((fp = fopenp(tmp_config, "r")) != (FILE *)0)
(void) strncpy(lastconfigfile, tmp_config, BUFSZ-1);
lastconfigfile[BUFSZ-1] = '\0';
if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0)
return(fp);
}
# endif
@@ -1957,7 +1987,7 @@ int src;
# endif
details = "";
raw_printf("Couldn't open default config file %s %s(%d).",
tmp_config, details, errno);
lastconfigfile, details, errno);
wait_synch();
}
# endif /* Unix */
@@ -2182,7 +2212,11 @@ int src;
sysopt.shellers = dupstr(bufp);
} else if (src == SET_IN_SYS && match_varname(buf, "DEBUGFILES", 5)) {
if (sysopt.debugfiles) free(sysopt.debugfiles);
sysopt.debugfiles = dupstr(bufp);
/* if showdebug() has already been called (perhaps we've added
some debugpline() calls to option processing) and has found
a value for getenv("DEBUGFILES"), don't override that */
if (sysopt.env_dbgfl == 0)
sysopt.debugfiles = dupstr(bufp);
} else if (src == SET_IN_SYS && match_varname(buf, "SUPPORT", 7)) {
if (sysopt.support) free(sysopt.support);
sysopt.support = dupstr(bufp);
@@ -3220,4 +3254,91 @@ int ifd, ofd;
/* ---------- END INTERNAL RECOVER ----------- */
#endif /*SELF_RECOVER*/
/* ---------- OTHER ----------- */
#ifdef SYSCF
# ifdef SYSCF_FILE
void
assure_syscf_file() {
/* All we really care about is the end result - can we read the file?
* So just check that directly. */
int fd;
fd = open(SYSCF_FILE, O_RDONLY);
if(fd >= 0){
/* readable */
close(fd);
return;
}
raw_printf("Unable to open SYSCF_FILE.\n");
exit(EXIT_FAILURE);
}
# endif /* SYSCF_FILE */
#endif /* SYSCF */
#ifdef DEBUG
/* used by debugpline() to decide whether to issue a message
from a partiular source file; caller passes __FILE__ and we check
whether it is in the source file list supplied by SYSCF's DEBUGFILES */
boolean
showdebug(filename)
const char *filename;
{
const char *debugfiles, *p;
if (!filename || !*filename) return FALSE; /* sanity precaution */
if (sysopt.env_dbgfl == 0) {
/* check once for DEBUGFILES in the environment;
if found, it supersedes the sysconf value
[note: getenv() rather than nh_getenv() since a long value
is valid and doesn't pose any sort of overflow risk here] */
if ((p = getenv("DEBUGFILES")) != 0) {
if (sysopt.debugfiles) free(sysopt.debugfiles);
sysopt.debugfiles = dupstr(p);
sysopt.env_dbgfl = 1;
} else
sysopt.env_dbgfl = -1;
}
debugfiles = sysopt.debugfiles;
/* usual case: sysopt.debugfiles will be empty */
if (!debugfiles || !*debugfiles) return FALSE;
/* strip filename's path if present */
# ifdef UNIX
if ((p = rindex(filename, '/')) != 0) filename = p + 1;
# endif
# ifdef VMS
filename = vms_basename(filename);
/* vms_basename strips off 'type' suffix as well as path and version;
we want to put suffix back (".c" assumed); since it always returns
a pointer to a static buffer, we can safely modify its result */
Strcat((char *)filename, ".c");
# endif
/*
* Wildcard match will only work if there's a single pattern (which
* might be a single file name without any wildcarding) rather than
* a space-separated list.
* [to NOT do: We could step through the space-separated list and
* attempt a wildcard match against each element, but that would be
* overkill for the intended usage.]
*/
if (pmatch(debugfiles, filename))
return TRUE;
/* check whether filename is an element of the list */
if ((p = strstr(debugfiles, filename)) != 0) {
int l = (int)strlen(filename);
if ((p == debugfiles || p[-1] == ' ' || p[-1] == '/')
&& (p[l] == ' ' || p[l] == '\0'))
return TRUE;
}
return FALSE;
}
#endif /*DEBUG*/
/*files.c*/
+10 -8
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 fountain.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 fountain.c $NHDT-Date: 1426953330 2015/03/21 15:55:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.40 $ */
/* NetHack 3.5 fountain.c $Date: 2011/08/20 00:22:20 $ $Revision: 1.32 $ */
/* Copyright Scott R. Turner, srt@ucla, 10/27/86 */
/* NetHack may be freely redistributed. See license for details. */
@@ -39,7 +39,7 @@ dowatersnakes() /* Fountain of snakes! */
if (!(mvitals[PM_WATER_MOCCASIN].mvflags & G_GONE)) {
if (!Blind)
pline("An endless stream of %s pours forth!",
Hallucination ? makeplural(rndmonnam()) : "snakes");
Hallucination ? makeplural(rndmonnam(NULL)) : "snakes");
else
You_hear("%s hissing!", something);
while(num-- > 0)
@@ -402,12 +402,14 @@ register struct obj *obj;
if(in_town(u.ux, u.uy))
(void) angry_guards(FALSE);
return;
} else if (water_damage(obj, NULL, TRUE) != ER_NOTHING) {
if (obj->otyp == POT_ACID) { /* Acid and water don't mix */
useup(obj);
return;
} else if (!rn2(2)) /* no further effect */
return;
} else {
int er = water_damage(obj, NULL, TRUE);
if (obj->otyp == POT_ACID && er != ER_DESTROYED) { /* Acid and water don't mix */
useup(obj);
return;
} else if (er != ER_NOTHING && !rn2(2)) { /* no further effect */
return;
}
}
switch (rnd(30)) {
+7 -2
View File
@@ -630,8 +630,11 @@ int mode;
if (Passes_walls && may_passwall(x,y)) {
; /* do nothing */
} else if (tmpr->typ == IRONBARS) {
if (!(Passes_walls || passes_bars(youmonst.data)))
if (!(Passes_walls || passes_bars(youmonst.data))) {
if (iflags.mention_walls)
You("cannot pass through the bars.");
return FALSE;
}
} else if (tunnels(youmonst.data) && !needspick(youmonst.data)) {
/* Eat the rock. */
if (mode == DO_MOVE && still_chewing(x,y)) return FALSE;
@@ -646,8 +649,10 @@ int mode;
if (Is_stronghold(&u.uz) && is_db_wall(x,y))
pline_The("drawbridge is up!");
/* sokoban restriction stays even after puzzle is solved */
if (Passes_walls && !may_passwall(x,y) && In_sokoban(&u.uz))
else if (Passes_walls && !may_passwall(x,y) && In_sokoban(&u.uz))
pline_The("Sokoban walls resist your ability.");
else if (iflags.mention_walls)
pline("It's a wall.");
}
return FALSE;
}
+34
View File
@@ -26,6 +26,7 @@ NetHack, except that rounddiv may call panic().
char chrcasecpy (int,int)
char * strcasecpy (char *,const char *)
char * s_suffix (const char *)
char * ing_suffix (const char *)
char * xcrypt (const char *, char *)
boolean onlyspace (const char *)
char * tabexpand (char *)
@@ -235,6 +236,39 @@ s_suffix(s) /* return a name converted to possessive */
return buf;
}
char *
ing_suffix(s)
const char *s;
{
const char *vowel = "aeiouy";
static char buf[BUFSZ];
char onoff[10];
char *p;
Strcpy(buf, s);
p = eos(buf);
onoff[0] = *p = *(p+1) = '\0';
if ((strlen(buf) > 4) &&
(!strcmpi(p-3, " on") ||
!strcmpi(p-4, " off") ||
!strcmpi(p-5, " with"))) {
p = strrchr(buf, ' ');
Strcpy(onoff, p);
}
if (!index(vowel, *(p-1)) && index(vowel, *(p-2)) && !index(vowel, *(p-3))) {
/* tip -> tipp + ing */
*p = *(p-1);
*(p+1) = '\0';
} else if (!strcmpi(p-2, "ie")) { /* vie -> vy + ing */
*(p-2) = 'y';
*(p-1) = '\0';
} else if (*(p-1) == 'e') /* grease -> greas + ing */
*(p-1) = '\0';
Strcat(buf, "ing");
if (onoff[0]) Strcat(buf, onoff);
return buf;
}
char *
xcrypt(str, buf) /* trivial text encryption routine (see makedefs) */
const char *str;
+47 -8
View File
@@ -240,15 +240,19 @@ struct obj *obj;
} else if (obj->otyp == AMULET_OF_YENDOR) {
if (u.uhave.amulet) impossible("already have amulet?");
u.uhave.amulet = 1;
u.uachieve.amulet = 1;
} else if (obj->otyp == CANDELABRUM_OF_INVOCATION) {
if (u.uhave.menorah) impossible("already have candelabrum?");
u.uhave.menorah = 1;
u.uachieve.menorah = 1;
} else if (obj->otyp == BELL_OF_OPENING) {
if (u.uhave.bell) impossible("already have silver bell?");
u.uhave.bell = 1;
u.uachieve.bell = 1;
} else if (obj->otyp == SPE_BOOK_OF_THE_DEAD) {
if (u.uhave.book) impossible("already have the book?");
u.uhave.book = 1;
u.uachieve.book = 1;
} else if (obj->oartifact) {
if (is_quest_artifact(obj)) {
if (u.uhave.questart)
@@ -258,6 +262,15 @@ struct obj *obj;
}
set_artifact_intrinsic(obj, 1, W_ART);
}
if(obj->otyp == LUCKSTONE && obj->record_achieve_special) {
u.uachieve.mines_luckstone = 1;
obj->record_achieve_special = 0;
} else if((obj->otyp == AMULET_OF_REFLECTION ||
obj->otyp == BAG_OF_HOLDING) &&
obj->record_achieve_special) {
u.uachieve.finish_sokoban = 1;
obj->record_achieve_special = 0;
}
}
/*
@@ -971,7 +984,21 @@ register const char *let,*word;
return((struct obj *)0);
}
if(ilet == '-') {
return(allownone ? &zeroobj : (struct obj *) 0);
if (!allownone) {
char *suf = NULL;
strcpy(buf, word);
if ((bp = strstr(buf, " on the ")) != NULL) { /* rub on the stone[s] */
*bp = '\0';
suf = (bp + 1);
}
if ((bp = strstr(buf, " or ")) != NULL) {
*bp = '\0';
bp = (rn2(2) ? buf : (bp + 4));
} else bp = buf;
You("mime %s something%s%s.", ing_suffix(bp),
suf ? " " : "", suf ? suf : "");
}
return(allownone ? &zeroobj : (struct obj *) 0);
}
if(ilet == def_oc_syms[COIN_CLASS].sym) {
if (!usegold) {
@@ -1774,7 +1801,7 @@ nextclass:
if (!flags.sortpack || otmp->oclass == *invlet) {
if (flags.sortpack && !classcount) {
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
let_to_name(*invlet, FALSE), MENU_UNSELECTED);
let_to_name(*invlet, FALSE, (want_reply && iflags.menu_head_objsym)), MENU_UNSELECTED);
classcount++;
}
any.a_char = ilet;
@@ -1848,7 +1875,7 @@ char avoidlet;
if (flags.sortpack && !classcount) {
any = zeroany; /* zero */
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
let_to_name(*invlet, FALSE), MENU_UNSELECTED);
let_to_name(*invlet, FALSE, FALSE), MENU_UNSELECTED);
classcount++;
}
any.a_char = ilet;
@@ -1976,7 +2003,7 @@ dounpaid()
if (otmp->unpaid) {
if (!flags.sortpack || otmp->oclass == *invlet) {
if (flags.sortpack && !classcount) {
putstr(win, 0, let_to_name(*invlet, TRUE));
putstr(win, 0, let_to_name(*invlet, TRUE, FALSE));
classcount++;
}
@@ -1994,7 +2021,7 @@ dounpaid()
if (count > num_so_far) {
/* something unpaid is contained */
if (flags.sortpack)
putstr(win, 0, let_to_name(CONTAINED_SYM, TRUE));
putstr(win, 0, let_to_name(CONTAINED_SYM, TRUE, FALSE));
/*
* Search through the container objects in the inventory for
* unpaid items. The top level inventory items have already
@@ -2686,10 +2713,12 @@ static NEARDATA char *invbuf = (char *)0;
static NEARDATA unsigned invbufsiz = 0;
char *
let_to_name(let,unpaid)
let_to_name(let,unpaid,showsym)
char let;
boolean unpaid;
boolean unpaid,showsym;
{
const char *ocsymfmt = " ('%c')";
const int invbuf_sympadding = 8; /* arbitrary */
const char *class_name;
const char *pos;
int oclass = (let >= 1 && let < MAXOCLASSES) ? let : 0;
@@ -2702,7 +2731,8 @@ boolean unpaid;
else
class_name = names[0];
len = strlen(class_name) + (unpaid ? sizeof "unpaid_" : sizeof "");
len = strlen(class_name) + (unpaid ? sizeof "unpaid_" : sizeof "") +
(oclass ? (strlen(ocsymfmt)+invbuf_sympadding) : 0);
if (len > invbufsiz) {
if (invbuf) free((genericptr_t)invbuf);
invbufsiz = len + 10; /* add slop to reduce incremental realloc */
@@ -2712,6 +2742,15 @@ boolean unpaid;
Strcat(strcpy(invbuf, "Unpaid "), class_name);
else
Strcpy(invbuf, class_name);
if ((oclass != 0) && showsym) {
char *bp = eos(invbuf);
int mlen = invbuf_sympadding - strlen(class_name);
while (--mlen > 0) {
*bp = ' '; bp++;
}
*bp = '\0';
Sprintf(eos(invbuf), ocsymfmt, def_oc_syms[oclass].sym);
}
return invbuf;
}
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 light.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 light.c $NHDT-Date: 1426465436 2015/03/16 00:23:56 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.17 $ */
/* NetHack 3.5 light.c $Date: 2009/05/06 10:46:38 $ $Revision: 1.15 $ */
/* SCCS Id: @(#)light.c 3.5 2009/01/20 */
/* Copyright (c) Dean Luick, 1994 */
@@ -394,13 +394,13 @@ write_ls(fd, ls)
ls->id = zeroany;
ls->id.a_uint = otmp->o_id;
if (find_oid((unsigned)ls->id.a_uint) != otmp)
debugpline("write_ls: can't find obj #%u!", ls->id.a_uint);
impossible("write_ls: can't find obj #%u!", ls->id.a_uint);
} else { /* ls->type == LS_MONSTER */
mtmp = (struct monst *)ls->id.a_monst;
ls->id = zeroany;
ls->id.a_uint = mtmp->m_id;
if (find_mid((unsigned)ls->id.a_uint, FM_EVERYWHERE) != mtmp)
debugpline("write_ls: can't find mon #%u!", ls->id.a_uint);
impossible("write_ls: can't find mon #%u!", ls->id.a_uint);
}
ls->flags |= LSF_NEEDS_FIXUP;
bwrite(fd, (genericptr_t)ls, sizeof(light_source));
+9 -8
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 makemon.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 makemon.c $NHDT-Date: 1426465436 2015/03/16 00:23:56 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.74 $ */
/* NetHack 3.5 makemon.c $Date: 2012/01/29 00:34:33 $ $Revision: 1.69 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -93,7 +93,7 @@ register int x, y, n;
int cnttmp,cntdiv;
cnttmp = cnt;
debugpline("init group call x=%d,y=%d,n=%d,cnt=%d.", x, y, n, cnt);
debugpline4("init group call <%d,%d>, n=%d, cnt=%d.", x, y, n, cnt);
cntdiv = ((u.ulevel < 3) ? 4 : (u.ulevel < 5) ? 2 : 1);
#endif
/* Tuning: cut down on swarming at low character levels [mrs] */
@@ -758,7 +758,7 @@ boolean ghostly;
mvitals[mndx].born++;
if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN) &&
!(mvitals[mndx].mvflags & G_EXTINCT)) {
if (wizard) debugpline("Automatically extinguished %s.",
if (wizard) debugpline1("Automatically extinguished %s.",
makeplural(mons[mndx].mname));
mvitals[mndx].mvflags |= G_EXTINCT;
reset_rndmonst(mndx);
@@ -903,8 +903,8 @@ register int mmflags;
already been genocided, return */
if (mvitals[mndx].mvflags & G_GENOD) return((struct monst *) 0);
if (wizard && (mvitals[mndx].mvflags & G_EXTINCT))
debugpline("Explicitly creating extinct monster %s.",
mons[mndx].mname);
debugpline1("Explicitly creating extinct monster %s.",
mons[mndx].mname);
} else {
/* make a random (common) monster that can survive here.
* (the special levels ask for random monsters at specific
@@ -916,7 +916,7 @@ register int mmflags;
do {
if(!(ptr = rndmonst())) {
debugpline("Warning: no monster.");
debugpline0("Warning: no monster.");
return((struct monst *) 0); /* no more monsters! */
}
fakemon.data = ptr; /* set up for goodpos */
@@ -1252,7 +1252,7 @@ rndmonst()
}
if (mndx == SPECIAL_PM) {
/* evidently they've all been exterminated */
debugpline("rndmonst: no common mons!");
debugpline0("rndmonst: no common mons!");
return (struct permonst *)0;
} /* else `mndx' now ready for use below */
zlevel = level_difficulty();
@@ -1290,7 +1290,8 @@ rndmonst()
if (rndmonst_state.choice_count <= 0) {
/* maybe no common mons left, or all are too weak or too strong */
debugpline("rndmonst: choice_count=%d", rndmonst_state.choice_count);
debugpline1("rndmonst: choice_count=%d",
rndmonst_state.choice_count);
return (struct permonst *)0;
}
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 mklev.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 mklev.c $NHDT-Date: 1426465436 2015/03/16 00:23:56 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.25 $ */
/* NetHack 3.5 mklev.c $Date: 2012/02/15 01:55:33 $ $Revision: 1.20 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -684,7 +684,7 @@ makelevel()
/* make a secret treasure vault, not connected to the rest */
if(do_vault()) {
xchar w,h;
debugpline("trying to make a vault...");
debugpline0("trying to make a vault...");
w = 1;
h = 1;
if (check_room(&vault_x, &w, &vault_y, &h, TRUE)) {
@@ -1560,7 +1560,7 @@ xchar x, y;
*source = u.uz;
insert_branch(br, TRUE);
debugpline("Made knox portal.");
debugpline0("Made knox portal.");
place_branch(br, x, y);
}
+3 -3
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 mkmaze.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 mkmaze.c $NHDT-Date: 1426465437 2015/03/16 00:23:57 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.20 $ */
/* NetHack 3.5 mkmaze.c $Date: 2009/05/06 10:46:56 $ $Revision: 1.18 $ */
/* SCCS Id: @(#)mkmaze.c 3.5 2007/06/18 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
@@ -589,7 +589,7 @@ register const char *s;
if (x_range <= INVPOS_X_MARGIN || y_range <= INVPOS_Y_MARGIN ||
(x_range * y_range) <= (INVPOS_DISTANCE * INVPOS_DISTANCE))
debugpline("inv_pos: maze is too small! (%d x %d)",
debugpline2("inv_pos: maze is too small! (%d x %d)",
x_maze_max, y_maze_max);
inv_pos.x = inv_pos.y = 0; /*{occupied() => invocation_pos()}*/
do {
@@ -877,7 +877,7 @@ register xchar x, y, todnum, todlevel;
impossible("portal on top of portal??");
return;
}
debugpline("mkportal: at (%d,%d), to %s, level %d",
debugpline4("mkportal: at <%d,%d>, to %s, level %d",
x, y, dungeons[todnum].dname, todlevel);
ttmp->dst.dnum = todnum;
ttmp->dst.dlevel = todlevel;
+7 -6
View File
@@ -1529,10 +1529,9 @@ struct obj *otmp;
/* Adjust the age; must be same as obj_timer_checks() for off ice*/
age = monstermoves - otmp->age;
retval += age * (ROT_ICE_ADJUSTMENT-1) / ROT_ICE_ADJUSTMENT;
debugpline("The %s age has ice modifications:otmp->age = %ld, returning %ld.",
s_suffix(doname(otmp)),otmp->age, retval);
debugpline("Effective age of corpse: %ld.",
monstermoves - retval);
debugpline3("The %s age has ice modifications: otmp->age = %ld, returning %ld.",
s_suffix(doname(otmp)), otmp->age, retval);
debugpline1("Effective age of corpse: %ld.", monstermoves - retval);
}
return retval;
}
@@ -1561,7 +1560,8 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */
/* mark the corpse as being on ice */
otmp->on_ice = 1;
debugpline("%s is now on ice at %d,%d.", The(xname(otmp)),x,y);
debugpline3("%s is now on ice at <%d,%d>.",
The(xname(otmp)), x, y);
/* Adjust the time remaining */
tleft *= ROT_ICE_ADJUSTMENT;
restart_timer = TRUE;
@@ -1587,7 +1587,8 @@ int force; /* 0 = no force so do checks, <0 = force off, >0 force on */
long age;
otmp->on_ice = 0;
debugpline("%s is no longer on ice at %d,%d.", The(xname(otmp)),x,y);
debugpline3("%s is no longer on ice at <%d,%d>.",
The(xname(otmp)), x, y);
/* Adjust the remaining time */
tleft /= ROT_ICE_ADJUSTMENT;
restart_timer = TRUE;
+12 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 mkroom.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 mkroom.c $NHDT-Date: 1427239202 2015/03/24 23:20:02 $ $NHDT-Branch: master $:$NHDT-Revision: 1.16 $ */
/* NetHack 3.5 mkroom.c $Date: 2012/01/10 17:47:19 $ $Revision: 1.15 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -408,9 +408,17 @@ morguemon()
{
register int i = rn2(100), hd = rn2(level_difficulty());
if(hd > 10 && i < 10)
return((Inhell || In_endgame(&u.uz)) ? mkclass(S_DEMON,0) :
&mons[ndemon(A_NONE)]);
if(hd > 10 && i < 10) {
if (Inhell || In_endgame(&u.uz)) {
return(mkclass(S_DEMON,0));
} else {
int ndemon_res = ndemon(A_NONE);
if (ndemon_res != NON_PM)
return(&mons[ndemon_res]);
/* else do what? As is, it will drop to ghost/wraith/zombie */
}
}
if(hd > 8 && i > 85)
return(mkclass(S_VAMPIRE,0));
+3 -1
View File
@@ -1279,7 +1279,7 @@ register struct monst *mtmp, *mtmp2;
/* transfer the monster's inventory */
for (otmp = mtmp2->minvent; otmp; otmp = otmp->nobj) {
if (otmp->where != OBJ_MINVENT || otmp->ocarry != mtmp)
debugpline("replmon: minvent inconsistency");
debugpline0("replmon: minvent inconsistency");
otmp->ocarry = mtmp2;
}
mtmp->minvent = 0;
@@ -1623,6 +1623,8 @@ register struct monst *mtmp;
}
if(mtmp->iswiz) wizdead();
if(mtmp->data->msound == MS_NEMESIS) nemdead();
if(mtmp->data == &mons[PM_MEDUSA])
u.uachieve.killed_medusa = 1;
if(glyph_is_invisible(levl[mtmp->mx][mtmp->my].glyph))
unmap_object(mtmp->mx, mtmp->my);
m_detach(mtmp, mptr);
+1 -1
View File
@@ -88,7 +88,7 @@ struct obj *obj;
if (vis) {
pline("As %s opens the bottle, an enormous %s emerges!",
mon_nam(mon),
Hallucination ? rndmonnam() : (const char *)"ghost");
Hallucination ? rndmonnam(NULL) : (const char *)"ghost");
pline("%s is frightened to death, and unable to move.",
Monnam(mon));
}
+4 -4
View File
@@ -446,7 +446,7 @@ dodiscovered() /* free after Robert Viduya */
if ((dis = disco[i]) != 0 && interesting_to_discover(dis)) {
ct++;
if (oclass != prev_class) {
putstr(tmpwin, iflags.menu_headings, let_to_name(oclass, FALSE));
putstr(tmpwin, iflags.menu_headings, let_to_name(oclass, FALSE, FALSE));
prev_class = oclass;
}
Sprintf(buf, "%s %s",(objects[dis].oc_pre_discovered ? "*" : " "),
@@ -472,7 +472,7 @@ char *buf;
{
char *s;
Strcpy(buf, let_to_name(oclass, FALSE));
Strcpy(buf, let_to_name(oclass, FALSE, FALSE));
for (s = buf; *s; ++s) *s = lowc(*s);
return buf;
}
@@ -615,7 +615,7 @@ doclassdisco()
break;
default:
oclass = def_char_to_objclass(c);
Sprintf(buf, "Discovered %s", let_to_name(oclass, FALSE));
Sprintf(buf, "Discovered %s", let_to_name(oclass, FALSE, FALSE));
putstr(tmpwin, iflags.menu_headings, buf);
for (i = bases[(int)oclass];
i < NUM_OBJECTS && objects[i].oc_class == oclass; ++i) {
@@ -672,7 +672,7 @@ rename_disco()
if (oclass != prev_class) {
any.a_int = 0;
add_menu(tmpwin, NO_GLYPH, &any, ' ', iflags.menu_headings,
ATR_NONE, let_to_name(oclass, FALSE), MENU_UNSELECTED);
ATR_NONE, let_to_name(oclass, FALSE, FALSE), MENU_UNSELECTED);
prev_class = oclass;
}
any.a_int = dis;
+1 -1
View File
@@ -1693,7 +1693,7 @@ static struct sing_plur one_off[] = {
static const char *const as_is[] = {
/* makesingular() leaves these plural due to how they're used */
"boots", "shoes",
"gloves", "lenses", "scales",
"gloves", "lenses", "scales", "eyes",
"gauntlets",
"iron bars",
/* both singular and plural are spelled the same */
+10 -8
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 options.c $NHDT-Date: 1425083082 2015/02/28 00:24:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.158 $ */
/* NetHack 3.5 options.c $NHDT-Date: 1427073746 2015/03/23 01:22:26 $ $NHDT-Branch: master $:$NHDT-Revision: 1.164 $ */
/* NetHack 3.5 options.c $Date: 2012/04/09 02:56:30 $ $Revision: 1.153 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -139,8 +139,10 @@ static struct Bool_Opt
#else
{"mail", (boolean *)0, TRUE, SET_IN_FILE},
#endif
{"mention_walls", &iflags.mention_walls, FALSE, SET_IN_GAME},
/* for menu debugging only*/
{"menu_tab_sep", &iflags.menu_tab_sep, FALSE, SET_IN_GAME},
{"menu_objsyms", &iflags.menu_head_objsym, FALSE, SET_IN_GAME},
{"mouse_support", &iflags.wc_mouse_support, TRUE, DISP_IN_GAME}, /*WC*/
#ifdef NEWS
{"news", &iflags.news, TRUE, DISP_IN_GAME},
@@ -798,10 +800,10 @@ rejectoption(optname)
const char *optname;
{
#ifdef MICRO
pline("\"%s\" settable only from %s.", optname, configfile);
pline("\"%s\" settable only from %s.", optname, lastconfigfile);
#else
pline("%s can be set only from NETHACKOPTIONS or %s.", optname,
configfile);
lastconfigfile);
#endif
}
@@ -821,7 +823,7 @@ const char *opts;
#endif
if(from_file)
raw_printf("Bad syntax in OPTIONS in %s: %s.", configfile, opts);
raw_printf("Bad syntax in OPTIONS in %s: %s.", lastconfigfile, opts);
else
raw_printf("Bad syntax in NETHACKOPTIONS: %s.", opts);
@@ -2484,7 +2486,7 @@ goodfruit:
#if defined(BACKWARD_COMPAT)
fullname = "DECgraphics";
if (match_optname(opts, fullname, 10, TRUE)) {
if (match_optname(opts, fullname, 3, TRUE)) {
boolean badflag = FALSE;
if (duplicate) complain_about_duplicate(opts,1);
if (!negated) {
@@ -2508,7 +2510,7 @@ goodfruit:
return;
}
fullname = "IBMgraphics";
if (match_optname(opts, fullname, 10, TRUE)) {
if (match_optname(opts, fullname, 3, TRUE)) {
const char *sym_name = fullname;
boolean badflag = FALSE;
if (duplicate) complain_about_duplicate(opts,1);
@@ -2542,7 +2544,7 @@ goodfruit:
#endif
#ifdef MAC_GRAPHICS_ENV
fullname = "MACgraphics";
if (match_optname(opts, fullname, 11, TRUE)) {
if (match_optname(opts, fullname, 3, TRUE)) {
boolean badflag = FALSE;
if (duplicate) complain_about_duplicate(opts,1);
if (!negated) {
@@ -4070,7 +4072,7 @@ option_help()
winid datawin;
datawin = create_nhwindow(NHW_TEXT);
Sprintf(buf, "Set options as OPTIONS=<options> in %s", configfile);
Sprintf(buf, "Set options as OPTIONS=<options> in %s", lastconfigfile);
opt_intro[CONFIG_SLOT] = (const char *) buf;
for (i = 0; opt_intro[i]; i++)
putstr(datawin, 0, opt_intro[i]);
+13 -9
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 pickup.c $NHDT-Date: 1425081977 2015/02/28 00:06:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.126 $ */
/* NetHack 3.5 pickup.c $NHDT-Date: 1426558927 2015/03/17 02:22:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.131 $ */
/* NetHack 3.5 pickup.c $Date: 2012/02/16 03:01:38 $ $Revision: 1.123 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -769,7 +769,9 @@ boolean FDECL((*allow), (OBJ_P));/* allow function */
if (sorted && !printed_type_name) {
any = zeroany;
add_menu(win, NO_GLYPH, &any, 0, 0, iflags.menu_headings,
let_to_name(*pack, FALSE), MENU_UNSELECTED);
let_to_name(*pack, FALSE,
(how != PICK_NONE) && iflags.menu_head_objsym),
MENU_UNSELECTED);
printed_type_name = TRUE;
}
@@ -897,7 +899,7 @@ int how; /* type of query */
(*pick_list)->item.a_int = curr->oclass;
return 1;
} else {
debugpline("query_category: no single object match");
debugpline0("query_category: no single object match");
}
return 0;
}
@@ -928,8 +930,10 @@ int how; /* type of query */
any.a_int = curr->oclass;
add_menu(win, NO_GLYPH, &any, invlet++,
def_oc_syms[(int)objects[curr->otyp].oc_class].sym,
ATR_NONE, let_to_name(*pack, FALSE),
MENU_UNSELECTED);
ATR_NONE,
let_to_name(*pack, FALSE,
(how != PICK_NONE) && iflags.menu_head_objsym),
MENU_UNSELECTED);
collected_type_name = TRUE;
}
}
@@ -1515,7 +1519,7 @@ doloot() /* loot a container on the floor or loot saddle from mon. */
lootcont:
if (container_at(cc.x, cc.y, FALSE)) {
boolean any = FALSE;
boolean anyfound = FALSE;
int num_conts = 0;
if (!able_to_loot(cc.x, cc.y, TRUE)) return 0;
@@ -1563,14 +1567,14 @@ lootcont:
cobj, doname, ansimpleoname, "a container"));
if (c == 'q') return (timepassed);
if (c == 'n') continue;
any = TRUE;
anyfound = TRUE;
timepassed |= do_loot_cont(&cobj);
/* might have triggered chest trap or magic bag explosion */
if (multi < 0 || !cobj) return 1;
}
}
if (any) c = 'y';
if (anyfound) c = 'y';
}
} else if (IS_GRAVE(levl[cc.x][cc.y].typ)) {
You("need to dig up the grave to effectively loot it...");
@@ -2040,7 +2044,7 @@ struct obj *box;
(void) add_to_container(box, deadcat);
}
pline_The("%s inside the box is dead!",
Hallucination ? rndmonnam() : "housecat");
Hallucination ? rndmonnam(NULL) : "housecat");
}
box->owt = weight(box);
return;
+4 -4
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 potion.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 potion.c $NHDT-Date: 1426953330 2015/03/21 15:55:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.99 $ */
/* NetHack 3.5 potion.c $Date: 2013/11/05 00:57:55 $ $Revision: 1.91 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -371,7 +371,7 @@ ghost_from_bottle()
return;
}
pline("As you open the bottle, an enormous %s emerges!",
Hallucination ? rndmonnam() : (const char *)"ghost");
Hallucination ? rndmonnam(NULL) : (const char *)"ghost");
if(flags.verbose)
You("are frightened to death, and unable to move.");
nomul(-3);
@@ -1664,8 +1664,8 @@ dodip()
rider_cant_reach(); /* not skilled enough to reach */
} else {
if (obj->otyp == POT_ACID) obj->in_use = 1;
(void) water_damage(obj, 0, TRUE);
if (obj->in_use) useup(obj);
if (water_damage(obj, 0, TRUE) != ER_DESTROYED && obj->in_use)
useup(obj);
}
return 1;
}
+1
View File
@@ -1373,6 +1373,7 @@ dosacrifice()
done(ESCAPED);
} else { /* super big win */
adjalign(10);
u.uachieve.ascended = 1;
pline("An invisible choir sings, and you are bathed in radiance...");
godvoice(altaralign, "Congratulations, mortal!");
display_nhwindow(WIN_MESSAGE, FALSE);
+3 -2
View File
@@ -284,13 +284,14 @@ char *pname; /* caller-supplied output buffer */
boolean do_hallu = Hallucination,
aligned_priest = mon->data == &mons[PM_ALIGNED_PRIEST],
high_priest = mon->data == &mons[PM_HIGH_PRIEST];
const char *what = do_hallu ? rndmonnam() : mon->data->mname;
char whatcode = '\0';
const char *what = do_hallu ? rndmonnam(&whatcode) : mon->data->mname;
if (!mon->ispriest && !mon->isminion) /* should never happen... */
return strcpy(pname, what); /* caller must be confused */
*pname = '\0';
if (!do_hallu || !bogon_is_pname(what)) Strcat(pname, "the ");
if (!do_hallu || !bogon_is_pname(whatcode)) Strcat(pname, "the ");
if (mon->minvis) Strcat(pname, "invisible ");
if (mon->isminion && EMIN(mon)->renegade)
Strcat(pname, "renegade ");
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 questpgr.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 questpgr.c $NHDT-Date: 1426465439 2015/03/16 00:23:59 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.18 $ */
/* NetHack 3.5 questpgr.c $Date: 2012/02/02 09:18:14 $ $Revision: 1.14 $ */
/* Copyright 1991, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */
@@ -47,7 +47,7 @@ dump_qtlist() /* dump the character msg list to check appearance */
{
struct qtmsg *msg;
if (!showdebug()) return;
if (!showdebug(__FILE__)) return;
for (msg = qt_list.chrole; msg->msgnum > 0; msg++) {
pline("msgnum %d: delivery %c",
+16 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 restore.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 restore.c $NHDT-Date: 1426465439 2015/03/16 00:23:59 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.77 $ */
/* NetHack 3.5 restore.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.71 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -551,9 +551,20 @@ unsigned int *stuckid, *steedid;
amii_setpens(amii_numcolors); /* use colors from save file */
#endif
mread(fd, (genericptr_t) &u, sizeof(struct you));
mread(fd, (genericptr_t) timebuf, 14);
timebuf[14] = '\0';
ubirthday = time_from_yyyymmddhhmmss(timebuf);
#define ReadTimebuf(foo) mread(fd, (genericptr_t) timebuf, 14); \
timebuf[14] = '\0'; \
foo = time_from_yyyymmddhhmmss(timebuf);
ReadTimebuf(ubirthday);
ReadTimebuf(urealtime.realtime);
ReadTimebuf(urealtime.restored);
#if defined(BSD) && !defined(POSIX_TYPES)
(void) time((long *)&urealtime.restored);
#else
(void) time(&urealtime.restored);
#endif
set_uasmon();
#ifdef CLIPPING
@@ -1153,7 +1164,7 @@ register int fd;
++msgcount;
}
if (msgcount) putmsghistory((char *)0, TRUE);
debugpline("Read %d messages from savefile.", msgcount);
debugpline1("Read %d messages from savefile.", msgcount);
}
/* Clear all structures for object and monster ID mapping. */
+5 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 rnd.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 rnd.c $NHDT-Date: 1426465440 2015/03/16 00:24:00 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.8 $ */
/* NetHack 3.5 rnd.c $Date: 2009/05/06 10:47:41 $ $Revision: 1.7 $ */
/* SCCS Id: @(#)rnd.c 3.5 2004/08/27 */
/* NetHack may be freely redistributed. See license for details. */
@@ -24,7 +24,7 @@ register int x;
{
#ifdef BETA
if (x <= 0) {
debugpline("rn2(%d) attempted", x);
debugpline1("rn2(%d) attempted", x);
return(0);
}
x = RND(x);
@@ -42,7 +42,7 @@ register int x; /* good luck approaches 0, bad luck approaches (x-1) */
#ifdef BETA
if (x <= 0) {
debugpline("rnl(%d) attempted", x);
debugpline1("rnl(%d) attempted", x);
return(0);
}
#endif
@@ -81,7 +81,7 @@ register int x;
{
#ifdef BETA
if (x <= 0) {
debugpline("rnd(%d) attempted", x);
debugpline1("rnd(%d) attempted", x);
return(1);
}
x = RND(x)+1;
@@ -99,7 +99,7 @@ register int n, x;
#ifdef BETA
if (x < 0 || n < 0 || (x == 0 && n != 0)) {
debugpline("d(%d,%d) attempted", n, x);
debugpline2("d(%d,%d) attempted", n, x);
return(1);
}
#endif
+11 -9
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 role.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 role.c $NHDT-Date: 1426558928 2015/03/17 02:22:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.21 $ */
/* NetHack 3.5 role.c $Date: 2012/02/16 03:01:38 $ $Revision: 1.18 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985-1999. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1333,14 +1333,16 @@ plnamesuffix()
int i;
#ifdef GENERIC_USERNAMES
/* some generic user names will be ignored in favor of prompting */
i = (int)strlen(plname);
eptr = GENERIC_USERNAMES;
sptr = strstri(eptr, plname);
if (sptr
&& (sptr == eptr || sptr[-1] == ' ')
&& (sptr[i] == ' ' || sptr[i] == '\0'))
*plname = '\0'; /* call askname() */
{
/* some generic user names will be ignored in favor of prompting */
const char *uptr = GENERIC_USERNAMES;
i = (int)strlen(plname);
if ((sptr = strstri(uptr, plname)) != 0
&& (sptr == uptr || sptr[-1] == ' ')
&& (sptr[i] == ' ' || sptr[i] == '\0'))
*plname = '\0'; /* call askname() */
}
#endif
do {
+40
View File
@@ -266,6 +266,46 @@ rumor_check()
}
}
/* Gets a random line of text from file 'fname', and returns it. */
char *
get_rnd_text(fname, buf)
const char *fname;
char *buf;
{
dlb *fh;
buf[0] = '\0';
fh = dlb_fopen(fname, "r");
if (fh) {
/* TODO: cache sizetxt, starttxt, endtxt. maybe cache file contents? */
long sizetxt = 0, starttxt = 0, endtxt = 0, tidbit = 0;
char *endp, line[BUFSZ], xbuf[BUFSZ];
(void) dlb_fgets(line, sizeof line, fh); /* skip "don't edit" comment */
(void) dlb_fseek(fh, 0L, SEEK_CUR);
starttxt = dlb_ftell(fh);
(void) dlb_fseek(fh, 0L, SEEK_END);
endtxt = dlb_ftell(fh);
sizetxt = endtxt - starttxt;
tidbit = Rand() % sizetxt;
(void) dlb_fseek(fh, starttxt + tidbit, SEEK_SET);
(void) dlb_fgets(line, sizeof line, fh);
if (!dlb_fgets(line, sizeof line, fh)) {
(void) dlb_fseek(fh, starttxt, SEEK_SET);
(void) dlb_fgets(line, sizeof line, fh);
}
if ((endp = index(line, '\n')) != 0) *endp = 0;
Strcat(buf, xcrypt(line, xbuf));
(void) dlb_fclose(fh);
} else impossible("Can't open file %s!", fname);
return buf;
}
void
outrumor(truth, mechanism)
int truth; /* 1=true, -1=false, 0=either */
+7 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 save.c $NHDT-Date: 1425081977 2015/02/28 00:06:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.59 $ */
/* NetHack 3.5 save.c $NHDT-Date: 1426496455 2015/03/16 09:00:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.62 $ */
/* NetHack 3.5 save.c $Date: 2012/02/16 02:40:24 $ $Revision: 1.53 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -307,8 +307,11 @@ register int fd, mode;
#ifdef SYSFLAGS
bwrite(fd, (genericptr_t) &sysflags, sizeof(struct sysflag));
#endif
urealtime.realtime += (getnow() - urealtime.restored);
bwrite(fd, (genericptr_t) &u, sizeof(struct you));
bwrite(fd, yyyymmddhhmmss(ubirthday), 14);
bwrite(fd, yyyymmddhhmmss(urealtime.realtime), 14);
bwrite(fd, yyyymmddhhmmss(urealtime.restored), 14);
save_killers(fd, mode);
/* must come before migrating_objs and migrating_mons are freed */
@@ -1210,7 +1213,7 @@ int fd, mode;
}
bwrite(fd, (genericptr_t) &minusone, sizeof(int));
}
debugpline("Stored %d messages into savefile.", msgcount);
debugpline1("Stored %d messages into savefile.", msgcount);
/* note: we don't attempt to handle release_data() here */
}
@@ -1313,6 +1316,7 @@ freedynamicdata()
/* level-specific data */
free_timers(RANGE_LEVEL);
free_light_sources(RANGE_LEVEL);
clear_regions();
freemonchn(fmon);
free_worm(); /* release worm segment information */
freetrapchn(ftrap);
@@ -1350,6 +1354,7 @@ freedynamicdata()
#ifdef STATUS_VIA_WINDOWPORT
status_finish();
#endif
sysopt_release(); /* SYSCF strings */
return;
}
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 shk.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 shk.c $NHDT-Date: 1426465441 2015/03/16 00:24:01 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.96 $ */
/* NetHack 3.5 shk.c $Date: 2012/07/03 22:54:49 $ $Revision: 1.91 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1205,7 +1205,7 @@ dopay()
}
if(!shkp) {
debugpline("dopay: null shkp.");
debugpline0("dopay: null shkp.");
return(0);
}
proceed:
+6 -2
View File
@@ -304,7 +304,11 @@ dosounds()
static const char * const h_sounds[] = {
"beep", "boing", "sing", "belche", "creak", "cough", "rattle",
"ululate", "pop", "jingle", "sniffle", "tinkle", "eep"
"ululate", "pop", "jingle", "sniffle", "tinkle", "eep",
"clatter", "hum", "sizzle", "twitter", "wheeze", "rustle",
"honk", "lisp", "yodel", "coo", "burp", "moo", "boom",
"murmur", "oink", "quack", "rumble", "twang", "bellow",
"toot", "gargle", "hoot", "warble"
};
const char *
@@ -1006,7 +1010,7 @@ dochat()
if (!Blind) {
if (Hallucination) {
/* if you're hallucinating, you can't tell it's a statue */
pline_The("%s seems not to notice you.", rndmonnam());
pline_The("%s seems not to notice you.", rndmonnam(NULL));
}
else {
pline_The("statue seems not to notice you.");
+18 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 sp_lev.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 sp_lev.c $NHDT-Date: 1426465441 2015/03/16 00:24:01 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.25 $ */
/* NetHack 3.5 sp_lev.c $Date: 2011/01/05 01:28:36 $ $Revision: 1.23 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */
@@ -324,8 +324,8 @@ chk:
lev = &levl[x][y];
for (; y <= ymax; y++) {
if (lev++->typ) {
if(!vault)
debugpline("strange area [%d,%d] in check_room.",x,y);
if (!vault)
debugpline2("strange area [%d,%d] in check_room.", x, y);
if (!rn2(3)) return FALSE;
if (x < *lowx)
*lowx = x + xlim + 1;
@@ -398,7 +398,7 @@ xchar rtype, rlit;
r1 = rnd_rect(); /* Get a random rectangle */
if (!r1) { /* No more free rectangles ! */
debugpline("No more rects...");
debugpline0("No more rects...");
return FALSE;
}
hx = r1->hx;
@@ -1062,6 +1062,18 @@ struct mkroom *croom;
mongone(was);
}
/* Nasty hack here: try to determine if this is the Mines or Sokoban
* "prize" and then set record_achieve_special (maps to corpsenm)
* for the object. That field will later be checked to find out if
* the player obtained the prize. */
if(otmp->otyp == LUCKSTONE && Is_mineend_level(&u.uz)) {
otmp->record_achieve_special = 1;
} else if((otmp->otyp == AMULET_OF_REFLECTION ||
otmp->otyp == BAG_OF_HOLDING) &&
Is_sokoend_level(&u.uz)) {
otmp->record_achieve_special = 1;
}
stackobj(otmp);
} /* if (rn2(100) < o->chance) */
@@ -1311,8 +1323,8 @@ schar ftyp, btyp;
if (xx <= 0 || yy <= 0 || tx <= 0 || ty <= 0 ||
xx > COLNO-1 || tx > COLNO-1 ||
yy > ROWNO-1 || ty > ROWNO-1) {
debugpline("dig_corridor: bad coords : (%d,%d) (%d,%d).",
xx,yy,tx,ty);
debugpline4("dig_corridor: bad coords <%d,%d> <%d,%d>.",
xx, yy, tx, ty);
return FALSE;
}
if (tx > xx) dx = 1;
+35 -6
View File
@@ -1,26 +1,37 @@
/* NetHack 3.5 sys.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 sys.c $NHDT-Date: 1426544797 2015/03/16 22:26:37 $ $NHDT-Branch: master $:$NHDT-Revision: 1.18 $ */
/* NetHack 3.5 sys.c $Date: 2012/03/10 02:22:07 $ $Revision: 1.12 $ */
/* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */
/* NetHack may be freely redistributed. See license for details. */
#include "hack.h"
/* for KR1ED config, WIZARD is 0 or 1 and WIZARD_NAME is a string;
for usual config, WIZARD is the string; forcing WIZARD_NAME to match it
eliminates conditional testing for which one to use in string ops */
#ifndef SYSCF
/* !SYSCF configurations need '#define DEBUGFILES "foo.c bar.c"'
to enable debugging feedback for source files foo.c and bar.c;
to activate debugpline(), set an appropriate value and uncomment */
/* # define DEBUGFILES "*" */
/* note: DEBUGFILES value here or in sysconf.DEBUGFILES can be overridden
at runtime by setting up a value for "DEBUGFILES" in the environment */
#endif
struct sysopt sysopt;
void
sys_early_init(){
sys_early_init()
{
sysopt.support = NULL;
sysopt.recover = NULL;
#ifdef SYSCF
sysopt.wizards = NULL;
#else
sysopt.wizards = WIZARD_NAME;
sysopt.wizards = dupstr(WIZARD_NAME);
#endif
#if defined(SYSCF) || !defined(DEBUGFILES)
sysopt.debugfiles = NULL;
#else
sysopt.debugfiles = dupstr(DEBUGFILES);
#endif
sysopt.env_dbgfl = 0; /* haven't checked getenv("DEBUGFILES") yet */
sysopt.shellers = NULL;
sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */
@@ -59,6 +70,24 @@ sys_early_init(){
sysopt_seduce_set(sysopt.seduce);
}
void
sysopt_release()
{
if (sysopt.support)
free(sysopt.support), sysopt.support = NULL;
if (sysopt.recover)
free(sysopt.recover), sysopt.recover = NULL;
if (sysopt.wizards)
free(sysopt.wizards), sysopt.wizards = NULL;
if (sysopt.debugfiles)
free(sysopt.debugfiles), sysopt.debugfiles = NULL;
#ifdef PANICTRACE
if (sysopt.gdbpath)
free(sysopt.gdbpath), sysopt.gdbpath = NULL;
if (sysopt.greppath)
free (sysopt.greppath), sysopt.greppath = NULL;
#endif
}
extern struct attack sa_yes[NATTK];
extern struct attack sa_no[NATTK];
+2 -2
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 teleport.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 teleport.c $NHDT-Date: 1426465443 2015/03/16 00:24:03 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.48 $ */
/* NetHack 3.5 teleport.c $Date: 2012/01/04 18:52:36 $ $Revision: 1.45 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -121,7 +121,7 @@ unsigned entflags;
struct monst fakemon; /* dummy monster */
if (!mdat) {
debugpline("enexto() called with mdat==0");
debugpline0("enexto() called with null mdat");
/* default to player's original monster type */
mdat = &mons[u.umonster];
}
+1 -1
View File
@@ -164,7 +164,7 @@ slime_dialogue()
if (!Blind) /* [what if you're already green?] */
pline(buf, hcolor(NH_GREEN));
} else
pline(buf, an(Hallucination ? rndmonnam() : "green slime"));
pline(buf, an(Hallucination ? rndmonnam(NULL) : "green slime"));
} else
pline1(buf);
}
+113 -1
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 topten.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 topten.c $NHDT-Date: 1426731079 2015/03/19 02:11:19 $ $NHDT-Branch: harder_d8 $:$NHDT-Revision: 1.25 $ */
/* NetHack 3.5 topten.c $Date: 2012/01/24 04:26:15 $ $Revision: 1.23 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -65,6 +65,9 @@ STATIC_DCL void FDECL(outentry, (int,struct toptenentry *,BOOLEAN_P));
STATIC_DCL void FDECL(discardexcess, (FILE *));
STATIC_DCL void FDECL(readentry, (FILE *,struct toptenentry *));
STATIC_DCL void FDECL(writeentry, (FILE *,struct toptenentry *));
STATIC_DCL void FDECL(writexlentry, (FILE*, struct toptenentry *));
STATIC_DCL long NDECL(encodeconduct);
STATIC_DCL long NDECL(encodeachieve);
STATIC_DCL void FDECL(free_ttlist, (struct toptenentry *));
STATIC_DCL int FDECL(classmon, (char *,BOOLEAN_P));
STATIC_DCL int FDECL(score_wanted,
@@ -292,6 +295,100 @@ struct toptenentry *tt;
#endif
}
/* as tab is never used in eg. plname or death, no need to mangle those. */
STATIC_OVL void
writexlentry(rfile,tt)
FILE *rfile;
struct toptenentry *tt;
{
#define Fprintf (void)fprintf
#define XLOG_SEP '\t' /* xlogfile field separator. */
char buf[BUFSZ];
Sprintf(buf, "version=%d.%d.%d",
tt->ver_major, tt->ver_minor, tt->patchlevel);
Sprintf(eos(buf), "%cpoints=%ld%cdeathdnum=%d%cdeathlev=%d",
XLOG_SEP, tt->points,
XLOG_SEP, tt->deathdnum,
XLOG_SEP, tt->deathlev);
Sprintf(eos(buf), "%cmaxlvl=%d%chp=%d%cmaxhp=%d",
XLOG_SEP, tt->maxlvl,
XLOG_SEP, tt->hp,
XLOG_SEP, tt->maxhp);
Sprintf(eos(buf), "%cdeaths=%d%cdeathdate=%ld%cbirthdate=%ld%cuid=%d",
XLOG_SEP, tt->deaths,
XLOG_SEP, tt->deathdate,
XLOG_SEP, tt->birthdate,
XLOG_SEP, tt->uid);
Fprintf(rfile, "%s", buf);
Sprintf(buf, "%crole=%s%crace=%s%cgender=%s%calign=%s",
XLOG_SEP, tt->plrole,
XLOG_SEP, tt->plrace,
XLOG_SEP, tt->plgend,
XLOG_SEP, tt->plalign);
Fprintf(rfile, "%s%cname=%s%cdeath=%s",
buf, /* (already includes separator) */
XLOG_SEP, plname,
XLOG_SEP, tt->death);
Fprintf(rfile, "%cconduct=0x%lx%cturns=%ld%cachieve=0x%lx",
XLOG_SEP, encodeconduct(),
XLOG_SEP, moves,
XLOG_SEP, encodeachieve());
Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime=%ld",
XLOG_SEP, (long)urealtime.realtime,
XLOG_SEP, (long)ubirthday,
XLOG_SEP, (long)urealtime.endtime);
Fprintf(rfile, "%cgender0=%s%calign0=%s",
XLOG_SEP, genders[flags.initgend].filecode,
XLOG_SEP, aligns[1 - u.ualignbase[A_ORIGINAL]].filecode);
Fprintf(rfile, "\n");
#undef XLOG_SEP
}
STATIC_OVL long
encodeconduct()
{
long e = 0L;
if(!u.uconduct.food) e |= 1L << 0;
if(!u.uconduct.unvegan) e |= 1L << 1;
if(!u.uconduct.unvegetarian) e |= 1L << 2;
if(!u.uconduct.gnostic) e |= 1L << 3;
if(!u.uconduct.weaphit) e |= 1L << 4;
if(!u.uconduct.killer) e |= 1L << 5;
if(!u.uconduct.literate) e |= 1L << 6;
if(!u.uconduct.polypiles) e |= 1L << 7;
if(!u.uconduct.polyselfs) e |= 1L << 8;
if(!u.uconduct.wishes) e |= 1L << 9;
if(!u.uconduct.wisharti) e |= 1L << 10;
if(!num_genocides()) e |= 1L << 11;
return e;
}
STATIC_OVL long
encodeachieve()
{
long r = 0L;
if(u.uachieve.bell) r |= 1L << 0;
if(u.uachieve.enter_gehennom) r |= 1L << 1;
if(u.uachieve.menorah) r |= 1L << 2;
if(u.uachieve.book) r |= 1L << 3;
if(u.uevent.invoked) r |= 1L << 4;
if(u.uachieve.amulet) r |= 1L << 5;
if(In_endgame(&u.uz)) r |= 1L << 6;
if(Is_astralevel(&u.uz)) r |= 1L << 7;
if(u.uachieve.ascended) r |= 1L << 8;
if(u.uachieve.mines_luckstone) r |= 1L << 9;
if(u.uachieve.finish_sokoban) r |= 1L << 10;
if(u.uachieve.killed_medusa) r |= 1L << 11;
return r;
}
STATIC_OVL void
free_ttlist(tt)
struct toptenentry *tt;
@@ -322,6 +419,9 @@ time_t when;
#ifdef LOGFILE
FILE *lfile;
#endif /* LOGFILE */
#ifdef XLOGFILE
FILE *xlfile;
#endif /* XLOGFILE */
/* Under DICE 3.0, this crashes the system consistently, apparently due to
* corruption of *rfile somewhere. Until I figure this out, just cut out
@@ -380,6 +480,7 @@ time_t when;
t0->birthdate = yyyymmdd(ubirthday);
t0->deathdate = yyyymmdd(when);
t0->tt_next = 0;
urealtime.endtime = when;
#ifdef UPDATE_RECORD_IN_PLACE
t0->fpos = -1L;
#endif
@@ -395,6 +496,17 @@ time_t when;
unlock_file(LOGFILE);
}
#endif /* LOGFILE */
#ifdef XLOGFILE
if (lock_file(XLOGFILE, SCOREPREFIX, 10)) {
if(!(xlfile = fopen_datafile(XLOGFILE, "a", SCOREPREFIX))) {
HUP raw_print("Cannot open extended log file!");
} else {
writexlentry(xlfile, t0);
(void) fclose(xlfile);
}
unlock_file(XLOGFILE);
}
#endif /* XLOGFILE */
if (wizard || discover) {
if (how != PANICKED) HUP {
+47 -17
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 trap.c $NHDT-Date: 1425318721 2015/03/02 17:52:01 $ $NHDT-Branch: master $:$NHDT-Revision: 1.194 $ */
/* NetHack 3.5 trap.c $NHDT-Date: 1426805491 2015/03/19 22:51:31 $ $NHDT-Branch: water_damage $:$NHDT-Revision: 1.198 $ */
/* NetHack 3.5 trap.c $Date: 2013/03/14 01:58:21 $ $Revision: 1.179 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -621,7 +621,7 @@ int *fail_reason;
"statue");
pline("%s %s!", upstart(statuename), comes_to_life);
} else if (Hallucination) { /* They don't know it's a statue */
pline_The("%s suddenly seems more animated.", rndmonnam());
pline_The("%s suddenly seems more animated.", rndmonnam(NULL));
} else if (cause == ANIMATE_SHATTER) {
if (cansee(x, y))
Sprintf(statuename, "%s%s", shk_your(tmpbuf, statue),
@@ -3016,7 +3016,6 @@ xchar x, y;
{
int chance;
struct obj *otmp, *ncobj;
int retval = 0;
int in_sight = !Blind && couldsee(x, y); /* Don't care if it's lit */
int dindx;
@@ -3146,6 +3145,14 @@ struct obj *obj;
erode_obj(obj, NULL, ERODE_CORRODE, EF_GREASE | EF_VERBOSE);
}
/* context for water_damage(), managed by water_damage_chain();
when more than one stack of potions of acid explode while processing
a chain of objects, use alternate phrasing after the first message */
static struct h2o_ctx {
int dkn_boom, unk_boom; /* track dknown, !dknown separately */
boolean ctx_valid;
} acid_ctx = { 0, 0, FALSE };
/* Get an object wet and damage it appropriately.
* "ostr", if present, is used instead of the object name in some
* messages.
@@ -3158,7 +3165,7 @@ struct obj *obj;
const char *ostr;
boolean force;
{
boolean loose_obj = (obj && obj->where == OBJ_FREE), exploded = FALSE;
if (!obj) return ER_NOTHING;
if (snuff_lit(obj))
return ER_DAMAGED;
@@ -3202,23 +3209,36 @@ boolean force;
return ER_DAMAGED;
} else if (obj->oclass == POTION_CLASS) {
if (obj->otyp == POT_ACID) {
char *bufp, buf[BUFSZ];
boolean one = (obj->quan == 1L);
boolean update = carried(obj);
char *bufp;
boolean one = (obj->quan == 1L),
update = carried(obj),
exploded = FALSE;
bufp = strcpy(buf, "potion");
if (!one) bufp = makeplural(bufp);
/* [should we damage player/monster?] */
if (Blind && !carried(obj)) obj->dknown = 0;
if (acid_ctx.ctx_valid)
exploded = ((obj->dknown ? acid_ctx.dkn_boom
: acid_ctx.unk_boom) > 0);
/* First message is
* "a [potion|<color> potion|potion of acid] explodes"
* depending on obj->dknown (potion has been seen) and
* objects[POT_ACID].oc_name_known (fully discovered),
* or "some {plural version} explode" when relevant.
* Second and subsequent messages for same chain and
* matching dknown status are
* "another [potion|<color> &c] explodes" or plural
* variant.
*/
bufp = simpleonames(obj);
pline("%s %s %s!", /* "A potion explodes!" */
!exploded ? (one ? "A" : "Some") :
(one ? "Another" : "More"),
(one ? "Another" : "More"),
bufp, vtense(bufp, "explode"));
exploded = TRUE;
/* let caller know that obj has gone away
[when obj is part of a list, delobj()'s
obj_extract_self() takes care of this;
for loose_obj, obj should always equal
*objp and otmp should always be null] */
if (acid_ctx.ctx_valid) {
if (obj->dknown)
acid_ctx.dkn_boom++;
else
acid_ctx.unk_boom++;
}
setnotworn(obj);
delobj(obj);
if (update)
@@ -3250,10 +3270,20 @@ struct obj *obj;
boolean here;
{
struct obj *otmp;
/* initialize acid context: so far, neither seen (dknown) potions of
acid nor unseen have exploded during this water damage sequence */
acid_ctx.dkn_boom = acid_ctx.unk_boom = 0;
acid_ctx.ctx_valid = TRUE;
for (; obj; obj = otmp) {
otmp = here ? obj->nexthere : obj->nobj;
water_damage(obj, NULL, FALSE);
}
/* reset acid context */
acid_ctx.dkn_boom = acid_ctx.unk_boom = 0;
acid_ctx.ctx_valid = FALSE;
}
/*
+1
View File
@@ -500,6 +500,7 @@ u_init()
(void) memset((genericptr_t)&u, 0, sizeof(u));
u.ustuck = (struct monst *)0;
(void) memset((genericptr_t)&ubirthday, 0, sizeof(ubirthday));
(void) memset((genericptr_t)&urealtime, 0, sizeof(urealtime));
#if 0 /* documentation of more zero values as desirable */
u.usick_cause[0] = 0;
+1 -5
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 wield.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 wield.c $NHDT-Date: 1427062304 2015/03/22 22:11:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */
/* NetHack 3.5 wield.c $Date: 2009/05/06 10:48:14 $ $Revision: 1.31 $ */
/* SCCS Id: @(#)wield.c 3.5 2009/01/20 */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
@@ -349,10 +349,6 @@ dowieldquiver()
/* will_weld(), touch_petrifies(), etc. */
multi = 0;
/* Because 'Q' used to be quit... */
if (flags.suppress_alert < FEATURE_NOTICE_VER(3,3,0))
pline("Note: Please use #quit if you wish to exit the game.");
/* Prompt for a new quiver */
if (!(newquiver = getobj(quivee_types, "ready")))
/* Cancelled */
+14 -6
View File
@@ -1,4 +1,4 @@
/* NetHack 3.5 zap.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */
/* NetHack 3.5 zap.c $NHDT-Date: 1427249230 2015/03/25 02:07:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.197 $ */
/* NetHack 3.5 zap.c $Date: 2013/11/05 00:57:56 $ $Revision: 1.183 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */
@@ -1708,10 +1708,11 @@ struct obj *obj, *otmp;
* as a safeguard against any stray occurrence left in an obj
* struct someplace, although that should never happen.
*/
if (context.bypasses)
if (context.bypasses) {
return 0;
else {
debugpline("%s for a moment.", Tobjnam(obj, "pulsate"));
} else {
debugpline1("%s for a moment.",
Tobjnam(obj, "pulsate"));
obj->bypass = 0;
}
}
@@ -1749,8 +1750,14 @@ struct obj *obj, *otmp;
if (Is_box(obj)) (void) boxlock(obj, otmp);
if (obj_shudders(obj)) {
boolean cover = ((obj->ox == u.ux && obj->oy == u.uy) &&
u.uundetected &&
hides_under(youmonst.data));
if (cansee(obj->ox, obj->oy)) learn_it = TRUE;
do_osshock(obj);
/* eek - your cover might have been blown */
if (cover) (void) hideunder(&youmonst);
break;
}
obj = poly_obj(obj, STRANGE_OBJECT);
@@ -1798,7 +1805,7 @@ struct obj *obj, *otmp;
if (break_statue(obj)) {
if (cansee(obj->ox, obj->oy)) {
if (Hallucination)
pline_The("%s shatters.", rndmonnam());
pline_The("%s shatters.", rndmonnam(NULL));
else
pline_The("statue shatters.");
} else
@@ -3405,7 +3412,8 @@ struct obj **ootmp; /* to return worn armor for caller to disintegrate */
resist(mon, type < ZT_SPELL(0) ? WAND_CLASS : '\0', 0, NOTELL))
tmp /= 2;
if (tmp < 0) tmp = 0; /* don't allow negative damage */
debugpline("zapped monster hp = %d (= %d - %d)", mon->mhp-tmp,mon->mhp,tmp);
debugpline3("zapped monster hp = %d (= %d - %d)",
mon->mhp-tmp, mon->mhp, tmp);
mon->mhp -= tmp;
return(tmp);
}