Merge branch 'NetHack-3.6.0' of https://rodney.nethack.org:20040/git/NHsource into NetHack-3.6.0

This commit is contained in:
nhmall
2015-12-04 20:05:22 -05:00
11 changed files with 73 additions and 58 deletions

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 lint.h $NHDT-Date: 1430897871 2015/05/06 07:37:51 $ $NHDT-Branch: master $:$NHDT-Revision: 1.0 $ */ /* NetHack 3.6 lint.h $NHDT-Date: 1449269910 2015/12/04 22:58:30 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.3 $ */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
/* /*
@@ -36,19 +36,21 @@ extern unsigned nhUse_dummy;
#ifdef DEBUG #ifdef DEBUG
#define showdebug(file) debugcore(file, TRUE) #define showdebug(file) debugcore(file, TRUE)
#define explicitdebug(file) debugcore(file, FALSE) #define explicitdebug(file) debugcore(file, FALSE)
#define ifdebug(stmt) \ #define ifdebug(stmt) \
do { \ do { \
if (showdebug(__FILE__)) \ if (showdebug(__FILE__)) { \
stmt; \ stmt; \
} \
} while (0) } while (0)
#ifdef _MSC_VER #ifdef _MSC_VER
/* if we have microsoft's C runtime we can use these instead */ /* if we have microsoft's C runtime we can use these instead */
#include <crtdbg.h> #include <crtdbg.h>
#define crtdebug(stmt) \ #define crtdebug(stmt) \
do { \ do { \
if (showdebug(__FILE__)) \ if (showdebug(__FILE__)) { \
stmt; \ stmt; \
_RPT0(_CRT_WARN, "\n"); \ } \
_RPT0(_CRT_WARN, "\n"); \
} while (0) } while (0)
#define debugpline0(str) crtdebug(_RPT0(_CRT_WARN, str)) #define debugpline0(str) crtdebug(_RPT0(_CRT_WARN, str))
#define debugpline1(fmt, arg) crtdebug(_RPT1(_CRT_WARN, fmt, arg)) #define debugpline1(fmt, arg) crtdebug(_RPT1(_CRT_WARN, fmt, arg))

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 system.h $NHDT-Date: 1432512775 2015/05/25 00:12:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.11 $ */ /* NetHack 3.6 system.h $NHDT-Date: 1449269772 2015/12/04 22:56:12 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.12 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -514,8 +514,9 @@ E char *FDECL(tgetstr, (const char *, char **));
E char *FDECL(tgoto, (const char *, int, int)); E char *FDECL(tgoto, (const char *, int, int));
#endif #endif
#ifdef ALLOC_C #if defined(ALLOC_C) || defined(MAKEDEFS_C)
E genericptr_t FDECL(malloc, (size_t)); E genericptr_t FDECL(malloc, (size_t));
E genericptr_t FDECL(realloc, (genericptr_t, size_t));
#endif #endif
/* time functions */ /* time functions */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 attrib.c $NHDT-Date: 1446975460 2015/11/08 09:37:40 $ $NHDT-Branch: master $:$NHDT-Revision: 1.49 $ */ /* NetHack 3.6 attrib.c $NHDT-Date: 1449269911 2015/12/04 22:58:31 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.51 $ */
/* Copyright 1988, 1989, 1990, 1992, M. Stephenson */ /* Copyright 1988, 1989, 1990, 1992, M. Stephenson */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -470,8 +470,9 @@ exerchk()
/* Check out the periodic accumulations */ /* Check out the periodic accumulations */
exerper(); exerper();
if (moves >= context.next_attrib_check) if (moves >= context.next_attrib_check) {
debugpline1("exerchk: ready to test. multi = %d.", multi); debugpline1("exerchk: ready to test. multi = %d.", multi);
}
/* Are we ready for a test? */ /* Are we ready for a test? */
if (moves >= context.next_attrib_check && !multi) { if (moves >= context.next_attrib_check && !multi) {
debugpline0("exerchk: testing."); debugpline0("exerchk: testing.");
@@ -515,8 +516,9 @@ exerchk()
? "Dex" ? "Dex"
: (i == A_CON) : (i == A_CON)
? "Con" ? "Con"
: (i == A_CHA) ? "Cha?" : (i == A_CHA)
: "???", ? "Cha?"
: "???",
ax); ax);
/* /*
* Law of diminishing returns (Part III): * Law of diminishing returns (Part III):

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 bones.c $NHDT-Date: 1446369463 2015/11/01 09:17:43 $ $NHDT-Branch: master $:$NHDT-Revision: 1.65 $ */ /* NetHack 3.6 bones.c $NHDT-Date: 1449269914 2015/12/04 22:58:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.66 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985,1993. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -608,9 +608,10 @@ getbones()
if (has_mname(mtmp)) if (has_mname(mtmp))
sanitize_name(MNAME(mtmp)); sanitize_name(MNAME(mtmp));
if (mtmp->mhpmax == DEFUNCT_MONSTER) { if (mtmp->mhpmax == DEFUNCT_MONSTER) {
if (wizard) if (wizard) {
debugpline1("Removing defunct monster %s from bones.", debugpline1("Removing defunct monster %s from bones.",
mtmp->data->mname); mtmp->data->mname);
}
mongone(mtmp); mongone(mtmp);
} else } else
/* to correctly reset named artifacts on the level */ /* to correctly reset named artifacts on the level */

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dbridge.c $NHDT-Date: 1446955279 2015/11/08 04:01:19 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */ /* NetHack 3.6 dbridge.c $NHDT-Date: 1449269914 2015/12/04 22:58:34 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.35 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */ /* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -509,8 +509,9 @@ boolean chunks;
{ {
int misses; int misses;
if (chunks) if (chunks) {
debugpline0("Do chunks miss?"); debugpline0("Do chunks miss?");
}
if (automiss(etmp)) if (automiss(etmp))
return TRUE; return TRUE;
@@ -590,13 +591,14 @@ struct entity *etmp;
return; return;
} }
if (e_missed(etmp, FALSE)) { if (e_missed(etmp, FALSE)) {
if (at_portcullis) if (at_portcullis) {
pline_The("portcullis misses %s!", e_nam(etmp)); pline_The("portcullis misses %s!", e_nam(etmp));
else } else {
debugpline1("The drawbridge misses %s!", e_nam(etmp)); debugpline1("The drawbridge misses %s!", e_nam(etmp));
if (e_survives_at(etmp, oldx, oldy)) }
if (e_survives_at(etmp, oldx, oldy)) {
return; return;
else { } else {
debugpline0("Mon can't survive here"); debugpline0("Mon can't survive here");
if (at_portcullis) if (at_portcullis)
must_jump = TRUE; must_jump = TRUE;
@@ -978,10 +980,11 @@ int x, y;
pline("%s hit by a huge chunk of metal!", pline("%s hit by a huge chunk of metal!",
E_phrase(etmp1, "are")); E_phrase(etmp1, "are"));
} else { } else {
if (!Deaf && !is_u(etmp1) && !is_pool(x, y)) if (!Deaf && !is_u(etmp1) && !is_pool(x, y)) {
You_hear("a crushing sound."); You_hear("a crushing sound.");
else } else {
debugpline1("%s from shrapnel", E_phrase(etmp1, "die")); debugpline1("%s from shrapnel", E_phrase(etmp1, "die"));
}
} }
killer.format = KILLED_BY_AN; killer.format = KILLED_BY_AN;
Strcpy(killer.name, "collapsing drawbridge"); Strcpy(killer.name, "collapsing drawbridge");

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 dig.c $NHDT-Date: 1446369465 2015/11/01 09:17:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.99 $ */ /* NetHack 3.6 dig.c $NHDT-Date: 1449269915 2015/12/04 22:58:35 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.103 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1864,8 +1864,9 @@ int x, y;
{ {
struct obj *otmp, *otmp2; struct obj *otmp, *otmp2;
if (level.objects[x][y] != (struct obj *) 0) if (level.objects[x][y] != (struct obj *) 0) {
debugpline2("bury_objs: at <%d,%d>", x, y); debugpline2("bury_objs: at <%d,%d>", x, y);
}
for (otmp = level.objects[x][y]; otmp; otmp = otmp2) for (otmp = level.objects[x][y]; otmp; otmp = otmp2)
otmp2 = bury_an_obj(otmp, (boolean *) 0); otmp2 = bury_an_obj(otmp, (boolean *) 0);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 eat.c $NHDT-Date: 1446854226 2015/11/06 23:57:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.152 $ */ /* NetHack 3.6 eat.c $NHDT-Date: 1449269916 2015/12/04 22:58:36 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.154 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -728,56 +728,57 @@ register struct permonst *ptr;
{ {
int res = 0; int res = 0;
#ifdef DEBUG
#define ifdebugresist(Msg) \
do { \
if (res) \
debugpline0(Msg); \
} while (0)
#else
#define ifdebugresist(Msg) /*empty*/
#endif
switch (type) { switch (type) {
case FIRE_RES: case FIRE_RES:
res = (ptr->mconveys & MR_FIRE) != 0; res = (ptr->mconveys & MR_FIRE) != 0;
if (res) ifdebugresist("can get fire resistance");
debugpline0("can get fire resistance");
break; break;
case SLEEP_RES: case SLEEP_RES:
res = (ptr->mconveys & MR_SLEEP) != 0; res = (ptr->mconveys & MR_SLEEP) != 0;
if (res) ifdebugresist("can get sleep resistance");
debugpline0("can get sleep resistance");
break; break;
case COLD_RES: case COLD_RES:
res = (ptr->mconveys & MR_COLD) != 0; res = (ptr->mconveys & MR_COLD) != 0;
if (res) ifdebugresist("can get cold resistance");
debugpline0("can get cold resistance");
break; break;
case DISINT_RES: case DISINT_RES:
res = (ptr->mconveys & MR_DISINT) != 0; res = (ptr->mconveys & MR_DISINT) != 0;
if (res) ifdebugresist("can get disintegration resistance");
debugpline0("can get disintegration resistance");
break; break;
case SHOCK_RES: /* shock (electricity) resistance */ case SHOCK_RES: /* shock (electricity) resistance */
res = (ptr->mconveys & MR_ELEC) != 0; res = (ptr->mconveys & MR_ELEC) != 0;
if (res) ifdebugresist("can get shock resistance");
debugpline0("can get shock resistance");
break; break;
case POISON_RES: case POISON_RES:
res = (ptr->mconveys & MR_POISON) != 0; res = (ptr->mconveys & MR_POISON) != 0;
if (res) ifdebugresist("can get poison resistance");
debugpline0("can get poison resistance");
break; break;
case TELEPORT: case TELEPORT:
res = can_teleport(ptr); res = can_teleport(ptr);
if (res) ifdebugresist("can get teleport");
debugpline0("can get teleport");
break; break;
case TELEPORT_CONTROL: case TELEPORT_CONTROL:
res = control_teleport(ptr); res = control_teleport(ptr);
if (res) ifdebugresist("can get teleport control");
debugpline0("can get teleport control");
break; break;
case TELEPAT: case TELEPAT:
res = telepathic(ptr); res = telepathic(ptr);
if (res) ifdebugresist("can get telepathy");
debugpline0("can get telepathy");
break; break;
default: default:
/* res stays 0 */ /* res stays 0 */
break; break;
} }
#undef ifdebugresist
return res; return res;
} }

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 makemon.c $NHDT-Date: 1449052582 2015/12/02 10:36:22 $ $NHDT-Branch: master $:$NHDT-Revision: 1.104 $ */ /* NetHack 3.6 makemon.c $NHDT-Date: 1449269917 2015/12/04 22:58:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.105 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -857,9 +857,10 @@ boolean ghostly;
mvitals[mndx].born++; mvitals[mndx].born++;
if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN) if ((int) mvitals[mndx].born >= lim && !(mons[mndx].geno & G_NOGEN)
&& !(mvitals[mndx].mvflags & G_EXTINCT)) { && !(mvitals[mndx].mvflags & G_EXTINCT)) {
if (wizard) if (wizard) {
debugpline1("Automatically extinguished %s.", debugpline1("Automatically extinguished %s.",
makeplural(mons[mndx].mname)); makeplural(mons[mndx].mname));
}
mvitals[mndx].mvflags |= G_EXTINCT; mvitals[mndx].mvflags |= G_EXTINCT;
reset_rndmonst(mndx); reset_rndmonst(mndx);
} }
@@ -1072,9 +1073,10 @@ int mmflags;
already been genocided, return */ already been genocided, return */
if (mvitals[mndx].mvflags & G_GENOD) if (mvitals[mndx].mvflags & G_GENOD)
return (struct monst *) 0; return (struct monst *) 0;
if (wizard && (mvitals[mndx].mvflags & G_EXTINCT)) if (wizard && (mvitals[mndx].mvflags & G_EXTINCT)) {
debugpline1("Explicitly creating extinct monster %s.", debugpline1("Explicitly creating extinct monster %s.",
mons[mndx].mname); mons[mndx].mname);
}
} else { } else {
/* make a random (common) monster that can survive here. /* make a random (common) monster that can survive here.
* (the special levels ask for random monsters at specific * (the special levels ask for random monsters at specific

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mkmaze.c $NHDT-Date: 1448013594 2015/11/20 09:59:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.41 $ */ /* NetHack 3.6 mkmaze.c $NHDT-Date: 1449269918 2015/12/04 22:58:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.42 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -616,9 +616,10 @@ register const char *s;
y_range = y_maze_max - y_maze_min - 2 * INVPOS_Y_MARGIN - 1; y_range = y_maze_max - y_maze_min - 2 * INVPOS_Y_MARGIN - 1;
if (x_range <= INVPOS_X_MARGIN || y_range <= INVPOS_Y_MARGIN if (x_range <= INVPOS_X_MARGIN || y_range <= INVPOS_Y_MARGIN
|| (x_range * y_range) <= (INVPOS_DISTANCE * INVPOS_DISTANCE)) || (x_range * y_range) <= (INVPOS_DISTANCE * INVPOS_DISTANCE)) {
debugpline2("inv_pos: maze is too small! (%d x %d)", x_maze_max, debugpline2("inv_pos: maze is too small! (%d x %d)",
y_maze_max); x_maze_max, y_maze_max);
}
inv_pos.x = inv_pos.y = 0; /*{occupied() => invocation_pos()}*/ inv_pos.x = inv_pos.y = 0; /*{occupied() => invocation_pos()}*/
do { do {
x = rn1(x_range, x_maze_min + INVPOS_X_MARGIN + 1); x = rn1(x_range, x_maze_min + INVPOS_X_MARGIN + 1);

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 mon.c $NHDT-Date: 1447475944 2015/11/14 04:39:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.196 $ */ /* NetHack 3.6 mon.c $NHDT-Date: 1449269918 2015/12/04 22:58:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.199 $ */
/* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1470,7 +1470,7 @@ struct monst *mtmp, *mtmp2;
/* transfer the monster's inventory */ /* transfer the monster's inventory */
for (otmp = mtmp2->minvent; otmp; otmp = otmp->nobj) { for (otmp = mtmp2->minvent; otmp; otmp = otmp->nobj) {
if (otmp->where != OBJ_MINVENT || otmp->ocarry != mtmp) if (otmp->where != OBJ_MINVENT || otmp->ocarry != mtmp)
debugpline0("replmon: minvent inconsistency"); impossible("replmon: minvent inconsistency");
otmp->ocarry = mtmp2; otmp->ocarry = mtmp2;
} }
mtmp->minvent = 0; mtmp->minvent = 0;

View File

@@ -1,4 +1,4 @@
/* NetHack 3.6 sp_lev.c $NHDT-Date: 1449051497 2015/12/02 10:18:17 $ $NHDT-Branch: master $:$NHDT-Revision: 1.76 $ */ /* NetHack 3.6 sp_lev.c $NHDT-Date: 1449269920 2015/12/04 22:58:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.77 $ */
/* Copyright (c) 1989 by Jean-Christophe Collet */ /* Copyright (c) 1989 by Jean-Christophe Collet */
/* NetHack may be freely redistributed. See license for details. */ /* NetHack may be freely redistributed. See license for details. */
@@ -1033,8 +1033,9 @@ chk:
lev = &levl[x][y]; lev = &levl[x][y];
for (; y <= ymax; y++) { for (; y <= ymax; y++) {
if (lev++->typ) { if (lev++->typ) {
if (!vault) if (!vault) {
debugpline2("strange area [%d,%d] in check_room.", x, y); debugpline2("strange area [%d,%d] in check_room.", x, y);
}
if (!rn2(3)) if (!rn2(3))
return FALSE; return FALSE;
if (x < *lowx) if (x < *lowx)