From f8aced5480b42527d2e6bed7586501ae31b6ab0e Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 12 Mar 2015 21:35:04 +0200 Subject: [PATCH 01/49] Add Extended Logfile --- doc/fixes35.0 | 1 + include/config.h | 1 + include/decl.h | 4 ++ include/dungeon.h | 2 + include/extern.h | 1 + include/obj.h | 1 + include/you.h | 22 +++++++++ src/allmain.c | 7 +++ src/do.c | 1 + src/dungeon.c | 2 + src/end.c | 1 + src/invent.c | 13 +++++ src/mon.c | 2 + src/pray.c | 1 + src/restore.c | 6 +++ src/save.c | 1 + src/sp_lev.c | 12 +++++ src/topten.c | 107 ++++++++++++++++++++++++++++++++++++++++++ sys/unix/Makefile.top | 8 ++-- 19 files changed, 189 insertions(+), 4 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 4ad731e36..10b4a8f68 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -1120,6 +1120,7 @@ adopt/adapt/improve the Paranoid_Quit patch; default is paranoid_confirm:pray paranoid_confirm:pray y to confirm #pray; supersedes prayconfirm paranoid_confirm:Remove always pick from inventory for 'R' and 'T' adopt/adapt/improve Dungeon Overview +Aardvark Joe's Extended Logfile Code Cleanup and Reorganization diff --git a/include/config.h b/include/config.h index 930bd549c..d8c96af14 100644 --- a/include/config.h +++ b/include/config.h @@ -187,6 +187,7 @@ #endif #define LOGFILE "logfile" /* larger file for debugging purposes */ +#define XLOGFILE "xlogfile" /* even larger logfile */ #define NEWS "news" /* the file containing the latest hack news */ #define PANICLOG "paniclog" /* log of panic and impossible events */ diff --git a/include/decl.h b/include/decl.h index 4591226e4..2071277dc 100644 --- a/include/decl.h +++ b/include/decl.h @@ -67,6 +67,8 @@ E struct dgn_topology { /* special dungeon levels for speed */ xchar d_mines_dnum, d_quest_dnum; d_level d_qstart_level, d_qlocate_level, d_nemesis_level; d_level d_knox_level; + d_level d_mineend_level; + d_level d_sokoend_level; } dungeon_topology; /* macros for accesing the dungeon levels by their old names */ #define oracle_level (dungeon_topology.d_oracle_level) @@ -97,6 +99,8 @@ E struct dgn_topology { /* special dungeon levels for speed */ #define qlocate_level (dungeon_topology.d_qlocate_level) #define nemesis_level (dungeon_topology.d_nemesis_level) #define knox_level (dungeon_topology.d_knox_level) +#define mineend_level (dungeon_topology.d_mineend_level) +#define sokoend_level (dungeon_topology.d_sokoend_level) E NEARDATA stairway dnstair, upstair; /* stairs up and down */ #define xdnstair (dnstair.sx) diff --git a/include/dungeon.h b/include/dungeon.h index f2bf75ef6..3607649b0 100644 --- a/include/dungeon.h +++ b/include/dungeon.h @@ -122,6 +122,8 @@ typedef struct branch { #define Is_qlocate(x) (on_level(x, &qlocate_level)) #define Is_nemesis(x) (on_level(x, &nemesis_level)) #define Is_knox(x) (on_level(x, &knox_level)) +#define Is_mineend_level(x) (on_level(x, &mineend_level)) +#define Is_sokoend_level(x) (on_level(x, &sokoend_level)) #define In_sokoban(x) ((x)->dnum == sokoban_dnum) #define Inhell In_hell(&u.uz) /* now gehennom */ diff --git a/include/extern.h b/include/extern.h index f382c4f7a..7e222778f 100644 --- a/include/extern.h +++ b/include/extern.h @@ -26,6 +26,7 @@ E void NDECL(stop_occupation); E void NDECL(display_gamewindows); E void NDECL(newgame); E void FDECL(welcome, (BOOLEAN_P)); +E time_t NDECL(get_realtime); /* ### apply.c ### */ diff --git a/include/obj.h b/include/obj.h index fe43d0878..f4fd78007 100644 --- a/include/obj.h +++ b/include/obj.h @@ -109,6 +109,7 @@ struct obj { #define leashmon corpsenm /* gets m_id of attached pet */ #define spestudied corpsenm /* # of times a spellbook has been studied */ #define fromsink corpsenm /* a potion from a sink */ +#define record_achieve_special corpsenm unsigned oeaten; /* nutrition left in food, if partly eaten */ long age; /* creation date */ long owornmask; diff --git a/include/you.h b/include/you.h index 0c343b3c4..81aba0ba4 100644 --- a/include/you.h +++ b/include/you.h @@ -53,6 +53,26 @@ struct u_event { Bitfield(ascended,1); /* has offered the Amulet */ }; +struct u_achieve { + Bitfield(amulet,1); /* touched Amulet */ + Bitfield(bell,1); /* touched Bell */ + Bitfield(book,1); /* touched Book */ + Bitfield(menorah,1); /* touched Candelabrum */ + Bitfield(enter_gehennom,1); /* entered Gehennom (or Valley) by any means */ + Bitfield(ascended,1); /* not quite the same as u.uevent.ascended */ + Bitfield(mines_luckstone,1); /* got a luckstone at end of mines */ + Bitfield(finish_sokoban,1); /* obtained the sokoban prize */ + + Bitfield(killed_medusa,1); +}; + +struct u_realtime { + time_t realtime; /* actual playing time up until the last restore */ + time_t restored; /* time the game was started or restored */ + time_t endtime; +}; + + /* KMH, conduct -- * These are voluntary challenges. Each field denotes the number of * times a challenge has been violated. @@ -306,6 +326,8 @@ struct you { /* 1 free bit! */ unsigned udg_cnt; /* how long you have been demigod */ + struct u_achieve uachieve; /* achievements */ + struct u_realtime urealtime; struct u_event uevent; /* certain events have happened */ struct u_have uhave; /* you're carrying special objects */ struct u_conduct uconduct; /* KMH, conduct */ diff --git a/src/allmain.c b/src/allmain.c index 2bb1c4240..eb1f2b69b 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -533,6 +533,13 @@ newgame() #endif program_state.something_worth_saving++; /* useful data now exists */ + u.urealtime.realtime = (time_t)0L; +#if defined(BSD) && !defined(POSIX_TYPES) + (void) time((long *)&u.urealtime.restored); +#else + (void) time(&u.urealtime.restored); +#endif + /* Success! */ welcome(TRUE); return; diff --git a/src/do.c b/src/do.c index 3069a4047..44b2a23bb 100644 --- a/src/do.c +++ b/src/do.c @@ -1316,6 +1316,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; diff --git a/src/dungeon.c b/src/dungeon.c index 4c8e6beeb..fd253750f 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -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 }, diff --git a/src/end.c b/src/end.c index 995ef8ec7..111fd1b3a 100644 --- a/src/end.c +++ b/src/end.c @@ -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(); + u.urealtime.realtime += (endtime - u.urealtime.restored); /* Sometimes you die on the first move. Life's not fair. * On those rare occasions you get hosed immediately, go out diff --git a/src/invent.c b/src/invent.c index 62295915c..24213c7e3 100644 --- a/src/invent.c +++ b/src/invent.c @@ -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; + } } /* diff --git a/src/mon.c b/src/mon.c index 49f6282dc..b848e7586 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1604,6 +1604,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); diff --git a/src/pray.c b/src/pray.c index d2b24c00a..ffdee9b49 100644 --- a/src/pray.c +++ b/src/pray.c @@ -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); diff --git a/src/restore.c b/src/restore.c index af974d147..f7707f5ed 100644 --- a/src/restore.c +++ b/src/restore.c @@ -554,6 +554,12 @@ unsigned int *stuckid, *steedid; mread(fd, (genericptr_t) timebuf, 14); timebuf[14] = '\0'; ubirthday = time_from_yyyymmddhhmmss(timebuf); +#if defined(BSD) && !defined(POSIX_TYPES) + (void) time((long *)&u.urealtime.restored); +#else + (void) time(&u.urealtime.restored); +#endif + set_uasmon(); #ifdef CLIPPING diff --git a/src/save.c b/src/save.c index b220f945d..1c9dea6e6 100644 --- a/src/save.c +++ b/src/save.c @@ -307,6 +307,7 @@ register int fd, mode; #ifdef SYSFLAGS bwrite(fd, (genericptr_t) &sysflags, sizeof(struct sysflag)); #endif + u.urealtime.realtime += (getnow() - u.urealtime.restored); bwrite(fd, (genericptr_t) &u, sizeof(struct you)); bwrite(fd, yyyymmddhhmmss(ubirthday), 14); save_killers(fd, mode); diff --git a/src/sp_lev.c b/src/sp_lev.c index 6be2c9713..623504855 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -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) */ diff --git a/src/topten.c b/src/topten.c index db2e6fccb..cc4aefbe1 100644 --- a/src/topten.c +++ b/src/topten.c @@ -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 FDECL(encodeconduct, (void)); +STATIC_DCL long FDECL(encodeachieve, (void)); 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,95 @@ struct toptenentry *tt; #endif } +#define XLOG_SEP "\t" /* xlogfile field separator. */ +/* 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; +{ + char buf[DTHSZ+1]; + (void)fprintf(rfile, + "version=%d.%d.%d" + XLOG_SEP "points=%ld" + XLOG_SEP "deathdnum=%d" + XLOG_SEP "deathlev=%d" + XLOG_SEP "maxlvl=%d" + XLOG_SEP "hp=%d" + XLOG_SEP "maxhp=%d" + XLOG_SEP "deaths=%d" + XLOG_SEP "deathdate=%d" + XLOG_SEP "birthdate=%d" + XLOG_SEP "uid=%d", + tt->ver_major, tt->ver_minor, tt->patchlevel, + tt->points, tt->deathdnum, tt->deathlev, + tt->maxlvl, tt->hp, tt->maxhp, tt->deaths, + tt->deathdate, tt->birthdate, tt->uid); + (void)fprintf(rfile, + XLOG_SEP "role=%s" + XLOG_SEP "race=%s" + XLOG_SEP "gender=%s" + XLOG_SEP "align=%s", + tt->plrole, tt->plrace, tt->plgend, tt->plalign); + (void)fprintf(rfile, XLOG_SEP "name=%s", plname); + (void)fprintf(rfile, XLOG_SEP "death=%s", tt->death); + (void)fprintf(rfile, XLOG_SEP "conduct=0x%lx", encodeconduct()); + (void)fprintf(rfile, XLOG_SEP "turns=%ld", moves); + (void)fprintf(rfile, XLOG_SEP "achieve=0x%lx", encodeachieve()); + (void)fprintf(rfile, XLOG_SEP "realtime=%ld", (long)u.urealtime.realtime); + (void)fprintf(rfile, XLOG_SEP "starttime=%ld", (long)ubirthday); + (void)fprintf(rfile, XLOG_SEP "endtime=%ld", (long)u.urealtime.endtime); + (void)fprintf(rfile, XLOG_SEP "gender0=%s", genders[flags.initgend].filecode); + (void)fprintf(rfile, XLOG_SEP "align0=%s", + aligns[1 - u.ualignbase[A_ORIGINAL]].filecode); + fprintf(rfile, "\n"); +} +#undef XLOG_SEP + +long +encodeconduct(void) +{ + 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; +} + +long +encodeachieve(void) +{ + 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 +414,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 +475,7 @@ time_t when; t0->birthdate = yyyymmdd(ubirthday); t0->deathdate = yyyymmdd(when); t0->tt_next = 0; + u.urealtime.endtime = when; #ifdef UPDATE_RECORD_IN_PLACE t0->fpos = -1L; #endif @@ -395,6 +491,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 { diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index 6d94d6908..f9e474a5b 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -264,10 +264,10 @@ install: rootcheck $(GAME) recover $(VARDAT) dungeon spec_levs # set up the game files ( $(MAKE) dofiles ) # set up some additional files - touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile - -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile ; \ - $(CHGRP) $(GAMEGRP) perm record logfile ; \ - chmod $(VARFILEPERM) perm record logfile ) + touch $(VARDIR)/perm $(VARDIR)/record $(VARDIR)/logfile $(VARDIR)/xlogfile + -( cd $(VARDIR) ; $(CHOWN) $(GAMEUID) perm record logfile xlogfile ; \ + $(CHGRP) $(GAMEGRP) perm record logfile xlogfile ; \ + chmod $(VARFILEPERM) perm record logfile xlogfile ) true; $(POSTINSTALL) # and a reminder @echo You may also want to reinstall the man pages via the doc Makefile. From 14525ed0c67ad95993113c56fb3e821539f04c5a Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 15 Mar 2015 18:02:26 -0700 Subject: [PATCH 02/49] DEBUG/debugpline() fixup * Replace variadic debugpline() with fixed argument debugpline0(str), debugpline1(fmt,arg), and so on so that C99 support isn't required; * showdebug() becomes a function rather than a macro and handles a bit more; * two debugpline() calls in light.c have been changed to impossible(); * DEBUGFILES macro (in sys.c) can substitute for SYSCF's DEBUGFILES setting in !SYSCF configuration (I hope that's temporary). --- include/extern.h | 5 ++- include/hack.h | 40 +++++++++-------------- src/apply.c | 4 +-- src/attrib.c | 25 +++++++------- src/bones.c | 4 +-- src/dbridge.c | 51 +++++++++++++++-------------- src/dig.c | 18 +++++------ src/dungeon.c | 4 +-- src/eat.c | 84 +++++++++++++++++++++++++----------------------- src/files.c | 53 +++++++++++++++++++++++++++++- src/light.c | 6 ++-- src/makemon.c | 17 +++++----- src/mklev.c | 6 ++-- src/mkmaze.c | 6 ++-- src/mkobj.c | 15 +++++---- src/mon.c | 4 +-- src/pickup.c | 4 +-- src/questpgr.c | 4 +-- src/restore.c | 4 +-- src/rnd.c | 10 +++--- src/save.c | 4 +-- src/shk.c | 4 +-- src/sp_lev.c | 12 +++---- src/sys.c | 20 ++++++++---- src/teleport.c | 4 +-- src/zap.c | 12 ++++--- win/tty/wintty.c | 4 +-- 27 files changed, 243 insertions(+), 181 deletions(-) diff --git a/include/extern.h b/include/extern.h index 0a1dabe77..cd8843762 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 extern.h $NHDT-Date: 1425081976 2015/02/28 00:06:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.390 $ */ +/* NetHack 3.5 extern.h $NHDT-Date: 1426465429 2015/03/16 00:23:49 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.406 $ */ /* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -741,6 +741,9 @@ E boolean NDECL(recover_savefile); #ifdef HOLD_LOCKFILE_OPEN E void NDECL(really_close); #endif +#ifdef DEBUG +E boolean FDECL(showdebug, (const char *)); +#endif /* ### fountain.c ### */ diff --git a/include/hack.h b/include/hack.h index 7c6af5b18..c85f95d8d 100644 --- a/include/hack.h +++ b/include/hack.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 hack.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 hack.h $NHDT-Date: 1426465431 2015/03/16 00:23:51 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.52 $ */ /* NetHack 3.5 hack.h $Date: 2009/05/06 10:44:46 $ $Revision: 1.49 $ */ /* SCCS Id: @(#)hack.h 3.5 2008/03/19 */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ @@ -11,32 +11,22 @@ #include "config.h" #endif +/* [DEBUG shouldn't be defined unless you know what you're doing...] */ #ifdef DEBUG -/* due to strstr(), mon.c matches makemon.c */ -# define showdebug() (sysopt.debugfiles && \ - ((sysopt.debugfiles[0] == '*') || \ - (strstr( __FILE__ , sysopt.debugfiles)))) - -/* GCC understands this syntax */ -# ifdef __GNUC__ -/* ... but whines about it anyway without these pragmas. */ -# pragma GCC diagnostic push -# pragma GCC diagnostic ignored "-Wvariadic-macros" -# define debugpline(args...) \ - do { if (showdebug()) pline( args ); } while(0); -# pragma GCC diagnostic pop -# endif - -/* and Visual Studio understands this one */ -# ifdef _MSC_VER -# define debugpline(...) \ - do { if (showdebug()) pline(__VA_ARGS__); } while(0); -# endif - +# define ifdebug(stmt) do { if (showdebug(__FILE__)) stmt; } while (0) +/* these don't require compiler support for C99 variadic macros */ +# define debugpline0(str) ifdebug(pline(str)) +# define debugpline1(fmt,arg) ifdebug(pline(fmt,arg)) +# define debugpline2(fmt,a1,a2) ifdebug(pline(fmt,a1,a2)) +# define debugpline3(fmt,a1,a2,a3) ifdebug(pline(fmt,a1,a2,a3)) +# define debugpline4(fmt,a1,a2,a3,a4) ifdebug(pline(fmt,a1,a2,a3,a4)) #else -# define showdebug() (0) -# define debugpline(...) -#endif +# define debugpline0(str) /*empty*/ +# define debugpline1(fmt,arg) /*empty*/ +# define debugpline2(fmt,a1,a2) /*empty*/ +# define debugpline3(fmt,a1,a2,a3) /*empty*/ +# define debugpline4(fmt,a1,a2,a3,a4) /*empty*/ +#endif /*DEBUG*/ #define TELL 1 #define NOTELL 0 diff --git a/src/apply.c b/src/apply.c index 2ac4088dd..fd3193fb3 100644 --- a/src/apply.c +++ b/src/apply.c @@ -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 */ diff --git a/src/attrib.c b/src/attrib.c index 8bba3d61c..b9ce67596 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -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); } } diff --git a/src/bones.c b/src/bones.c index 269152578..9024354a2 100644 --- a/src/bones.c +++ b/src/bones.c @@ -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 diff --git a/src/dbridge.c b/src/dbridge.c index a82805377..8c4b90031 100644 --- a/src/dbridge.c +++ b/src/dbridge.c @@ -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; diff --git a/src/dig.c b/src/dig.c index 1c053ec73..fa25f76a0 100644 --- a/src/dig.c +++ b/src/dig.c @@ -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)); diff --git a/src/dungeon.c b/src/dungeon.c index 4c8e6beeb..ed87652f1 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -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, diff --git a/src/eat.c b/src/eat.c index 793925fb7..983f6bcec 100644 --- a/src/eat.c +++ b/src/eat.c @@ -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; } } @@ -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) { diff --git a/src/files.c b/src/files.c index d4c216276..9e9cea746 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 files.c $NHDT-Date: 1425081976 2015/02/28 00:06:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.127 $ */ +/* NetHack 3.5 files.c $NHDT-Date: 1426465435 2015/03/16 00:23:55 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.133 $ */ /* 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. */ @@ -3195,4 +3195,55 @@ int ifd, ofd; /* ---------- END INTERNAL RECOVER ----------- */ #endif /*SELF_RECOVER*/ +#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 */ + + 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*/ diff --git a/src/light.c b/src/light.c index f7d43eeee..52efe9759 100644 --- a/src/light.c +++ b/src/light.c @@ -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)); diff --git a/src/makemon.c b/src/makemon.c index afaa0140a..6ce548ea0 100644 --- a/src/makemon.c +++ b/src/makemon.c @@ -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; } diff --git a/src/mklev.c b/src/mklev.c index 2d4899984..4412d68aa 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -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); } diff --git a/src/mkmaze.c b/src/mkmaze.c index 0cfdbe35a..87a3a870b 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -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; diff --git a/src/mkobj.c b/src/mkobj.c index ddfa363d4..4092401cd 100644 --- a/src/mkobj.c +++ b/src/mkobj.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 mkobj.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 mkobj.c $NHDT-Date: 1426465437 2015/03/16 00:23:57 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.77 $ */ /* NetHack 3.5 mkobj.c $Date: 2012/03/10 02:49:08 $ $Revision: 1.70 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1521,10 +1521,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; } @@ -1553,7 +1552,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; @@ -1579,7 +1579,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; diff --git a/src/mon.c b/src/mon.c index 49f6282dc..fb0a75a57 100644 --- a/src/mon.c +++ b/src/mon.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 mon.c $NHDT-Date: 1425319883 2015/03/02 18:11:23 $ $NHDT-Branch: master $:$NHDT-Revision: 1.137 $ */ +/* NetHack 3.5 mon.c $NHDT-Date: 1426465438 2015/03/16 00:23:58 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.139 $ */ /* NetHack 3.5 mon.c $Date: 2012/05/16 02:15:10 $ $Revision: 1.126 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1260,7 +1260,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; diff --git a/src/pickup.c b/src/pickup.c index 0b6abf06d..7b3096c59 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -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: 1426465438 2015/03/16 00:23:58 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.130 $ */ /* 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. */ @@ -897,7 +897,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; } diff --git a/src/questpgr.c b/src/questpgr.c index 7f51965f7..62e1ae4e4 100644 --- a/src/questpgr.c +++ b/src/questpgr.c @@ -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", diff --git a/src/restore.c b/src/restore.c index af974d147..24a0f777c 100644 --- a/src/restore.c +++ b/src/restore.c @@ -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. */ @@ -1153,7 +1153,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. */ diff --git a/src/rnd.c b/src/rnd.c index 662d1a275..fc7147d50 100644 --- a/src/rnd.c +++ b/src/rnd.c @@ -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 diff --git a/src/save.c b/src/save.c index b220f945d..165c792db 100644 --- a/src/save.c +++ b/src/save.c @@ -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: 1426465440 2015/03/16 00:24:00 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.61 $ */ /* 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. */ @@ -1210,7 +1210,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 */ } diff --git a/src/shk.c b/src/shk.c index 12f22eb40..ffc827482 100644 --- a/src/shk.c +++ b/src/shk.c @@ -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: diff --git a/src/sp_lev.c b/src/sp_lev.c index 6be2c9713..41a747da9 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -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; @@ -1311,8 +1311,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; diff --git a/src/sys.c b/src/sys.c index 14e0aa642..0392d6554 100644 --- a/src/sys.c +++ b/src/sys.c @@ -1,26 +1,34 @@ -/* NetHack 3.5 sys.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 sys.c $NHDT-Date: 1426465442 2015/03/16 00:24:02 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.16 $ */ /* 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 "*" */ +#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.shellers = NULL; sysopt.maxplayers = 0; /* XXX eventually replace MAX_NR_OF_PLAYERS */ diff --git a/src/teleport.c b/src/teleport.c index cd179c1f1..bf5e323a7 100644 --- a/src/teleport.c +++ b/src/teleport.c @@ -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]; } diff --git a/src/zap.c b/src/zap.c index 38b883115..5f39fc30e 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 zap.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 zap.c $NHDT-Date: 1426465444 2015/03/16 00:24:04 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.195 $ */ /* 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; } } @@ -3405,7 +3406,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); } diff --git a/win/tty/wintty.c b/win/tty/wintty.c index a201218e7..553553744 100644 --- a/win/tty/wintty.c +++ b/win/tty/wintty.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 wintty.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 wintty.c $NHDT-Date: 1426465444 2015/03/16 00:24:04 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.71 $ */ /* NetHack 3.5 wintty.c $Date: 2012/01/22 06:27:09 $ $Revision: 1.66 $ */ /* Copyright (c) David Cohrs, 1991 */ /* NetHack may be freely redistributed. See license for details. */ @@ -1934,7 +1934,7 @@ register int x, y; /* not xchar: perhaps xchar is unsigned and case NHW_TEXT: s = "[text window]"; break; case NHW_BASE: s = "[base window]"; break; } - debugpline("bad curs positioning win %d %s (%d,%d)", window, s, x, y); + debugpline4("bad curs positioning win %d %s (%d,%d)", window, s, x, y); return; } #endif From a983a58b6af0aab41ce9d0af4d2287206f1dad48 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 16 Mar 2015 02:03:40 -0700 Subject: [PATCH 03/49] free 'sysopt' strings upon termination --- include/extern.h | 4 +++- include/sys.h | 9 +++------ src/save.c | 3 ++- src/sys.c | 20 +++++++++++++++++++- 4 files changed, 27 insertions(+), 9 deletions(-) diff --git a/include/extern.h b/include/extern.h index cd8843762..d901d3641 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 extern.h $NHDT-Date: 1426465429 2015/03/16 00:23:49 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.406 $ */ +/* NetHack 3.5 extern.h $NHDT-Date: 1426496453 2015/03/16 09:00:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.407 $ */ /* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2065,6 +2065,8 @@ E void FDECL(play_sound_for_message, (const char *)); /* ### sys.c ### */ +E void NDECL(sys_early_init); +E void NDECL(sysopt_release); E void FDECL(sysopt_seduce_set,(int)); /* ### sys/msdos/sound.c ### */ diff --git a/include/sys.h b/include/sys.h index 8358021a2..940e95a11 100644 --- a/include/sys.h +++ b/include/sys.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 sys.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 sys.h $NHDT-Date: 1426496454 2015/03/16 09:00:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ /* NetHack 3.5 sys.h $Date: 2012/01/27 20:15:26 $ $Revision: 1.9 $ */ /* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -6,10 +6,6 @@ #ifndef SYS_H #define SYS_H -#define E extern - -E void NDECL(sys_early_init); - struct sysopt { char *support; /* local support contact */ char *recover; /* how to run recover - may be overridden by win port */ @@ -34,7 +30,8 @@ struct sysopt { #endif int seduce; }; -E struct sysopt sysopt; + +extern struct sysopt sysopt; #define SYSOPT_SEDUCE sysopt.seduce diff --git a/src/save.c b/src/save.c index 165c792db..802d560a9 100644 --- a/src/save.c +++ b/src/save.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 save.c $NHDT-Date: 1426465440 2015/03/16 00:24:00 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.61 $ */ +/* 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. */ @@ -1350,6 +1350,7 @@ freedynamicdata() #ifdef STATUS_VIA_WINDOWPORT status_finish(); #endif + sysopt_release(); /* SYSCF strings */ return; } diff --git a/src/sys.c b/src/sys.c index 0392d6554..52489135e 100644 --- a/src/sys.c +++ b/src/sys.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 sys.c $NHDT-Date: 1426465442 2015/03/16 00:24:02 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.16 $ */ +/* NetHack 3.5 sys.c $NHDT-Date: 1426496455 2015/03/16 09:00:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ */ /* 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. */ @@ -67,6 +67,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]; From 0d0711fe178cc82174fef221c1280933d9bd97f0 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 16 Mar 2015 02:29:10 -0700 Subject: [PATCH 04/49] fix #H3724 - gold pile stacking bug Bug report included a pointer to a fix; this patch is a superset. Gold pieces dropped on an altar by the player got their bknown flag set, which is incorrect since bless/curse doesn't apply to coins. If a monster (in reported case, a slain temple priest) dropped gold there too then the two stacks wouldn't merge. For the normal !GOLDOBJ config, the problem goes away as soon as the gold gets picked up. I didn't test for GOLDOBJ but think two inventory slots containing gold can result. The superset part is to not break agnostic conduct by dropping gold on an altar since no information is revealed when doing that. [This was one of the very last patches checked into the old cvs repository, where the somewhat out of date message above was accidentally omitted.] --- doc/fixes35.0 | 1 + src/do.c | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index ad8117820..250b09d85 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -855,6 +855,7 @@ fix "object lost" panic (or even crash) when dropping multiple items while levitating and a lit potion of oil explodes and destroys some inventory fix "object_is_local" panic when saving bones after hero is killed by explosion produced by dropped or thrown lit potion of oil +gold dropped on altar by hero wouldn't stack with gold dropped there by monster if lava burns up the player's water walking boots, the player falls in the messages for lava burning items up are always printed fix used-up magic trap trying to hit steed. diff --git a/src/do.c b/src/do.c index 3069a4047..41e25a1b0 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 do.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 do.c $NHDT-Date: 1426497723 2015/03/16 09:22:03 $ $NHDT-Branch: H3724 $:$NHDT-Revision: 1.109 $ */ /* 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. */ @@ -222,10 +222,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")); @@ -233,7 +238,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; } } From c24dcf76b2efb51a00aa5d3d53383bb6cf1bfdc7 Mon Sep 17 00:00:00 2001 From: nhmall Date: Mon, 16 Mar 2015 06:04:43 -0400 Subject: [PATCH 05/49] dungeoneers update March 16, 2015 --- dat/history | 75 +++++++++++++++++++++---------------------- doc/Guidebook.mn | 81 ++++++++++++++++++++++++----------------------- doc/Guidebook.tex | 81 ++++++++++++++++++++++++----------------------- 3 files changed, 120 insertions(+), 117 deletions(-) diff --git a/dat/history b/dat/history index 662ec57ae..b97c99039 100644 --- a/dat/history +++ b/dat/history @@ -159,41 +159,42 @@ particularly intriguing modification to help out with the game. The Gods of the Dungeon sometimes make note of the names of the worst of these miscreants in this, the list of Dungeoneers: - Adam Aronow Izchak Miller Mike Passaretti - Alex Kompel J. Ali Harlow Mike Stephenson - Andreas Dorn Janet Walz Norm Meluch - Andy Church Janne Salmijarvi Olaf Seibert - Andy Swanson Jean-Christophe Collet Pasi Kallinen - Ari Huttunen Jochen Erwied Pat Rankin - Barton House John Kallen Paul Winner - Benson I. Margulies John Rupley Pierre Martineau - Bill Dyer John S. Bien Ralf Brown - Boudewijn Waijers Johnny Lee Ray Chason - Bruce Cox Jon W{tte Richard Addison - Bruce Holloway Jonathan Handler Richard Beigel - Bruce Mewborne Joshua Delahunty Richard P. Hughey - Carl Schelin Keizo Yamamoto Rob Menke - Chris Russo Ken Arnold Robin Johnson - David Cohrs Ken Arromdee Roderick Schertler - David Damerell Ken Lorber Roland McGrath - David Gentzel Ken Washikita Ron Van Iwaarden - David Hairston Kevin Darcy Ronnen Miller - Dean Luick Kevin Hugo Ross Brown - Del Lamb Kevin Sitze Sascha Wostmann - Deron Meranda Kevin Smolkowski Scott Bigham - Dion Nicolaas Kevin Sweet Scott R. Turner - Dylan O'Donnell Lars Huttar Stephen Spackman - Eric Backus Leon Arnott Stephen White - Eric Hendrickson Malcolm Ryan Steve Creps - Eric R. Smith Mark Gooderum Steve Linhart - Eric S. Raymond Mark Modrall Steve VanDevender - Erik Andersen Marvin Bressler Teemu Suikki - Frederick Roeber Matthew Day Tim Lennan - Gil Neiger Merlyn LeRoy Timo Hakulinen - Greg Laskin Michael Allison Tom Almy - Greg Olson Michael Feir Tom West - Gregg Wonderly Michael Hamel Warren Cheung - Hao-yang Wang Michael Sokolov Warwick Allison - Helge Hafting Mike Engber Yitzhak Sapir - Irina Rempt-Drijfhout Mike Gallop + Adam Aronow Izchak Miller Mike Stephenson + Alex Kompel J. Ali Harlow Norm Meluch + Andreas Dorn Janet Walz Olaf Seibert + Andy Church Janne Salmijarvi Pasi Kallinen + Andy Swanson Jean-Christophe Collet Pat Rankin + Ari Huttunen Jochen Erwied Paul Winner + Barton House John Kallen Pierre Martineau + Benson I. Margulies John Rupley Ralf Brown + Bill Dyer John S. Bien Ray Chason + Boudewijn Waijers Johnny Lee Richard Addison + Bruce Cox Jon W{tte Richard Beigel + Bruce Holloway Jonathan Handler Richard P. Hughey + Bruce Mewborne Joshua Delahunty Rob Menke + Carl Schelin Keizo Yamamoto Robin Johnson + Chris Russo Ken Arnold Roderick Schertler + David Cohrs Ken Arromdee Roland McGrath + David Damerell Ken Lorber Ron Van Iwaarden + David Gentzel Ken Washikita Ronnen Miller + David Hairston Kevin Darcy Ross Brown + Dean Luick Kevin Hugo Sascha Wostmann + Del Lamb Kevin Sitze Scott Bigham + Derek S. Ray Kevin Smolkowski Scott R. Turner + Deron Meranda Kevin Sweet Sean Hunt + Dion Nicolaas Lars Huttar Stephen Spackman + Dylan O'Donnell Leon Arnott Stephen White + Eric Backus Malcolm Ryan Steve Creps + Eric Hendrickson Mark Gooderum Steve Linhart + Eric R. Smith Mark Modrall Steve VanDevender + Eric S. Raymond Marvin Bressler Teemu Suikki + Erik Andersen Matthew Day Tim Lennan + Frederick Roeber Merlyn LeRoy Timo Hakulinen + Gil Neiger Michael Allison Tom Almy + Greg Laskin Michael Feir Tom West + Greg Olson Michael Hamel Warren Cheung + Gregg Wonderly Michael Sokolov Warwick Allison + Hao-yang Wang Mike Engber Yitzhak Sapir + Helge Hafting Mike Gallop + Irina Rempt-Drijfhout Mike Passaretti diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 82fa2d195..0b2e5cf3b 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -3,10 +3,10 @@ .ds h0 "NetHack Guidebook .ds h1 .ds h2 % -.ds vr "NetHack 3.5 +.ds vr "NetHack 3.6 .ds f0 "\*(vr .ds f1 -.ds f2 "April 7, 2012 +.ds f2 "March 16, 2015 .\" labeled paragraph start (should be part of tmac.n, but I don't want to .\" make changes to that file) .\" .PS word @@ -58,7 +58,7 @@ A Guide to the Mazes of Menace (Guidebook for NetHack) .au Eric S. Raymond -(Extensively edited and expanded for 3.5) +(Edited and expanded for 3.6) .hn 1 Introduction @@ -3205,43 +3205,44 @@ in this, the list of Dungeoneers: center; c c c. .\"TABLE_START -Adam Aronow Izchak Miller Mike Passaretti -Alex Kompel J. Ali Harlow Mike Stephenson -Andreas Dorn Janet Walz Norm Meluch -Andy Church Janne Salmijarvi Olaf Seibert -Andy Swanson Jean-Christophe Collet Pasi Kallinen -Ari Huttunen Jochen Erwied Pat Rankin -Barton House John Kallen Paul Winner -Benson I. Margulies John Rupley Pierre Martineau -Bill Dyer John S. Bien Ralf Brown -Boudewijn Waijers Johnny Lee Ray Chason -Bruce Cox Jon W{tte Richard Addison -Bruce Holloway Jonathan Handler Richard Beigel -Bruce Mewborne Joshua Delahunty Richard P. Hughey -Carl Schelin Keizo Yamamoto Rob Menke -Chris Russo Ken Arnold Robin Johnson -David Cohrs Ken Arromdee Roderick Schertler -David Damerell Ken Lorber Roland McGrath -David Gentzel Ken Washikita Ron Van Iwaarden -David Hairston Kevin Darcy Ronnen Miller -Dean Luick Kevin Hugo Ross Brown -Del Lamb Kevin Sitze Sascha Wostmann -Deron Meranda Kevin Smolkowski Scott Bigham -Dion Nicolaas Kevin Sweet Scott R. Turner -Dylan O'Donnell Lars Huttar Stephen Spackman -Eric Backus Leon Arnott Stephen White -Eric Hendrickson Malcolm Ryan Steve Creps -Eric R. Smith Mark Gooderum Steve Linhart -Eric S. Raymond Mark Modrall Steve VanDevender -Erik Andersen Marvin Bressler Teemu Suikki -Frederick Roeber Matthew Day Tim Lennan -Gil Neiger Merlyn LeRoy Timo Hakulinen -Greg Laskin Michael Allison Tom Almy -Greg Olson Michael Feir Tom West -Gregg Wonderly Michael Hamel Warren Cheung -Hao-yang Wang Michael Sokolov Warwick Allison -Helge Hafting Mike Engber Yitzhak Sapir -Irina Rempt-Drijfhout Mike Gallop +Adam Aronow Izchak Miller Mike Stephenson +Alex Kompel J. Ali Harlow Norm Meluch +Andreas Dorn Janet Walz Olaf Seibert +Andy Church Janne Salmijarvi Pasi Kallinen +Andy Swanson Jean-Christophe Collet Pat Rankin +Ari Huttunen Jochen Erwied Paul Winner +Barton House John Kallen Pierre Martineau +Benson I. Margulies John Rupley Ralf Brown +Bill Dyer John S. Bien Ray Chason +Boudewijn Waijers Johnny Lee Richard Addison +Bruce Cox Jon W{tte Richard Beigel +Bruce Holloway Jonathan Handler Richard P. Hughey +Bruce Mewborne Joshua Delahunty Rob Menke +Carl Schelin Keizo Yamamoto Robin Johnson +Chris Russo Ken Arnold Roderick Schertler +David Cohrs Ken Arromdee Roland McGrath +David Damerell Ken Lorber Ron Van Iwaarden +David Gentzel Ken Washikita Ronnen Miller +David Hairston Kevin Darcy Ross Brown +Dean Luick Kevin Hugo Sascha Wostmann +Del Lamb Kevin Sitze Scott Bigham +Derek S. Ray Kevin Smolkowski Scott R. Turner +Deron Meranda Kevin Sweet Sean Hunt +Dion Nicolaas Lars Huttar Stephen Spackman +Dylan O'Donnell Leon Arnott Stephen White +Eric Backus Malcolm Ryan Steve Creps +Eric Hendrickson Mark Gooderum Steve Linhart +Eric R. Smith Mark Modrall Steve VanDevender +Eric S. Raymond Marvin Bressler Teemu Suikki +Erik Andersen Matthew Day Tim Lennan +Frederick Roeber Merlyn LeRoy Timo Hakulinen +Gil Neiger Michael Allison Tom Almy +Greg Laskin Michael Feir Tom West +Greg Olson Michael Hamel Warren Cheung +Gregg Wonderly Michael Sokolov Warwick Allison +Hao-yang Wang Mike Engber Yitzhak Sapir +Helge Hafting Mike Gallop +Irina Rempt-Drijfhout Mike Passaretti .\"TABLE_END Do not delete this line. .TE diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index d8e361648..c1cf2015e 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -33,7 +33,7 @@ \begin{document} % % input file: guidebook.mn -% $Revision: 1.121 $ $Date: 2012/04/09 02:56:37 $ +% $Revision: 1.122 $ $Date: 2015/03/16 06:00:00 $ % %.ds h0 " %.ds h1 %.ds h2 \% @@ -45,8 +45,8 @@ %.au \author{Eric S. Raymond\\ -(Extensively edited and expanded for 3.5)} -\date{April 7, 2012} +(Edited and expanded for 3.6)} +\date{March 16, 2015} \maketitle @@ -3801,43 +3801,44 @@ in this, the list of Dungeoneers: \begin{center} \begin{tabular}{lll} %TABLE_START -Adam Aronow & Izchak Miller & Mike Passaretti\\ -Alex Kompel & J. Ali Harlow & Mike Stephenson\\ -Andreas Dorn & Janet Walz & Norm Meluch\\ -Andy Church & Janne Salmij\"{a}rvi & Olaf Seibert\\ -Andy Swanson & Jean-Christophe Collet & Pasi Kallinen\\ -Ari Huttunen & Jochen Erwied & Pat Rankin\\ -Barton House & John Kallen & Paul Winner\\ -Benson I. Margulies & John Rupley & Pierre Martineau\\ -Bill Dyer & John S. Bien & Ralf Brown\\ -Boudewijn Waijers & Johnny Lee & Ray Chason\\ -Bruce Cox & Jon W\{tte & Richard Addison\\ -Bruce Holloway & Jonathan Handler & Richard Beigel\\ -Bruce Mewborne & Joshua Delahunty & Richard P. Hughey\\ -Carl Schelin & Keizo Yamamoto & Rob Menke\\ -Chris Russo & Ken Arnold & Robin Johnson\\ -David Cohrs & Ken Arromdee & Roderick Schertler\\ -David Damerell & Ken Lorber & Roland McGrath\\ -David Gentzel & Ken Washikita & Ron Van Iwaarden\\ -David Hairston & Kevin Darcy & Ronnen Miller\\ -Dean Luick & Kevin Hugo & Ross Brown\\ -Del Lamb & Kevin Sitze & Sascha Wostmann\\ -Deron Meranda & Kevin Smolkowski & Scott Bigham\\ -Dion Nicolaas & Kevin Sweet & Scott R. Turner\\ -Dylan O'Donnell & Lars Huttar & Stephen Spackman\\ -Eric Backus & Leon Arnott & Stephen White\\ -Eric Hendrickson & Malcolm Ryan & Steve Creps\\ -Eric R. Smith & Mark Gooderum & Steve Linhart\\ -Eric S. Raymond & Mark Modrall & Steve VanDevender\\ -Erik Andersen & Marvin Bressler & Teemu Suikki\\ -Frederick Roeber & Matthew Day & Tim Lennan\\ -Gil Neiger & Merlyn LeRoy & Timo Hakulinen\\ -Greg Laskin & Michael Allison & Tom Almy\\ -Greg Olson & Michael Feir & Tom West\\ -Gregg Wonderly & Michael Hamel & Warren Cheung\\ -Hao-yang Wang & Michael Sokolov & Warwick Allison\\ -Helge Hafting & Mike Engber & Yitzhak Sapir\\ -Irina Rempt-Drijfhout & Mike Gallop +Adam Aronow & Izchak Miller & Mike Stephenson\\ +Alex Kompel & J. Ali Harlow & Norm Meluch\\ +Andreas Dorn & Janet Walz & Olaf Seibert\\ +Andy Church & Janne Salmij\"{a}rvi & Pasi Kallinen\\ +Andy Swanson & Jean-Christophe Collet & Pat Rankin\\ +Ari Huttunen & Jochen Erwied & Paul Winner\\ +Barton House & John Kallen & Pierre Martineau\\ +Benson I. Margulies & John Rupley & Ralf Brown\\ +Bill Dyer & John S. Bien & Ray Chason\\ +Boudewijn Waijers & Johnny Lee & Richard Addison\\ +Bruce Cox & Jon W\{tte & Richard Beigel\\ +Bruce Holloway & Jonathan Handler & Richard P. Hughey\\ +Bruce Mewborne & Joshua Delahunty & Rob Menke\\ +Carl Schelin & Keizo Yamamoto & Robin Johnson\\ +Chris Russo & Ken Arnold & Roderick Schertler\\ +David Cohrs & Ken Arromdee & Roland McGrath\\ +David Damerell & Ken Lorber & Ron Van Iwaarden\\ +David Gentzel & Ken Washikita & Ronnen Miller\\ +David Hairston & Kevin Darcy & Ross Brown\\ +Dean Luick & Kevin Hugo & Sascha Wostmann\\ +Del Lamb & Kevin Sitze & Scott Bigham\\ +Derek S. Ray & Kevin Smolkowski & Scott R. Turner\\ +Deron Meranda & Kevin Sweet & Sean Hunt\\ +Dion Nicolaas & Lars Huttar & Stephen Spackman\\ +Dylan O'Donnell & Leon Arnott & Stephen White\\ +Eric Backus & Malcolm Ryan & Steve Creps\\ +Eric Hendrickson & Mark Gooderum & Steve Linhart\\ +Eric R. Smith & Mark Modrall & Steve VanDevender\\ +Eric S. Raymond & Marvin Bressler & Teemu Suikki\\ +Erik Andersen & Matthew Day & Tim Lennan\\ +Frederick Roeber & Merlyn LeRoy & Timo Hakulinen\\ +Gil Neiger & Michael Allison & Tom Almy\\ +Greg Laskin & Michael Feir & Tom West\\ +Greg Olson & Michael Hamel & Warren Cheung\\ +Gregg Wonderly & Michael Sokolov & Warwick Allison\\ +Hao-yang Wang & Mike Engber & Yitzhak Sapir\\ +Helge Hafting & Mike Gallop\\ +Irina Rempt-Drijfhout & Mike Passaretti %TABLE_END Do not delete this line. \end{tabular} \end{center} From 4914e256bf342f3e886e84562670c5583c84649a Mon Sep 17 00:00:00 2001 From: "Derek S. Ray" Date: Mon, 16 Mar 2015 17:26:31 -0400 Subject: [PATCH 06/49] finally remember to add the 'nh-' versions --- DEVEL/git_recipes.txt | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/DEVEL/git_recipes.txt b/DEVEL/git_recipes.txt index 71ce0e5dc..88af7f927 100644 --- a/DEVEL/git_recipes.txt +++ b/DEVEL/git_recipes.txt @@ -34,12 +34,17 @@ you specify: [*] git add (filename) +[*] git nhadd (filename) Adds the changes you've made in (filename) to the pre-commit staging area. (also referred to as the 'index') +"nhadd" is the preferred syntax and will automatically update the source file +headers with the latest date, branch, and version. + [*] git commit [-a] [-m "text"] +[*] git nhcommit [-a] [-m "text"] Commits all staged changes (in the index) to this branch in your local repo from your current position. @@ -47,6 +52,9 @@ Including -a will 'git add' all eligible files before doing so. Including -m will use "text" as the commit message instead of opening an editor window for you to create one. +"nhcommit" is the preferred syntax and will automatically update the source file +headers with the latest date, branch, and version. + [*] git push [--all] [-u origin (branch)] @@ -61,7 +69,7 @@ branch. Without any parameters, unstages the changes for (filename) from the index; does not change the working tree. This is the equivalent of the command -[*] git reset --mixed (filename); git reset --soft (filename) has no effect. +git reset --mixed (filename); git reset --soft (filename) has no effect. With --hard, unstages (filename) from the index and reverts (filename) in the working tree to the most recent commit. @@ -160,6 +168,20 @@ you must commit them manually later (likely after you have edited them). This more accurately mimics the merge behavior of svn [and cvs?] +[*] git stash [save | apply | list] + +save: Takes all changes in your working directory and 'stashes' them in a temporary +holding area. Convenient if the command you're trying to run won't go unless +you have a clean working dir; also convenient to move experimental changes +between branches without needing to commit them. + +apply: Replays the named stash onto your current working directory as though +it were a patch. Does not delete the stash from the list. + +list: Lists all of your stashed code blobs. + + + ======================================= Typical workflows for common activities ======================================= From 562fa952ce95695272467ef8f00277735ba93820 Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 16 Mar 2015 15:28:01 -0700 Subject: [PATCH 07/49] allow DEBUGFILES to be overridden via getenv() If getenv("DEBUGFILES") yields a value then it takes precedence over sysconf.DEBUGFILES or sys.c's #define DEBUGFILES. (It probably should only be controlled via environment since it is not a system-wide attribute, but I haven't taken out the SYSCF handling for it.) --- include/sys.h | 7 ++++++- src/files.c | 21 +++++++++++++++++++-- src/sys.c | 5 ++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/include/sys.h b/include/sys.h index 940e95a11..b97f7ca80 100644 --- a/include/sys.h +++ b/include/sys.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 sys.h $NHDT-Date: 1426496454 2015/03/16 09:00:54 $ $NHDT-Branch: master $:$NHDT-Revision: 1.12 $ */ +/* NetHack 3.5 sys.h $NHDT-Date: 1426544796 2015/03/16 22:26:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.13 $ */ /* NetHack 3.5 sys.h $Date: 2012/01/27 20:15:26 $ $Revision: 1.9 $ */ /* Copyright (c) Kenneth Lorber, Kensington, Maryland, 2008. */ /* NetHack may be freely redistributed. See license for details. */ @@ -12,6 +12,11 @@ struct sysopt { char *wizards; char *shellers; /* like wizards, for ! command (-DSHELL) */ char *debugfiles; /* files to show debugplines in. '*' is all. */ + int env_dbgfl; /* 1: debugfiles comes from getenv("DEBUGFILES") + * so sysconf's DEBUGFILES shouldn't override it; + * 0: getenv() hasn't been attempted yet; + * -1: getenv() didn't find a value for DEBUGFILES. + */ int maxplayers; /* record file */ int persmax; diff --git a/src/files.c b/src/files.c index 9e9cea746..a6f17b906 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 files.c $NHDT-Date: 1426465435 2015/03/16 00:23:55 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.133 $ */ +/* NetHack 3.5 files.c $NHDT-Date: 1426544796 2015/03/16 22:26:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.134 $ */ /* 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. */ @@ -2157,7 +2157,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); @@ -3207,6 +3211,19 @@ const char *filename; 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; diff --git a/src/sys.c b/src/sys.c index 52489135e..35e46b7c8 100644 --- a/src/sys.c +++ b/src/sys.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 sys.c $NHDT-Date: 1426496455 2015/03/16 09:00:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.17 $ */ +/* 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. */ @@ -10,6 +10,8 @@ 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; @@ -29,6 +31,7 @@ sys_early_init() #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 */ From ad03a7fb7a40ac908a03cc8ba16d14138d13c2ba Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 16 Mar 2015 19:22:49 -0700 Subject: [PATCH 08/49] some lint cleanup --- src/do_name.c | 15 ++++++++------- src/pickup.c | 8 ++++---- src/role.c | 20 +++++++++++--------- src/trap.c | 10 ++-------- 4 files changed, 25 insertions(+), 28 deletions(-) diff --git a/src/do_name.c b/src/do_name.c index f1960b6ff..37daffbc4 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -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)) { @@ -250,8 +251,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; } diff --git a/src/pickup.c b/src/pickup.c index 7b3096c59..3eba9874f 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 pickup.c $NHDT-Date: 1426465438 2015/03/16 00:23:58 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.130 $ */ +/* 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. */ @@ -1515,7 +1515,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 +1563,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..."); diff --git a/src/role.c b/src/role.c index 9e09d448a..bf4d66de7 100644 --- a/src/role.c +++ b/src/role.c @@ -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 { diff --git a/src/trap.c b/src/trap.c index 911aafdc5..36c1ee632 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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: 1426558928 2015/03/17 02:22:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.195 $ */ /* 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. */ @@ -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; @@ -3158,7 +3157,7 @@ struct obj *obj; const char *ostr; boolean force; { - boolean loose_obj = (obj && obj->where == OBJ_FREE), exploded = FALSE; + boolean exploded = FALSE; if (snuff_lit(obj)) return ER_DAMAGED; @@ -3214,11 +3213,6 @@ boolean force; (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] */ setnotworn(obj); delobj(obj); if (update) From 379c23096afdcf0bbe504604539b27004785f385 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 17 Mar 2015 21:22:43 +0200 Subject: [PATCH 09/49] More getpos improvements Look up remembered dungeon features, not user-visible glyphs, and ignore uninteresting features (room, corridor and wall tiles). Original patch by Patric Mueller, from UnNetHack --- doc/fixes35.0 | 1 + src/do_name.c | 20 ++++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 250b09d85..53a9d784e 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -1089,6 +1089,7 @@ change command X to twoweapon toggle pressing @ when cursor positioning moves cursor on top of hero pressing # when cursor positioning toggles automatic description of features under the cursor +cursor positioning ignores uninteresting dungeon features Platform- and/or Interface-Specific New Features diff --git a/src/do_name.c b/src/do_name.c index 37daffbc4..47012d3f3 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -204,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); From c80828fe7aff35131cb4b36267858718662126c0 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 17 Mar 2015 22:40:57 -0400 Subject: [PATCH 10/49] Start to prepare dat/history for release This gets the history started. Please review/correct/improve and fill in the various items I've flagged. --- dat/history | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 64 insertions(+), 3 deletions(-) diff --git a/dat/history b/dat/history index b97c99039..0e15a079c 100644 --- a/dat/history +++ b/dat/history @@ -1,4 +1,4 @@ -NetHack History file for release 3.4 +NetHack History file for release 3.6 Behold, mortal, the origins of NetHack... @@ -120,7 +120,6 @@ publicly available web-site listing all the bugs that had been discovered. Despite that constantly growing bug list, 3.3 proved stable enough to last for more than a year and a half. - The 3.4 development team initially consisted of Michael Allison, Ken Arromdee, David Cohrs, Jessie Collet, Kevin Hugo, Ken Lorber, Dean Luick, Pat Rankin, Mike Stephenson, Janet Walz, and Paul Winner, with Warwick Allison joining @@ -150,7 +149,69 @@ Amiga port of 3.5 after Janne Salmijarvi resurrected it for 3.3.1. Christian `Marvin' Bressler maintained 3.5 for the Atari after he resurrected it for 3.3.1. -There is a NetHack web site maintained by Ken Lorber at http://www.nethack.org/. +The release of NetHack 3.4.3 in December 2003 marked the beginning of a +long release hiatus. 3.4.3 proved to be a remarkably stable version that +provided continued enjoyment by the community for more than a decade. The +devteam slowly and quietly continued to work on the game behind the scenes +during the tenure of 3.4.3. It was during that same period that several new +variants emerged within the NetHack community. Notably sporkhack by +Derek S. Ray, unnethack by Patric Mueller, nitrohack and its successors +originally by Daniel Thaler and then by Alex Smith, and +Dynahack by Tung Nguyen. Some of those variants continue to be developed, +maintained, and enjoyed by the community to this day. + +In September 2014, an interim snapshot of the code under development was +released publicly by other parties. Since that code was a work-in-progress +and had not gone through a period of debugging, it was decided that the +version numbers present on that code snapshot would be retired and never +used in an official NetHack release. An announcement was posted on the +devteam's official nethack.org website to that effect, stating that there +would never be a 3.4.4, 3.5, or 3.5.0 official release version. + +In January 2015, preparation began for the release of NetHack 3.6. + +At the beginning of development for what would eventually get released +as 3.6.0, the development team consisted of Michael Allison, +Warwick Allison, Ken Arromdee, David Cohrs, Jessie Collet, Ken Lorber, +Dean Luick, Pat Rankin, Mike Stephenson, Janet Walz, and Paul Winner. + +Leading up to the release of 3.6.0 in early 2015, new members Sean Hunt, +Pasi Kallinen, and Derek S. Ray joined the NetHack development team. + +3.6.0 - insert apprpriate description of 3.6.0 here + +The development team, as well as Steve VanDevender and Kevin Smolkowski +ensured that NetHack 3.6.0 continued to operate on various Unix flavors +as well as maintaining the X11 interface. + +Ken Lorber, Haoyang Wang, Pat Rankin, and Dean Luick maintained the port +of NetHack 3.6.0 for Mac. + +Michael Allison, Derek S. Ray, Yitzhak Sapir, Alex Kompel, and David Cohrs +maintained the port of NetHack 3.6.0 for Microsoft Windows. + +Jeff Bailey created and maintained a port of NetHack 3.6.0 for Chrome. + +Alex Kompel maintained a port of NetHack 3.6.0 to Windows Phone. ? + +This version of the game is special in a particular way. Near the end of +the development of 3.6, one of the significant inspirations for many of the +humorous and fun features found in the game, author Terry Pratchett, +passed away. This version of the game is dedicated to + + +An official NetHack web site continues to be maintained by Ken Lorber at +http://www.nethack.org/. + +-- +SHOUT-OUTS + +The devteam would like to give a special "shout-out" to thank the generous +people primarily responsible for the public NetHack servers available for +playing the game at nethack.alt.org and devnull.net. In addition to providing +a way for the public to play a game of NetHack from almost anywhere, they +have hosted annual NetHack tournaments for many, many years. + write up something for Robin, M. Drew Streib, Pasi Kallinen - - - - - - - - - - From e93add8cb8e0ed782ec6da0beebf4d18d5c6f59a Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 18 Mar 2015 21:40:54 +0200 Subject: [PATCH 11/49] Prevent segfault, water_damage may get a NULL obj --- src/trap.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/trap.c b/src/trap.c index 36c1ee632..bc8f0c746 100644 --- a/src/trap.c +++ b/src/trap.c @@ -3159,6 +3159,8 @@ boolean force; { boolean exploded = FALSE; + if (!obj) return ER_NOTHING; + if (snuff_lit(obj)) return ER_DAMAGED; From debdf7ca48fc7b9c8b7b3698147d05312a605092 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 18 Mar 2015 22:05:10 +0200 Subject: [PATCH 12/49] Move some hard-coded string arrays into data files. Random epitaphs, engravings and hallucinatory monsters now live in text data files. --- dat/bogusmon.txt | 177 ++++++++++++++++++++++++++++++++++++++++++ dat/engrave.txt | 45 +++++++++++ dat/epitaph.txt | 32 ++++++++ doc/makedefs.6 | 9 +++ include/extern.h | 5 +- include/global.h | 3 + src/do_name.c | 115 ++++++--------------------- src/eat.c | 2 +- src/engrave.c | 73 +++-------------- src/explode.c | 4 +- src/fountain.c | 2 +- src/muse.c | 2 +- src/pickup.c | 2 +- src/potion.c | 2 +- src/priest.c | 5 +- src/rumors.c | 40 ++++++++++ src/sounds.c | 2 +- src/timeout.c | 2 +- src/trap.c | 2 +- src/zap.c | 2 +- sys/unix/Makefile.dat | 11 ++- sys/unix/Makefile.top | 11 ++- util/makedefs.c | 46 ++++++++++- 23 files changed, 420 insertions(+), 174 deletions(-) create mode 100644 dat/bogusmon.txt create mode 100644 dat/engrave.txt create mode 100644 dat/epitaph.txt diff --git a/dat/bogusmon.txt b/dat/bogusmon.txt new file mode 100644 index 000000000..8c7aba45b --- /dev/null +++ b/dat/bogusmon.txt @@ -0,0 +1,177 @@ +# Hallucinatory monsters +# +# +# prefix codes: +# dash - female, personal name +# underscore _ female, general name +# plus + male, personal name +# vertical bar | male, general name +# equals = gender not specified, personal name + +# misc. +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 + +# Quendor (Zork, &c.) +grue +Christmas-tree monster +luck sucker +paskald +brogmoid +dornbeast + +# Moria +Ancient Multi-Hued Dragon ++Evil Iggy + +# Rogue +emu +kestrel +xeroc +venus flytrap + +# Wizardry +creeping coins + +# Greek legend +hydra +siren + +# Monty Python +killer bunny + +# The Princess Bride +rodent of unusual size + +# Wallace & Gromit +were-rabbit + +# "Only you can prevent forest fires! ++Smokey Bear + +# Discworld +Luggage + +# Lord of the Rings +Ent + +# Xanth +tangle tree +nickelpede +wiggle + +# Lewis Carroll +white rabbit +snark + +# Dr. Dolittle +pushmi-pullyu + +# The Smurfs +smurf + +# Star Trek +tribble +Klingon +Borg + +# Star Wars +Ewok + +# Tonari no Totoro +Totoro + +# Nausicaa +ohmu + +# Sailor Moon +youma + +# Pokemon (Meowth) +nyaasu + +# monster movies +-Godzilla ++King Kong + +# old L of SH +earthquake beast + +# Robotech +Invid + +# The Terminator +Terminator + +# Bubblegum Crisis +boomer + +# Dr. Who ("Exterminate!") +Dalek + +# HGttG +microscopic space fleet +Ravenous Bugblatter Beast of Traal + +# TMNT +teenage mutant ninja turtle + +# Usagi Yojimbo +samurai rabbit + +# Cerebus +aardvark + +# Little Shop of Horrors +=Audrey II + +# 50's rock 'n' roll +witch doctor +one-eyed one-horned flying purple people eater + +# saccharine kiddy TV ++Barney the dinosaur + +# Angband ++Morgoth + +# Babylon 5 +Vorlon + +# King Arthur +questing beast + +# Movie +Predator + +# common pest +mother-in-law diff --git a/dat/engrave.txt b/dat/engrave.txt new file mode 100644 index 000000000..6827c8a9a --- /dev/null +++ b/dat/engrave.txt @@ -0,0 +1,45 @@ +# Random engravings on the floor +# +Elbereth +# trap engravings +Vlad was here +ad aerarium + +# take-offs and other famous engravings +Owlbreath +Galadriel +Kilroy was here + +# Journey to the Center of the Earth +A.S. -> +<- A.S. +# Adventure +You won't get it up the steps +# Inferno +Lasciate ogni speranza o voi ch'entrate. +# Prisoner +Well Come +# So Long... +We apologize for the inconvenience. +# Thriller +See you next Wednesday +# Smokey Stover +notary sojak + +For a good time call 8?7-5309 +# Various zoos around the world +Please don't feed the animals. +# A palindrome +Madam, in Eden, I'm Adam. +# Siskel & Ebert +Two thumbs up! +# The First C Program +Hello, World! +^?MAIL +# AOL +You've got mail! +^. +# Clueless +As if! +# 200x incarnation of Dr.Who +BAD WOLF diff --git a/dat/epitaph.txt b/dat/epitaph.txt new file mode 100644 index 000000000..79019ea45 --- /dev/null +++ b/dat/epitaph.txt @@ -0,0 +1,32 @@ +# Epitaphs for random headstones +# +# +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! diff --git a/doc/makedefs.6 b/doc/makedefs.6 index 7b850108c..61bd7c741 100644 --- a/doc/makedefs.6 +++ b/doc/makedefs.6 @@ -105,6 +105,15 @@ Generate the file. .br .TP +.B -s +Generate the +.I bogusmon +, +.I engrave +and +.IR epitaph files. +.br +.TP .B -h Generate the .B oracles diff --git a/include/extern.h b/include/extern.h index fc3952804..23d10d324 100644 --- a/include/extern.h +++ b/include/extern.h @@ -387,7 +387,7 @@ E char *FDECL(Adjmonnam, (struct monst *,const char *)); E char *FDECL(Amonnam, (struct monst *)); E char *FDECL(a_monnam, (struct monst *)); E char *FDECL(distant_monnam, (struct monst *,int,char *)); -E const char *NDECL(rndmonnam); +E char *FDECL(rndmonnam, (char *)); E const char *FDECL(hcolor, (const char *)); E const char *NDECL(rndcolor); E const char *NDECL(roguename); @@ -1174,7 +1174,7 @@ E struct obj *FDECL(mkobj_at, (CHAR_P,int,int,BOOLEAN_P)); E struct obj *FDECL(mksobj_at, (int,int,int,BOOLEAN_P,BOOLEAN_P)); E struct obj *FDECL(mkobj, (CHAR_P,BOOLEAN_P)); E int NDECL(rndmonnum); -E boolean FDECL(bogon_is_pname, (const char *)); +E boolean FDECL(bogon_is_pname, (CHAR_P)); E struct obj *FDECL(splitobj, (struct obj *,long)); E void FDECL(replace_object, (struct obj *,struct obj *)); E void FDECL(bill_dummy_object, (struct obj *)); @@ -1931,6 +1931,7 @@ E const char *NDECL(Goodbye); /* ### rumors.c ### */ E char *FDECL(getrumor, (int,char *, BOOLEAN_P)); +E char *FDECL(get_rnd_text, (const char *, char *)); E void FDECL(outrumor, (int,int)); E void FDECL(outoracle, (BOOLEAN_P, BOOLEAN_P)); E void FDECL(save_oracles, (int,int)); diff --git a/include/global.h b/include/global.h index 6179409bb..a67066d64 100644 --- a/include/global.h +++ b/include/global.h @@ -30,6 +30,9 @@ #define OPTIONFILE "opthelp" /* file explaining runtime options */ #define OPTIONS_USED "options" /* compile-time options, for #version */ #define SYMBOLS "symbols" /* replacement symbol sets */ +#define EPITAPHFILE "epitaph" /* random epitaphs on graves */ +#define ENGRAVEFILE "engrave" /* random engravings on the floor */ +#define BOGUSMONFILE "bogusmon" /* hallucinatory monsters */ #define LEV_EXT ".lev" /* extension for special level files */ diff --git a/src/do_name.c b/src/do_name.c index 47012d3f3..0f837c9d4 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -809,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); @@ -1006,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 * diff --git a/src/eat.c b/src/eat.c index 983f6bcec..a5b413772 100644 --- a/src/eat.c +++ b/src/eat.c @@ -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; diff --git a/src/engrave.c b/src/engrave.c index ebfcd0829..5a8aa38f3 100644 --- a/src/engrave.c +++ b/src/engrave.c @@ -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; } diff --git a/src/explode.c b/src/explode.c index 65dbe82a5..905b7b94b 100644 --- a/src/explode.c +++ b/src/explode.c @@ -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; } diff --git a/src/fountain.c b/src/fountain.c index e87748e0a..88fb6e2a4 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -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) diff --git a/src/muse.c b/src/muse.c index 855a91887..9ea9c1d14 100644 --- a/src/muse.c +++ b/src/muse.c @@ -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)); } diff --git a/src/pickup.c b/src/pickup.c index 3eba9874f..1d78dea76 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -2040,7 +2040,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; diff --git a/src/potion.c b/src/potion.c index d4bfcdad3..0af019181 100644 --- a/src/potion.c +++ b/src/potion.c @@ -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); diff --git a/src/priest.c b/src/priest.c index 1ef7ea286..a28f2b8d4 100644 --- a/src/priest.c +++ b/src/priest.c @@ -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 "); diff --git a/src/rumors.c b/src/rumors.c index 081b81d8d..4bcb5c177 100644 --- a/src/rumors.c +++ b/src/rumors.c @@ -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 */ diff --git a/src/sounds.c b/src/sounds.c index 3b2ee2f56..6204847e8 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -1006,7 +1006,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."); diff --git a/src/timeout.c b/src/timeout.c index 481b16ae7..e47d863fb 100644 --- a/src/timeout.c +++ b/src/timeout.c @@ -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); } diff --git a/src/trap.c b/src/trap.c index bc8f0c746..beb24ad9a 100644 --- a/src/trap.c +++ b/src/trap.c @@ -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), diff --git a/src/zap.c b/src/zap.c index 5f39fc30e..3134c8b88 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1799,7 +1799,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 diff --git a/sys/unix/Makefile.dat b/sys/unix/Makefile.dat index ad9cb6e2d..17c543897 100644 --- a/sys/unix/Makefile.dat +++ b/sys/unix/Makefile.dat @@ -9,7 +9,7 @@ NHSROOT=.. # SHELL=E:/GEMINI2/MUPFEL.TTP # UUDECODE=uudecode -VARDAT = data rumors quest.dat oracles options +VARDAT = bogusmon data engrave epitaph rumors quest.dat oracles options all: $(VARDAT) spec_levs quest_levs dungeon @@ -98,6 +98,15 @@ quest.dat: quest.txt ../util/makedefs oracles: oracles.txt ../util/makedefs ../util/makedefs -h +engrave: engrave.txt ../util/makedefs + ../util/makedefs -s + +epitaph: epitaph.txt ../util/makedefs + ../util/makedefs -s + +bogusmon: bogusmon.txt ../util/makedefs + ../util/makedefs -s + # note: 'options' should have already been made when include/date.h was created options: ../util/makedefs ../util/makedefs -v diff --git a/sys/unix/Makefile.top b/sys/unix/Makefile.top index f9e474a5b..77cd28fa1 100644 --- a/sys/unix/Makefile.top +++ b/sys/unix/Makefile.top @@ -56,7 +56,7 @@ VARDIR = $(HACKDIR) # for Gnome # VARDATND = x11tiles pet_mark.xbm rip.xpm mapbg.xpm -VARDATD = data oracles options quest.dat rumors +VARDATD = bogusmon data engrave epitaph oracles options quest.dat rumors VARDAT = $(VARDATD) $(VARDATND) # Some versions of make use the SHELL environment variable as the shell @@ -109,6 +109,15 @@ manpages: data: $(GAME) ( cd dat ; $(MAKE) data ) +engrave: $(GAME) + ( cd dat ; $(MAKE) engrave ) + +bogusmon: $(GAME) + ( cd dat ; $(MAKE) bogusmon ) + +epitaph: $(GAME) + ( cd dat ; $(MAKE) epitaph ) + rumors: $(GAME) ( cd dat ; $(MAKE) rumors ) diff --git a/util/makedefs.c b/util/makedefs.c index f4ca9febb..8555178e1 100644 --- a/util/makedefs.c +++ b/util/makedefs.c @@ -169,6 +169,7 @@ static char *FDECL(bannerc_string, (char *,const char *)); static char *FDECL(xcrypt, (const char *)); static unsigned long FDECL(read_rumors_file, (const char *,int *,long *,unsigned long)); +static void FDECL(do_rnd_access_file, (const char *)); static boolean FDECL(d_filter, (char *)); static boolean FDECL(h_filter, (char *)); static boolean FDECL(ranged_attk,(struct permonst*)); @@ -213,7 +214,7 @@ extern unsigned _stklen = STKSIZ; int main(void) { - const char *def_options = "odemvpqrhz"; + const char *def_options = "odemvpqrshz"; char buf[100]; int len; @@ -329,6 +330,11 @@ char *options; case 'r': case 'R': do_rumors(); break; + case 's': + case 'S': do_rnd_access_file(EPITAPHFILE); + do_rnd_access_file(ENGRAVEFILE); + do_rnd_access_file(BOGUSMONFILE); + break; case 'h': case 'H': do_oracles(); break; @@ -870,6 +876,44 @@ unsigned long old_rumor_offset; return rumor_offset; } + +void +do_rnd_access_file(fname) +const char *fname; +{ + Sprintf(filename, DATA_IN_TEMPLATE, fname); + Strcat(filename, ".txt"); + if (!(ifp = fopen(filename, RDTMODE))) { + perror(filename); + exit(EXIT_FAILURE); + } + filename[0]='\0'; +#ifdef FILE_PREFIX + Strcat(filename, file_prefix); +#endif + Sprintf(eos(filename), DATA_TEMPLATE, fname); + if (!(ofp = fopen(filename, WRTMODE))) { + perror(filename); + exit(EXIT_FAILURE); + } + Fprintf(ofp,"%s",Dont_Edit_Data); + + tfp = getfp(DATA_TEMPLATE, "grep.tmp", WRTMODE); + grep0(ifp, tfp); + ifp = getfp(DATA_TEMPLATE, "grep.tmp", RDTMODE); + + while (fgets(in_line, sizeof in_line, ifp) != 0) { + if (in_line[0] == '#') continue; /* discard comments */ + if (in_line[0] == '\n') continue; /* and empty lines */ + (void) fputs(xcrypt(in_line), ofp); + } + Fclose(ifp); + Fclose(ofp); + + delete_file(DATA_TEMPLATE, "grep.tmp"); + return; +} + void do_rumors() { From 4b0a1af482553c806cfb62d37cedad49c8066fea Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 18 Mar 2015 19:21:29 -0700 Subject: [PATCH 13/49] xlogfile tweak to avoid forcing ANSI C Avoid the C89/C90 feature of implicit concatentation of string literals. XLOG_SEP handling becomes clumsier but will work with pre-ANSI compilers. --- src/topten.c | 95 +++++++++++++++++++++++++++------------------------- 1 file changed, 50 insertions(+), 45 deletions(-) diff --git a/src/topten.c b/src/topten.c index cc4aefbe1..12adcc449 100644 --- a/src/topten.c +++ b/src/topten.c @@ -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. */ @@ -66,8 +66,8 @@ 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 FDECL(encodeconduct, (void)); -STATIC_DCL long FDECL(encodeachieve, (void)); +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, @@ -295,53 +295,58 @@ struct toptenentry *tt; #endif } -#define XLOG_SEP "\t" /* xlogfile field separator. */ /* 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; { - char buf[DTHSZ+1]; - (void)fprintf(rfile, - "version=%d.%d.%d" - XLOG_SEP "points=%ld" - XLOG_SEP "deathdnum=%d" - XLOG_SEP "deathlev=%d" - XLOG_SEP "maxlvl=%d" - XLOG_SEP "hp=%d" - XLOG_SEP "maxhp=%d" - XLOG_SEP "deaths=%d" - XLOG_SEP "deathdate=%d" - XLOG_SEP "birthdate=%d" - XLOG_SEP "uid=%d", - tt->ver_major, tt->ver_minor, tt->patchlevel, - tt->points, tt->deathdnum, tt->deathlev, - tt->maxlvl, tt->hp, tt->maxhp, tt->deaths, - tt->deathdate, tt->birthdate, tt->uid); - (void)fprintf(rfile, - XLOG_SEP "role=%s" - XLOG_SEP "race=%s" - XLOG_SEP "gender=%s" - XLOG_SEP "align=%s", - tt->plrole, tt->plrace, tt->plgend, tt->plalign); - (void)fprintf(rfile, XLOG_SEP "name=%s", plname); - (void)fprintf(rfile, XLOG_SEP "death=%s", tt->death); - (void)fprintf(rfile, XLOG_SEP "conduct=0x%lx", encodeconduct()); - (void)fprintf(rfile, XLOG_SEP "turns=%ld", moves); - (void)fprintf(rfile, XLOG_SEP "achieve=0x%lx", encodeachieve()); - (void)fprintf(rfile, XLOG_SEP "realtime=%ld", (long)u.urealtime.realtime); - (void)fprintf(rfile, XLOG_SEP "starttime=%ld", (long)ubirthday); - (void)fprintf(rfile, XLOG_SEP "endtime=%ld", (long)u.urealtime.endtime); - (void)fprintf(rfile, XLOG_SEP "gender0=%s", genders[flags.initgend].filecode); - (void)fprintf(rfile, XLOG_SEP "align0=%s", - aligns[1 - u.ualignbase[A_ORIGINAL]].filecode); - fprintf(rfile, "\n"); -} -#undef XLOG_SEP +#define Fprintf (void)fprintf +#define XLOG_SEP '\t' /* xlogfile field separator. */ + char buf[BUFSZ]; -long -encodeconduct(void) + 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)u.urealtime.realtime, + XLOG_SEP, (long)ubirthday, + XLOG_SEP, (long)u.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; @@ -361,8 +366,8 @@ encodeconduct(void) return e; } -long -encodeachieve(void) +STATIC_OVL long +encodeachieve() { long r = 0L; From 357115ae80d443f4404c58f84065353d8dc6d179 Mon Sep 17 00:00:00 2001 From: PatR Date: Wed, 18 Mar 2015 19:24:43 -0700 Subject: [PATCH 14/49] add bogusmon,engrave,epitaph to dat/.gitignore --- dat/.gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/dat/.gitignore b/dat/.gitignore index 88e516283..1784229ab 100644 --- a/dat/.gitignore +++ b/dat/.gitignore @@ -5,6 +5,9 @@ rip.xpm pet_mark.xbm quest.dat rumors +bogusmon +engrave +epitaph x11tiles *.lev spec_levs From d182920655aea1f5c723977f9ea9e99b7f998b7c Mon Sep 17 00:00:00 2001 From: nhmall Date: Wed, 18 Mar 2015 23:00:46 -0400 Subject: [PATCH 15/49] update cmdline Makefile --- sys/winnt/Makefile.msc | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 847aa3797..4be6dd3ab 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -305,6 +305,9 @@ PDBFILE= /PDB:"$(O)$(GAME).PDB" MAPFILE= /MAP:"$(O)$(GAME).MAP" INCLDIR= /I..\include +ldebug=/DEBUG +cdebug = -Zi -Od + !IF ("$(ldebug)" != "") !IF ("$(ldebug)" != "/RELEASE") ldebug = /DEBUG @@ -341,14 +344,14 @@ LIBS= user32.lib winmm.lib $(ZLIB) !IF ("$(GRAPHICAL)"=="Y") cflagsGame = $(cdebug) $(cflags2) $(guiflags) $(INCLDIR) \ - $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) -lflagsGame = $(ldebug) $(lflags) $(guilibs) + $(WINPFLAG) $(DLBFLG) +lflagsGame = $(ldebug) $(lflags) $(guilibs) $(GAMEPDBFILE) $(GAMEMAPFILE) !ELSE cflagsGame = $(cdebug) $(cflags2) $(conflags) $(INCLDIR) \ - $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) -lflagsGame = $(ldebug) $(lflags) $(conlibs) + $(WINPFLAG) $(DLBFLG) +lflagsGame = $(ldebug) $(lflags) $(conlibs) $(GAMEPDBFILE) $(GAMEMAPFILE) !ENDIF @@ -607,6 +610,7 @@ all : install install: envchk $(GAME) $(O)install.tag @echo Done. + $(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \ $(DAT)\oracles $(DAT)\quest.dat $(O)sp_lev.tag $(DLB) ! IF ("$(USE_DLB)"=="Y") @@ -840,6 +844,14 @@ $(INCL)\vis_tab.h: $(U)makedefs.exe $(SRC)\vis_tab.c: $(U)makedefs.exe $(U)makedefs -z +$(DAT)\engrave: $(DAT)\engrave.txt $(U)makedefs.exe + ../util/makedefs -s +$(DAT)\epitaph: $(DAT)\epitaph.txt $(U)makedefs.exe + ../util/makedefs -s +$(DAT)\bogusmon: $(DAT)\bogusmon.txt $(U)makedefs.exe + ../util/makedefs -s + + #========================================== # uudecode utility and uuencoded targets #========================================== @@ -1081,7 +1093,7 @@ $(DAT)\porthelp: $(NTSYS)\porthelp nhdat: $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \ $(DAT)\quest.dat $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp \ $(DAT)\history $(DAT)\opthelp $(DAT)\wizhelp $(DAT)\dungeon $(DAT)\porthelp \ - $(DAT)\license $(O)sp_lev.tag + $(DAT)\license $(DAT)\engrave $(DAT)\epitaph $(DAT)\bogusmon $(O)sp_lev.tag cd $(DAT) echo data >dlb.lst echo oracles >>dlb.lst @@ -1091,6 +1103,9 @@ nhdat: $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \ if exist porthelp echo porthelp >>dlb.lst echo quest.dat >>dlb.lst echo rumors >>dlb.lst + echo engrave >>dlb.lst + echo epitaph >>dlb.lst + echo bogusmon >>dlb.lst echo help >>dlb.lst echo hh >>dlb.lst echo cmdhelp >>dlb.lst @@ -1238,6 +1253,9 @@ spotless: clean if exist $(U)*.map del $(U)*.map if exist $(DAT)\data del $(DAT)\data if exist $(DAT)\rumors del $(DAT)\rumors + if exist $(DAT)\engrave del $(DAT)\engrave + if exist $(DAT)\epitaph del $(DAT)\epitaph + if exist $(DAT)\bogusmon del $(DAT)\bogusmon if exist $(DAT)\???-fil?.lev del $(DAT)\???-fil?.lev if exist $(DAT)\???-goal.lev del $(DAT)\???-goal.lev if exist $(DAT)\???-loca.lev del $(DAT)\???-loca.lev From 3cc3709d9535fc9d3b34b0b45a436a8a707eb35e Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 19 Mar 2015 17:41:14 +0200 Subject: [PATCH 16/49] Save xlogfile time_t fields correctly --- include/decl.h | 1 + include/patchlevel.h | 2 +- include/you.h | 1 - src/allmain.c | 6 +++--- src/decl.c | 1 + src/end.c | 2 +- src/restore.c | 15 ++++++++++----- src/save.c | 4 +++- src/topten.c | 8 ++++---- src/u_init.c | 1 + 10 files changed, 25 insertions(+), 16 deletions(-) diff --git a/include/decl.h b/include/decl.h index 2071277dc..bacff08d9 100644 --- a/include/decl.h +++ b/include/decl.h @@ -244,6 +244,7 @@ E NEARDATA anything zeroany; /* init'd and defined in decl.c */ #include "you.h" E NEARDATA struct you u; E NEARDATA time_t ubirthday; +E NEARDATA struct u_realtime urealtime; #include "onames.h" #ifndef PM_H /* (pm.h has already been included via youprop.h) */ diff --git a/include/patchlevel.h b/include/patchlevel.h index 00411a2c2..02b8b3bfa 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -14,7 +14,7 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 56 +#define EDITLEVEL 57 #define COPYRIGHT_BANNER_A \ "NetHack, Copyright 1985-2012" diff --git a/include/you.h b/include/you.h index 81aba0ba4..0fc5c6073 100644 --- a/include/you.h +++ b/include/you.h @@ -327,7 +327,6 @@ struct you { unsigned udg_cnt; /* how long you have been demigod */ struct u_achieve uachieve; /* achievements */ - struct u_realtime urealtime; struct u_event uevent; /* certain events have happened */ struct u_have uhave; /* you're carrying special objects */ struct u_conduct uconduct; /* KMH, conduct */ diff --git a/src/allmain.c b/src/allmain.c index eb1f2b69b..45c319037 100644 --- a/src/allmain.c +++ b/src/allmain.c @@ -533,11 +533,11 @@ newgame() #endif program_state.something_worth_saving++; /* useful data now exists */ - u.urealtime.realtime = (time_t)0L; + urealtime.realtime = (time_t)0L; #if defined(BSD) && !defined(POSIX_TYPES) - (void) time((long *)&u.urealtime.restored); + (void) time((long *)&urealtime.restored); #else - (void) time(&u.urealtime.restored); + (void) time(&urealtime.restored); #endif /* Success! */ diff --git a/src/decl.c b/src/decl.c index 6c83f0f14..d0d29a35f 100644 --- a/src/decl.c +++ b/src/decl.c @@ -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 */ diff --git a/src/end.c b/src/end.c index 111fd1b3a..7ada39767 100644 --- a/src/end.c +++ b/src/end.c @@ -911,7 +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(); - u.urealtime.realtime += (endtime - u.urealtime.restored); + 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 diff --git a/src/restore.c b/src/restore.c index 9f336d3ad..4e4502b53 100644 --- a/src/restore.c +++ b/src/restore.c @@ -551,13 +551,18 @@ 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 *)&u.urealtime.restored); + (void) time((long *)&urealtime.restored); #else - (void) time(&u.urealtime.restored); + (void) time(&urealtime.restored); #endif diff --git a/src/save.c b/src/save.c index 964847190..807ecd7dc 100644 --- a/src/save.c +++ b/src/save.c @@ -307,9 +307,11 @@ register int fd, mode; #ifdef SYSFLAGS bwrite(fd, (genericptr_t) &sysflags, sizeof(struct sysflag)); #endif - u.urealtime.realtime += (getnow() - u.urealtime.restored); + 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 */ diff --git a/src/topten.c b/src/topten.c index 12adcc449..b68ad1bce 100644 --- a/src/topten.c +++ b/src/topten.c @@ -334,10 +334,10 @@ struct toptenentry *tt; XLOG_SEP, encodeconduct(), XLOG_SEP, moves, XLOG_SEP, encodeachieve()); - Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime%ld", - XLOG_SEP, (long)u.urealtime.realtime, + Fprintf(rfile, "%crealtime=%ld%cstarttime=%ld%cendtime=%ld", + XLOG_SEP, (long)urealtime.realtime, XLOG_SEP, (long)ubirthday, - XLOG_SEP, (long)u.urealtime.endtime); + 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); @@ -480,7 +480,7 @@ time_t when; t0->birthdate = yyyymmdd(ubirthday); t0->deathdate = yyyymmdd(when); t0->tt_next = 0; - u.urealtime.endtime = when; + urealtime.endtime = when; #ifdef UPDATE_RECORD_IN_PLACE t0->fpos = -1L; #endif diff --git a/src/u_init.c b/src/u_init.c index bfe54671c..79954841c 100644 --- a/src/u_init.c +++ b/src/u_init.c @@ -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; From f5ea4e0d1f4eef04d12bbd765cc5e3a3153b78d3 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 19 Mar 2015 18:43:35 +0200 Subject: [PATCH 17/49] Add lots of new hallu monsters --- dat/bogusmon.txt | 306 ++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 305 insertions(+), 1 deletion(-) diff --git a/dat/bogusmon.txt b/dat/bogusmon.txt index 8c7aba45b..2ec3e7fe7 100644 --- a/dat/bogusmon.txt +++ b/dat/bogusmon.txt @@ -40,6 +40,39 @@ harpy lion-dog rat-ant Y2K bug +angry mariachi +arch-pedant +bluebird of happiness +cardboard golem +duct tape golem +diagonally moving grid bug +evil overlord +newsgroup troll +ninja pirate zombie robot +octarine dragon +gonzo journalist +lag monster +loan shark +possessed waffle iron +poultrygeist +stuffed raccoon puppet +viking +wee green blobbie +wereplatypus +hag of bolding +blancmange +raging nerd +spelling bee +land octopus +frog prince +pigasus +_Semigorgon +conventioneer +large microbat +small megabat +uberhulk +tofurkey ++Dudley # Quendor (Zork, &c.) grue @@ -53,7 +86,13 @@ dornbeast Ancient Multi-Hued Dragon +Evil Iggy -# Rogue +# Rogue V5 http://rogue.rogueforge.net/vade-mecum/ +rattlesnake +ice monster +phantom +quagga +aquator +griffin emu kestrel xeroc @@ -175,3 +214,268 @@ Predator # common pest mother-in-law + +# Actual creatures +praying mantis +beluga whale +chicken +coelacanth +star-nosed mole +lungfish +slow loris +sea cucumber +tapeworm +liger +velociraptor +corpulent porpoise + +# european cryptids +wolpertinger +elwedritsche +skvader ++Nessie +tatzelwurm +dahu + +# fictitious beasts +dropbear +wild haggis +jackalope +flying pig +hippocampus +hippogriff +kelpie + +# Unusually animate body parts +bouncing eye +floating nose +wandering eye + +# Computerese +buffer overflow +dangling pointer +walking disk drive +floating point +regex engine +netsplit +wiki +peer +COBOL + +# bugs +bohrbug +mandelbug +schroedinbug +heisenbug + +# DooM +cacodemon +scrag + +# MST3K ++Crow T. Robot + +# Items and stuff +chess pawn +chocolate pudding +ooblecks +terracotta warrior +hearse +roomba +miniature blimp +dust speck + +# DnD monster +gazebo + +# SciFi elements +gray goo +magnetic monopole +first category perpetual motion device + +# Ultima ++Lord British + +# They Might Be Giants +particle man + +# Robot Finds Kitten +kitten prospecting robot + +# Typography +guillemet +solidus +obelus + +# Their actual character +apostrophe golem +voluptuous ampersand + +# Web comics and animation ++Bob the angry flower ++Strong Bad ++Magical Trevor + +# KoL +one-winged dewinged stab-bat + +# deities +Invisible Pink Unicorn +Flying Spaghetti Monster + +# Monkey Island +three-headed monkey ++El Pollo Diablo + +# modern folklore +little green man + +# Portal +weighted Companion Cube + +# /b/ +/b/tard + +# South Park +manbearpig + +# internet memes +bonsai-kitten +tie-thulu ++Domo-kun +looooooooooooong cat +nyan cat + +# the Internet is made for cat pix +ceiling cat +basement cat +monorail cat + +# POWDER +tridude + +# Radomir Dopieralski +orcus cosmicus + +# Angband +yeek +quylthulg +Greater Hell Beast + +# Souljazz ++Vendor of Yizard + +# Dungeon Crawl Stone Soup ++Sigmund +lernaean hydra ++Ijyb ++Gloorx Vloq ++Blork the orc + +# Wil Wheaton, John Scalzi +unicorn pegasus kitten + +# Minecraft +enderman + +# Pun +wight supremacist + +# Starcraft 2 +zergling + +# Feelings +existential angst +figment of your imagination +flash of insight + +# Fish +ghoti + +# Roald Dahl +vermicious knid + +# Carcassonne +meeple + +# The Wombles +womble + +# Fraggle Rock +fraggle + +# soundex and typos of monsters +gloating eye +flush golem +martyr orc +mortar orc +acid blog +acute blob +aria elemental +aliasing priest +aligned parasite +aligned parquet +aligned proctor +baby balky dragon +baby blues dragon +baby caricature +baby crochet +baby grainy dragon +baby bong worm +baby long word +baby parable worm +barfed devil +beer wight +boor wight +brawny mold +rave spider +clue golem +bust vortex +errata elemental +elastic eel +electrocardiogram eel +fir elemental +tire elemental +flamingo sphere +fallacy golem +frizzed centaur +forest centerfold +fierceness sphere +frosted giant +geriatric snake +gnat ant +giant bath +grant beetle +grind bug +giant mango +glossy golem +gnome laureate +gnome dummy +gooier ooze +green slide +guardian nacho +hell hound pun +high purist +hairnet devil +ice trowel +killer beet +feather golem +lounge worm +mountain lymph +pager golem +pie fiend +prophylactic worm +sock mole +rogue piercer +seesawing sphere +simile mimic +moldier ant +stain vortex +scone giant +umbrella hulk +vampire mace +verbal jabberwock +water lemon +water melon +winged grizzly +yellow wight From 1fd371600d7eb6dca8414044e41ab23542bb6ac8 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 19 Mar 2015 21:13:24 +0200 Subject: [PATCH 18/49] Add some new random engravings --- dat/engrave.txt | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/dat/engrave.txt b/dat/engrave.txt index 6827c8a9a..6390c3ee1 100644 --- a/dat/engrave.txt +++ b/dat/engrave.txt @@ -43,3 +43,40 @@ You've got mail! As if! # 200x incarnation of Dr.Who BAD WOLF + +# Gang tag +Arooo! Werewolves of Yendor! + +# Strategy and pun +Dig for Victory here + +# Pompeii +Gaius Julius Primigenius was here. Why are you late? + +# Helpful guiding +Don't go this way +Go left ---> +<--- Go right +X marks the spot +X <--- You are here. +Here be dragons +Save now, and do your homework! +There was a hole here. It's gone now. +The Vibrating Square +This is a pit! +This is not the dungeon you are looking for. +Watch out, there's a gnome with a wand of death behind that door! + +# Misc fun +This square deliberately left blank. + +# Viking graffiti +Haermund Hardaxe carved these runes + +# Advertising +Need a light? Come visit the Minetown branch of Izchak's Lighting Store! +Snakes on the Astral Plane - Soon in a dungeon near you +You are the one millionth visitor to this place! Please wait 200 turns for your wand of wishing. + +# DnD +Warning, Exploding runes! From 384f519cc868692de840abcb6b092cd8e72cfd41 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Thu, 19 Mar 2015 22:01:16 +0200 Subject: [PATCH 19/49] Add lots of new random epitaphs --- dat/epitaph.txt | 364 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 364 insertions(+) diff --git a/dat/epitaph.txt b/dat/epitaph.txt index 79019ea45..58bb62228 100644 --- a/dat/epitaph.txt +++ b/dat/epitaph.txt @@ -30,3 +30,367 @@ 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! +Alas fair Death, 'twas missed in life - some peace and quiet from my wife +Applaud, my friends, the comedy is finished. +At last... a nice long sleep. +Audi Partem Alteram +Basil, assaulted by bears +Burninated +Confusion will be my epitaph +Do not open until Christmas +Don't be daft, they couldn't hit an elephant at this dist- +Don't forget to stop and smell the roses +Don't let this happen to you! +Dulce et decorum est pro patria mori +Et in Arcadia ego +Fatty and skinny went to bed. Fatty rolled over and skinny was dead. Skinny Smith 1983-2000. +Finally I am becoming stupider no more +Follow me to hell +...for famous men have the whole earth as their memorial +Game over, man. Game over. +Go away! I'm trying to take a nap in here! Bloody adventurers... +Gone fishin' +Good night, sweet prince: And flights of angels sing thee to thy rest! +Go Team Ant! +He farmed his way here +Here lies a programmer. Killed by a fatal error. +Here lies Bob - decided to try an acid blob +Here lies Dudley, killed by another %&#@#& newt. +Here lies Gregg, choked on an egg +Here lies Lies. It's True +Here lies The Lady's maid, died of a Vorpal Blade +Here lies the left foot of Jack, killed by a land mine. Let us know if you find any more of him +He waited too long +I'd rather be sailing +If a man's deeds do not outlive him, of what value is a mark in stone? +I'm gonna make it! +I took both pills! +I will survive! +Killed by a black dragon -- This grave is empty +Let me out of here! +Lookin' good, Medusa. +Mrs. Smith, choked on an apple. She left behind grieving husband, daughter, and granddaughter. +Nobody believed her when she said her feet were killing her +No! I don't want to see my damn conduct! +One corpse, sans head +On the whole, I'd rather be in Minetown +On vacation +Oops. +Out to Lunch +SOLD +Someone set us up the bomb! +Take my stuff, I don't need it anymore +Taking a year dead for tax reasons +The reports of my demise are completely accurate +(This space for sale) +This was actually just a pit, but since there was a corpse, we filled it +This way to the crypt +Tu quoque, Brute? +VACANCY +Welcome! +Wish you were here! +Yea, it got me too +You should see the other guy +...and they made me engrave my own headstone too! +...but the blood has stopped pumping and I am left to decay... + +A masochist is never satisfied. +Ach, 'twas a wee monster in the loch +Adapt. Enjoy. Survive. +Adventure, hah! Excitement, hah! +After all, what are friends for... +After this, nothing will shock me +After three days, fish and guests stink +Age and treachery will always overcome youth and skill +Ageing is not so bad. The real killer is when you stop. +Ain't I a stinker? +Algernon +All else failed... +All hail RNG +All right, we'll call it a draw! +All's well that end well +Alone at last! +Always attack a floating eye from behind! +Am I having fun yet? +And I can still crawl, I'm not dead yet! +And all I wanted was a free lunch +And all of the signs were right there on your face +And don't give me that innocent look either! +And everyone died. Boo hoo hoo. +And here I go again... +And nobody cares until somebody famous dies... +And so it ends? +And so... it begins. +And sometimes the bear eats you. +And then 'e nailed me 'ead to the floor! +And they said it couldn't be done! +And what do I look like? The living? +And yes, it was ALL his fault! +And you said it was pretty here... +Another lost soul +Any day above ground is a good day! +Any more of this and I'll die of a stroke before I'm 30. +Anybody seen my head? +Anyone for deathmatch? +Anything for a change. +Anything that kills you makes you ... well, dead +Anything worth doing is worth overdoing. +Are unicorns supposedly peaceful if you're a virgin? Hah! +Are we all being disintegrated, or is it just me? +At least I'm good at something +Attempted suicide +Auri sacra fames +Auribus teneo lupum +Be prepared +Beauty survives +Been Here. Now Gone. Had a Good Time. +Been through Hell, eh? What did you bring me? +Beg your pardon, didn't recognize you, I've changed a lot. +Being dead builds character +Beloved daughter, a treasure, buried here. +Best friends come and go... Mine just die. +Better be dead than a fat slave +Better luck next time +Beware of Discordians bearing answers +Beware the ... +Bloody Hell... +Bloody barbarians! +Blown upward out of sight: He sought the leak by candlelight +Brains... Brains... Fresh human brains... +Buried the cat. Took an hour. Damn thing kept fighting. +But I disarmed the trap! +CONNECT 1964 - NO CARRIER 1994 +Call me if you need my phone number! +Can YOU fly? +Can you believe that thing is STILL moving? +Can you come up with some better ending for this? +Can you feel anything when I do this? +Can you give me mouth to mouth, you just took my breath away. +Can't I just have a LITTLE peril? +Can't eat, can't sleep, had to bury the husband here. +Can't you hit me?! +Chaos, panic and disorder. My work here is done. +Check enclosed. +Check this out! It's my brain! +Chivalry is only reasonably dead +Coffin for sale. Lifetime guarantee. +Come Monday, I'll be all right. +Come and see the violence inherent in the system +Come back here! I'll bite your bloody knees off! +Commodore Business Machines, Inc. Died for our sins. +Complain to one who can help you +Confess my sins to god? Which one? +Confusion will be my epitaph +Cooties? Ain't no cooties on me! +Could somebody get this noose off me? +Could you check again? My name MUST be there. +Could you please take a breath mint? +Couldn't I be sedated for this? +Courage is looking at your setbacks with serenity +Cover me, I'm going in! +Crash course in brain surgery +Cross my fingers for me. +Curse god and die +Cut to fit +De'Ath +Dead Again? Pardon me for not getting it right the first time! +Dead and loving every moment! +Dear wife of mine. Died of a broken heart, after I took it out of her. +Don't tread on me! +Dragon? What dragon? +Drawn and quartered +Either I'm dead or my watch has stopped. +Eliza -- Was I really alive, or did I just think I was? +Elvis +Enter not into the path of the wicked +Eris? I don't need Eris +Eternal Damnation, Come and stay a long while! +Even The Dead pay taxes (and they aren't Grateful). +Even a tomb stone will say good things when you're down! +Ever notice that live is evil backwards? +Every day is starting to look like Monday +Every day, in every way, I am getting better and better. +Every survival kit should include a sense of humor +Evil I did dwell; lewd did I live +Ex post fucto +Excellent day to have a rotten day. +Excuse me for not standing up. +Experience isn't everything. First, You've got to survive +First shalt thou pull out the Holy Pin +For a Breath, I Tarry... +For recreational use only. +For sale: One soul, slightly used. Asking for 3 wishes. +For some moments in life, there are no words. +Forget Disney World, I'm going to Hell! +Forget about the dog, Beware of my wife. +Funeral - Real fun. +Gawd, it's depressing in here, isn't it? +Genuine Exploding Gravestone. (c)Acme Gravestones Inc. +Get back here! I'm not finished yet... +Go ahead, I dare you to! +Go ahead, it's either you or him. +Goldilocks -- This casket is just right +Gone But Not Forgotten +Gone Underground For Good +Gone away owin' more than he could pay. +Gone, but not forgiven +Got a life. Didn't know what to do with it. +Grave? But I was cremated! +Greetings from Hell - Wish you were here. +HELP! It's dark in here... Oh, my eyes are closed - sorry +Ha! I NEVER pay income tax! +Have you come to raise the dead? +Having a good time can be deadly. +Having a great time. Where am I exactly?? +He died of the flux. +He died today... May we rest in peace! +He got the upside, I got the downside. +He lost his face when he was beheaded. +He missed me first. +He's not dead, he just smells that way. +Help! I've fallen and I can't get up! +Help, I can't wake up! +Here lies Pinocchio +Here lies the body of John Round. Lost at sea and never found. +Here there be dragons +Hey, I didn't write this stuff! +Hodie mihi, cras tibi +Hold my calls +Home Sweet Hell +Humpty Dumpty, a Bad Egg. He was pushed off the wall. +I KNEW this would happen if I lived long enough. +I TOLD you I was sick! +I ain't broke but I am badly bent. +I ain't old. I'm chronologically advantaged. +I am NOT a vampire. I just like to bite..nibble, really! +I am here. Wish you were fine. +I am not dead yet, but watch for further reports. +I believe them bones are me. +I broke his brain. +I can feel it. My mind. It's going. I can feel it. +I can't go to Hell. They're afraid I'm gonna take over! +I can't go to hell, they don't want me. +I didn't believe in reincarnation the last time, either. +I didn't mean it when I said 'Bite me' +I died laughing +I disbelieved in reincarnation in my last life, too. +I hacked myself to death +I have all the time in the world +I knew I'd find a use for this gravestone! +I know my mind. And it's around here someplace. +I lied! I'll never be alright! +I like it better in the dark. +I like to be here when I can. +I may rise but I refuse to shine. +I never get any either. +I said hit HIM with the fireball, not me! +I told you I would never say goodbye. +I used to be amusing. Now I'm just disgusting. +I used up all my sick days, so now I'm calling in dead. +I was killed by +I was somebody. Who, is no business of yours. +I will not go quietly. +I'd give you a piece of my mind... but I can't find it. +I'd rather be breathing +I'll be back! +I'll be mellow when I'm dead. For now, let's PARTY! +I'm doing this only for tax purposes. +I'm not afraid of Death! What's he gonna do? Kill me? +I'm not getting enough money, so I'm not going to engrave anything useful here. +I'm not saying anything. +I'm weeth stupeed ---> +If you thought you had problems... +Ignorance kills daily. +Ignore me... I'm just here for my looks! +Ilene Toofar -- Fell off a cliff +Is that all? +Is there life before Death? +Is this a joke, or a grave matter? +It happens sometimes. People just explode. +It must be Thursday. I never could get the hang of Thursdays. +It wasn't a fair fight +It wasn't so easy. +It's Loot, Pillage and THEN Burn... +Just doing my job here +Killed by diarrhea of mouth and constipation of brain. +Let her RIP +Let it be; I am dead. +Let's play Hide the Corpse +Life is NOT a dream +Madge Ination -- It wasn't all in my head +Meet me in Heaven +Move on, there's nothing to see here. +Mr. Flintstone -- Yabba-dabba-done +My heart is not in this +No one ever died from it +No, you want room 12A, next door. +Nope. No trap on that chest. I swear. +Not again! +Not every soil can bear all things +Now I have a life +Now I lay thee down to sleep... wanna join me? +OK, here is a question: Where ARE your tanlines? +Obesa Cantavit +Oh! An untimely death. +Oh, by the way, how was my funeral? +Oh, honey..I missed you! She said, and fired again. +Ok, so the light does go off. Now let me out of here. +One stone brain +Ooh! Somebody STOP me! +Oops! +Out for the night. Leave a message. +Ow! Do that again! +Pardon my dust. +Part of me still works. +Please, not in front of those orcs! +Prepare to meet me in Heaven +R2D2 -- Rest, Tin Piece +Relax. Nothing ever happens on the first level. +Res omnia mea culpa est +Rest In Pieces +Rest, rest, perturbed spirit. +Rip Torn +She always said her feet were killing her but nobody believed her. +She died of a chest cold. +So let it be written, so let it be done! +So then I says, How do I know you're the real angel of death? +Some patients insist on dying. +Some people have it dead easy, don't they? +Some things are better left buried. +Sure, trust me, I'm a lawyer... +Thank God I wore my corset, because I think my sides have split. +That is all +The Gods DO have a sense of humor: I'm living proof! +The frog's dead. He Kermitted suicide. +This dungeon is a pushover +This elevator doesn't go to Heaven +This gravestone is shareware. To register, please send me 10 zorkmids +This gravestone provided by The Yendorian Grave Services Inc. +This is not an important part of my life. +This one's on me. +This side up +Tim Burr -- Smashed by a tree +Tone it down a bit, I'm trying to get some rest here. +Virtually Alive +We Will Meet Again. +Weep not, he is at rest +Welcome to Dante's. What level please? +Well, at least they listened to my sermon... +Went to be an angel. +What are you doing over there? +What are you smiling at? +What can you say, Death's got appeal...! +What health care? +What pit? +When the gods want to punish you, they answer your prayers. +Where e'er you be let your wind go free. Keeping it in was the death of me! +Where's my refund? +Will let you know for sure in a day or two... +Wizards are wimps +Worms at work, do not disturb! +Would you mind moving a bit? I'm short of breath down here. +Would you quit being evil over my shoulder? +Ya really had me going baby, but now I'm gone. +Yes Dear, just a few more minutes... +You said it wasn't poisonous! +You set my heart aflame. You gave me heartburn. From f2dc48086f4c36102a1bbeee713e2006e2a1660b Mon Sep 17 00:00:00 2001 From: PatR Date: Thu, 19 Mar 2015 15:54:17 -0700 Subject: [PATCH 20/49] acid explosion messages from water_damage() Restore the variant phrasing used when more than one stack of potions of acid explode while being inflicted with water damage. First message: "a potion explodes" or "some potions explode"; second and subsequent messages: "another potion explodes" or "more potions explode". This trivial feature stopped working when erosion handling was overhauled and old water_damage was split into current water_damage_chain+water_damage. Augment the message so that vague "potion" is only used when the object's dknown flag isn't set (ie, object hasn't been seen yet). Use " potion" or "potion of acid" otherwise, depending upon whether such potions have been fully discovered. --- src/trap.c | 56 +++++++++++++++++++++++++++++++++++++++++++----------- 1 file changed, 45 insertions(+), 11 deletions(-) diff --git a/src/trap.c b/src/trap.c index beb24ad9a..a0c6fa1b1 100644 --- a/src/trap.c +++ b/src/trap.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 trap.c $NHDT-Date: 1426558928 2015/03/17 02:22:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.195 $ */ +/* 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. */ @@ -3145,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. @@ -3157,8 +3165,6 @@ struct obj *obj; const char *ostr; boolean force; { - boolean exploded = FALSE; - if (!obj) return ER_NOTHING; if (snuff_lit(obj)) @@ -3203,18 +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| 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| &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; + if (acid_ctx.ctx_valid) { + if (obj->dknown) + acid_ctx.dkn_boom++; + else + acid_ctx.unk_boom++; + } setnotworn(obj); delobj(obj); if (update) @@ -3246,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; } /* From 2ec4ff0b8c35be3f4a44b4928ee72199df46a40c Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Fri, 20 Mar 2015 19:25:19 +0200 Subject: [PATCH 21/49] Fix C343-108 (e- leaves prompt on screen) You'll get "You mime eating something." --- include/extern.h | 1 + src/hacklib.c | 33 +++++++++++++++++++++++++++++++++ src/invent.c | 10 +++++++++- 3 files changed, 43 insertions(+), 1 deletion(-) diff --git a/include/extern.h b/include/extern.h index 23d10d324..1ba3e110f 100644 --- a/include/extern.h +++ b/include/extern.h @@ -813,6 +813,7 @@ E void FDECL(copynchars, (char *,const char *,int)); E char FDECL(chrcasecpy, (int,int)); E char *FDECL(strcasecpy, (char *,const char *)); E char *FDECL(s_suffix, (const char *)); +E char *FDECL(ing_suffix, (const char *)); E char *FDECL(xcrypt, (const char *,char *)); E boolean FDECL(onlyspace, (const char *)); E char *FDECL(tabexpand, (char *)); diff --git a/src/hacklib.c b/src/hacklib.c index fd4273074..005aa02b9 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -235,6 +235,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; diff --git a/src/invent.c b/src/invent.c index 24213c7e3..66e7e7307 100644 --- a/src/invent.c +++ b/src/invent.c @@ -972,7 +972,15 @@ register const char *let,*word; return((struct obj *)0); } if(ilet == '-') { - return(allownone ? &zeroobj : (struct obj *) 0); + if (!allownone) { + strcpy(buf, word); + if ((bp = strstr(buf, " or ")) != NULL) { + *bp = '\0'; + bp = (rn2(2) ? buf : (bp + 4)); + } else bp = buf; + You("mime %s something.", ing_suffix(bp)); + } + return(allownone ? &zeroobj : (struct obj *) 0); } if(ilet == def_oc_syms[COIN_CLASS].sym) { if (!usegold) { From 66d642fad92368e8b8a7fb3f6fb42357845db5fa Mon Sep 17 00:00:00 2001 From: nhmall Date: Fri, 20 Mar 2015 22:06:28 -0400 Subject: [PATCH 22/49] more mswin cmdline Makefile tweaks --- sys/winnt/Makefile.msc | 223 +++++++++++++---------------------------- 1 file changed, 70 insertions(+), 153 deletions(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 4be6dd3ab..0216092cc 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -13,8 +13,10 @@ # #============================================================================== # This is used for building two versions of NetHack: +# # A tty port utilizing the Win32 Console I/O subsystem, Console # NetHack; +# # A Win32 native port built on the Windows API, Graphical NetHack or # NetHackW. # @@ -186,38 +188,11 @@ guilibs = $(winlibs) # Exe File Info. #========================================== -# Yacc/Lex ... if you got 'em. # -# If you have yacc and lex programs (or work-alike such as bison -# and flex), comment out the upper two macros and uncomment -# the lower two. -# - -DO_YACC = YACC_MSG -DO_LEX = LEX_MSG -#DO_YACC = YACC_ACT -#DO_LEX = LEX_ACT - -# - Specify your yacc and lex programs (or work-alikes) here. - -#YACC = bison -y -YACC = byacc -#YACC = yacc - -#LEX = lex -LEX = flex - -# -# - Specify your flex skeleton file (if needed). -# - -FLEXSKEL = -#FLEXSKEL = -S../tools/flex.ske - -YTABC = y_tab.c -YTABH = y_tab.h -LEXYYC = lexyy.c - +# For the level compiler bits, +# we just defer to win\win32\dgnstuff.mak +# and win\win32\levstuff.mak +# # # Optional high-quality BSD random number generation routines # (see pcconf.h). Set to nothing if not used. @@ -305,9 +280,6 @@ PDBFILE= /PDB:"$(O)$(GAME).PDB" MAPFILE= /MAP:"$(O)$(GAME).MAP" INCLDIR= /I..\include -ldebug=/DEBUG -cdebug = -Zi -Od - !IF ("$(ldebug)" != "") !IF ("$(ldebug)" != "/RELEASE") ldebug = /DEBUG @@ -344,14 +316,14 @@ LIBS= user32.lib winmm.lib $(ZLIB) !IF ("$(GRAPHICAL)"=="Y") cflagsGame = $(cdebug) $(cflags2) $(guiflags) $(INCLDIR) \ - $(WINPFLAG) $(DLBFLG) -lflagsGame = $(ldebug) $(lflags) $(guilibs) $(GAMEPDBFILE) $(GAMEMAPFILE) + $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) +lflagsGame = $(ldebug) $(lflags) $(guilibs) !ELSE cflagsGame = $(cdebug) $(cflags2) $(conflags) $(INCLDIR) \ - $(WINPFLAG) $(DLBFLG) -lflagsGame = $(ldebug) $(lflags) $(conlibs) $(GAMEPDBFILE) $(GAMEMAPFILE) + $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) +lflagsGame = $(ldebug) $(lflags) $(conlibs) !ENDIF @@ -454,19 +426,20 @@ U = $(UTIL)^\ MAKESRC = $(U)makedefs.c -SPLEVSRC = $(U)lev_yacc.c $(U)lev_$(LEX).c $(U)lev_main.c $(U)panic.c - -DGNCOMPSRC = $(U)dgn_yacc.c $(U)dgn_$(LEX).c $(U)dgn_main.c - MAKEOBJS = $(O)makedefs.o $(O)monst.o $(O)objects.o -SPLEVOBJS = $(O)lev_yacc.o $(O)lev_$(LEX).o $(O)lev_main.o \ +#SPLEVOBJS = $(O)lev_yacc.o $(O)lev_lex.o $(O)lev_main.o \ +# $(O)alloc.o $(O)decl.o $(O)drawing.o \ +# $(O)monst.o $(O)objects.o $(O)panic.o + +SPLEVOBJS = $(O)lev_yacc.o $(O)lev_lex.o $(O)lev_main.o \ $(O)alloc.o $(O)decl.o $(O)drawing.o \ $(O)monst.o $(O)objects.o $(O)panic.o -DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_$(LEX).o $(O)dgn_main.o \ +DGNCOMPOBJS = $(O)dgn_yacc.o $(O)dgn_lex.o $(O)dgn_main.o \ $(O)alloc.o $(O)panic.o + RECOVOBJS = $(O)recover.o TILEFILES = $(WSHR)\monsters.txt $(WSHR)\objects.txt $(WSHR)\other.txt @@ -610,7 +583,6 @@ all : install install: envchk $(GAME) $(O)install.tag @echo Done. - $(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \ $(DAT)\oracles $(DAT)\quest.dat $(O)sp_lev.tag $(DLB) ! IF ("$(USE_DLB)"=="Y") @@ -845,11 +817,11 @@ $(SRC)\vis_tab.c: $(U)makedefs.exe $(U)makedefs -z $(DAT)\engrave: $(DAT)\engrave.txt $(U)makedefs.exe - ../util/makedefs -s + ..\util\makedefs -s $(DAT)\epitaph: $(DAT)\epitaph.txt $(U)makedefs.exe - ../util/makedefs -s + ..\util\makedefs -s $(DAT)\bogusmon: $(DAT)\bogusmon.txt $(U)makedefs.exe - ../util/makedefs -s + ..\util\makedefs -s #========================================== @@ -902,71 +874,55 @@ $(WIN32)\splash.bmp: $(U)uudecode.exe $(WIN32)\splash.uu ..\..\util\uudecode.exe splash.uu chdir ..\..\src -#========================================== +#================================================= # Level Compiler Stuff -#========================================== +#================================================= +# +# defer to the steps in ..\win\win32\levstuff.mak +# -LEVCFLAGS=-c -nologo -DWINVER=0x0400 -DWIN32 -D_WIN32 \ - -D_MT -MT -I..\include -nologo -Z7 -Od -DDLB +$(U)lev_yacc.c $(INCL)\lev_comp.h: $(U)lev_comp.y + nmake -nologo -f ..\win\win32\levstuff.mak default + +LEVCFLAGS=-c -nologo -DWIN32 -D_WIN32 -I$(INCL) -nologo -Z7 -Od -DDLB + +$(O)lev_yacc.o: $(HACK_H) $(SP_LEV_H) $(INCL)\lev_comp.h $(U)lev_yacc.c + $(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_yacc.c + +$(O)lev_lex.o: $(HACK_H) $(INCL)\lev_comp.h $(SP_LEV_H) \ + $(U)lev_lex.c + $(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_lex.c + +$(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H) + $(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_main.c $(U)levcomp.exe: $(SPLEVOBJS) @echo Linking $@... - @$(link) $(lflagsUtil) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk + echo $(link) + echo $(lflagsUtil) + $(link) $(lflagsUtil) /PDB:"$(O)$(@B).PDB" /MAP:"$(O)$(@B).MAP" -out:$@ @<<$(@B).lnk $(SPLEVOBJS:^ =^ ) << -$(O)lev_yacc.o: $(HACK_H) $(SP_LEV_H) $(INCL)\lev_comp.h $(U)lev_yacc.c - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_yacc.c - -$(O)lev_$(LEX).o: $(HACK_H) $(INCL)\lev_comp.h $(SP_LEV_H) \ - $(U)lev_$(LEX).c - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_$(LEX).c - -$(O)lev_main.o: $(U)lev_main.c $(HACK_H) $(SP_LEV_H) - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)lev_main.c - - -$(U)lev_yacc.c $(INCL)\lev_comp.h : $(U)lev_comp.y -! IF "$(DO_YACC)"=="YACC_ACT" - chdir $(UTIL) - $(YACC) -d lev_comp.y - copy $(YTABC) lev_yacc.c - copy $(YTABH) $(INCL)\lev_comp.h - @del $(YTABC) - @del $(YTABH) - chdir $(SRC) -! ELSE - @echo $(U)lev_comp.y has changed. - @echo To update $(U)lev_yacc.c and $(INCL)\lev_comp.h run $(YACC). - @echo --- - @echo For now, we will copy the prebuilt lev_yacc.c and - @echo lev_comp.h from $(SSYS) into $(UTIL) and use them. - @copy $(SSYS)\lev_yacc.c $(U)lev_yacc.c >nul - @copy $(SSYS)\lev_comp.h $(INCL)\lev_comp.h >nul - @echo /**/ >>$(U)lev_yacc.c - @echo /**/ >>$(INCL)\lev_comp.h -! ENDIF - -$(U)lev_$(LEX).c: $(U)lev_comp.l -! IF "$(DO_LEX)"=="LEX_ACT" - chdir $(UTIL) - $(LEX) $(FLEXSKEL) lev_comp.l - copy $(LEXYYC) $@ - @del $(LEXYYC) - chdir $(SRC) -! ELSE - @echo $(U)lev_comp.l has changed. To update $@ run $(LEX). - @echo --- - @echo For now, we will copy the prebuilt lev_lex.c - @echo from $(SSYS) into $(UTIL) and use it. - @copy $(SSYS)\lev_lex.c $@ >nul - @echo /**/ >>$@ -! ENDIF - -#========================================== +#================================================= # Dungeon Compiler Stuff -#========================================== +#================================================= +# +# defer to the steps in ..\win\win32\dgnstuff.mak +# +$(U)dgn_yacc.c $(INCL)\dgn_comp.h : $(U)dgn_comp.y + nmake -nologo -f ..\win\win32\dgnstuff.mak default + +$(O)dgn_yacc.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h $(U)dgn_yacc.c + @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_yacc.c + +$(O)dgn_lex.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h \ + $(U)dgn_lex.c + @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_lex.c + +$(O)dgn_main.o: $(HACK_H) $(U)dgn_main.c + @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_main.c $(U)dgncomp.exe: $(DGNCOMPOBJS) @echo Linking $@... @@ -975,56 +931,9 @@ $(U)dgncomp.exe: $(DGNCOMPOBJS) ) << -$(O)dgn_yacc.o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h $(U)dgn_yacc.c - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_yacc.c - -$(O)dgn_$(LEX).o: $(HACK_H) $(DGN_FILE_H) $(INCL)\dgn_comp.h \ - $(U)dgn_$(LEX).c - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_$(LEX).c - -$(O)dgn_main.o: $(HACK_H) $(U)dgn_main.c - @$(CC) $(LEVCFLAGS) -W0 -Fo$@ $(U)dgn_main.c - -$(U)dgn_yacc.c $(INCL)\dgn_comp.h : $(U)dgn_comp.y -! IF "$(DO_YACC)"=="YACC_ACT" - chdir $(UTIL) - $(YACC) -d dgn_comp.y - copy $(YTABC) dgn_yacc.c - copy $(YTABH) $(INCL)\dgn_comp.h - @del $(YTABC) - @del $(YTABH) - chdir $(SRC) -! ELSE - @echo $(U)dgn_comp.y has changed. To update dgn_yacc.c and - @echo $(INCL)\dgn_comp.h run $(YACC). - @echo --- - @echo For now, we will copy the prebuilt $(U)dgn_yacc.c and - @echo dgn_comp.h from $(SSYS) into $(UTIL) and use them. - @copy $(SSYS)\dgn_yacc.c $(U)dgn_yacc.c >nul - @copy $(SSYS)\dgn_comp.h $(INCL)\dgn_comp.h >nul - @echo /**/ >>$(U)dgn_yacc.c - @echo /**/ >>$(INCL)\dgn_comp.h -! ENDIF - -$(U)dgn_$(LEX).c: $(U)dgn_comp.l -! IF "$(DO_LEX)"=="LEX_ACT" - chdir $(UTIL) - $(LEX) $(FLEXSKEL) dgn_comp.l - copy $(LEXYYC) $@ - @del $(LEXYYC) - chdir $(SRC) -! ELSE - @echo $(U)dgn_comp.l has changed. To update $@ run $(LEX). - @echo --- - @echo For now, we will copy the prebuilt dgn_lex.c - @echo from $(SSYS) into $(UTIL) and use it. - @copy $(SSYS)\dgn_lex.c $@ >nul - @echo /**/ >>$@ -! ENDIF - -#========================================== +#================================================= # Create directory for holding object files -#========================================== +#================================================= $(O)obj.tag: @if not exist $(OBJ)\*.* echo creating directory $(OBJ) @@ -1062,7 +971,7 @@ envchk: #========================================== #=========================================== -# Header files NOT distributed in ..\include +# Header files NOT distributed in $(INCL) #=========================================== $(INCL)\win32api.h: $(NTSYS)\win32api.h @@ -1339,6 +1248,14 @@ clean: if exist $(O)sp_lev.tag del $(O)sp_lev.tag if exist $(O)uudecode.MAP del $(O)uudecode.MAP if exist $(O)uudecode.PDB del $(O)uudecode.PDB + rem + rem defer to the steps in ..\win\win32\levstuff.mak + rem + nmake -nologo -f ..\win\win32\levstuff.mak clean + rem + rem defer to the steps in ..\win\win32\dgnstuff.mak + rem + nmake -nologo -f ..\win\win32\dgnstuff.mak clean ! IF ("$(WINPFLAG)"!="") if exist $(TILEBMP16) del $(TILEBMP16) From 3434a157f816de2c9b47eb3360ff93f763081708 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 21 Mar 2015 11:03:54 +0200 Subject: [PATCH 23/49] More C343-108: Handle "rub on the stone" --- src/invent.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/invent.c b/src/invent.c index 66e7e7307..12f0ef1b3 100644 --- a/src/invent.c +++ b/src/invent.c @@ -973,12 +973,18 @@ register const char *let,*word; } if(ilet == '-') { 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.", ing_suffix(bp)); + You("mime %s something%s%s.", ing_suffix(bp), + suf ? " " : "", suf ? suf : ""); } return(allownone ? &zeroobj : (struct obj *) 0); } From 6fcc030f37c07aacef9251ad62b2f91fecfe8f0c Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 21 Mar 2015 13:40:07 +0200 Subject: [PATCH 24/49] Make HoOA alignment change depend on object ID The same Helm of opposite alignment will always make the same alignment change for neutrals. --- src/do_wear.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/do_wear.c b/src/do_wear.c index 9925ceaf0..39d3b6c3f 100644 --- a/src/do_wear.c +++ b/src/do_wear.c @@ -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: From e3eb74166fc238a55e8c1dcc0332155855b7ce92 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 21 Mar 2015 10:46:11 -0400 Subject: [PATCH 25/49] obj change to support some upcoming work This is an enabling patch for upcoming work. It breaks save/bones so editlevel is incremented. I'd like to a second overloadable int field in struct obj, instead of just the one that is typically overloaded - corpsenm. The second one can be used for things that are being tallied up as opposed to a static one time assignment for reference/linkage purposes. The differentiation will allow both uses to co-exist for the same object. --- include/obj.h | 5 +++-- include/patchlevel.h | 6 +++--- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/include/obj.h b/include/obj.h index f4fd78007..7af927919 100644 --- a/include/obj.h +++ b/include/obj.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 obj.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 obj.h $NHDT-Date: 1426949157 2015/03/21 14:45:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.36 $ */ /* NetHack 3.5 obj.h $Date: 2012/01/10 17:47:16 $ $Revision: 1.31 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -107,9 +107,10 @@ struct obj { int corpsenm; /* type of corpse is mons[corpsenm] */ #define leashmon corpsenm /* gets m_id of attached pet */ -#define spestudied corpsenm /* # of times a spellbook has been studied */ #define fromsink corpsenm /* a potion from a sink */ #define record_achieve_special corpsenm + int usecount; /* overloaded for various things that tally */ +#define spestudied usecount /* # of times a spellbook has been studied */ unsigned oeaten; /* nutrition left in food, if partly eaten */ long age; /* creation date */ long owornmask; diff --git a/include/patchlevel.h b/include/patchlevel.h index 02b8b3bfa..eab90e89f 100644 --- a/include/patchlevel.h +++ b/include/patchlevel.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 patchlevel.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 patchlevel.h $NHDT-Date: 1426948844 2015/03/21 14:40:44 $ $NHDT-Branch: master $:$NHDT-Revision: 1.95 $ */ /* NetHack 3.5 patchlevel.h $Date: 2012/04/14 08:31:03 $ $Revision: 1.93 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -14,10 +14,10 @@ * Incrementing EDITLEVEL can be used to force invalidation of old bones * and save files. */ -#define EDITLEVEL 57 +#define EDITLEVEL 58 #define COPYRIGHT_BANNER_A \ -"NetHack, Copyright 1985-2012" +"NetHack, Copyright 1985-2015" #define COPYRIGHT_BANNER_B \ " By Stichting Mathematisch Centrum and M. Stephenson." /* COPYRIGHT_BANNER_C is generated by makedefs into date.h */ From c9df82fb42aa95c2b1c220c28197953c68725825 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Sat, 21 Mar 2015 16:49:31 +0200 Subject: [PATCH 26/49] Update hacklib func comment doc --- src/hacklib.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/hacklib.c b/src/hacklib.c index 005aa02b9..1c091b8f6 100644 --- a/src/hacklib.c +++ b/src/hacklib.c @@ -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 *) From 41ac4aef9272d17525c19fe91d118d210ece05ac Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 21 Mar 2015 15:38:31 -0400 Subject: [PATCH 27/49] fix SYSCF so that things build when first defined Things won't build for ports that first define SYSCF. This moves assure_syscf_file() from unixmain.c to files.c and adjusts extern.h to get it out from under #ifdef UNIX. The call to assure_syscf_file() in options.c was only #ifdef SYSCF, SYSCF_FILE and not UNIX, so new ports #defining SYSCF would get an erro. assure_syscf_file() will be utilized by mswin when SYSCF is defined. --- include/extern.h | 8 ++++---- include/ntconf.h | 5 ++++- src/files.c | 25 ++++++++++++++++++++++++- sys/share/pcmain.c | 7 +++++-- sys/unix/unixmain.c | 18 +----------------- 5 files changed, 38 insertions(+), 25 deletions(-) diff --git a/include/extern.h b/include/extern.h index 1ba3e110f..da9bf7eff 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 extern.h $NHDT-Date: 1426496453 2015/03/16 09:00:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.407 $ */ +/* NetHack 3.5 extern.h $NHDT-Date: 1426966688 2015/03/21 19:38:08 $ $NHDT-Branch: master $:$NHDT-Revision: 1.411 $ */ /* NetHack 3.5 extern.h $Date: 2013/11/05 00:57:53 $ $Revision: 1.380 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -739,6 +739,9 @@ E void FDECL(free_saved_games, (char**)); #ifdef SELF_RECOVER E boolean NDECL(recover_savefile); #endif +#ifdef SYSCF_FILE +E void NDECL(assure_syscf_file); +#endif #ifdef HOLD_LOCKFILE_OPEN E void NDECL(really_close); #endif @@ -2288,9 +2291,6 @@ E void NDECL(port_help); E void FDECL(sethanguphandler, (void (*)(int))); E boolean NDECL(authorize_wizard_mode); E boolean FDECL(check_user_string, (char *)); -# ifdef SYSCF_FILE -E void NDECL(assure_syscf_file); -# endif #endif /* UNIX */ /* ### unixtty.c ### */ diff --git a/include/ntconf.h b/include/ntconf.h index 95a506635..b51459151 100644 --- a/include/ntconf.h +++ b/include/ntconf.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 ntconf.h $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 ntconf.h $NHDT-Date: 1426966690 2015/03/21 19:38:10 $ $NHDT-Branch: master $:$NHDT-Revision: 1.37 $ */ /* NetHack 3.5 ntconf.h $Date: 2012/01/15 19:11:38 $ $Revision: 1.35 $ */ /* SCCS Id: @(#)ntconf.h 3.5 2002/03/10 */ /* Copyright (c) NetHack PC Development Team 1993, 1994. */ @@ -25,6 +25,9 @@ #define SELF_RECOVER /* Allow the game itself to recover from an aborted game */ +#define SYSCF /* Use a global configuration */ +#define SYSCF_FILE "sysconf" /* Use a file to hold the SYSCF configuration */ + #define USER_SOUNDS #ifdef WIN32CON diff --git a/src/files.c b/src/files.c index a6f17b906..e85a85ae4 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 files.c $NHDT-Date: 1426544796 2015/03/16 22:26:36 $ $NHDT-Branch: master $:$NHDT-Revision: 1.134 $ */ +/* NetHack 3.5 files.c $NHDT-Date: 1426966692 2015/03/21 19:38:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.135 $ */ /* 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. */ @@ -3199,6 +3199,29 @@ 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 diff --git a/sys/share/pcmain.c b/sys/share/pcmain.c index 6635c56ad..67ae57dba 100644 --- a/sys/share/pcmain.c +++ b/sys/share/pcmain.c @@ -1,9 +1,9 @@ -/* NetHack 3.5 pcmain.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 pcmain.c $NHDT-Date: 1426966701 2015/03/21 19:38:21 $ $NHDT-Branch: master $:$NHDT-Revision: 1.51 $ */ /* NetHack 3.5 pcmain.c $Date: 2012/01/20 03:41:31 $ $Revision: 1.48 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ -/* main.c - MSDOS, OS/2, ST, Amiga, and NT NetHack */ +/* main.c - MSDOS, OS/2, ST, Amiga, and Windows NetHack */ #include "hack.h" #include "dlb.h" @@ -244,6 +244,9 @@ char *argv[]; #if defined(CHDIR) && !defined(NOCWD_ASSUMPTIONS) chdirx(hackdir,0); +#endif +#ifdef SYSCF + initoptions(); #endif prscore(argc, argv); nethack_exit(EXIT_SUCCESS); diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index c470dc6e0..f7f1ac87e 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 unixmain.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 unixmain.c $NHDT-Date: 1426966705 2015/03/21 19:38:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */ /* NetHack 3.5 unixmain.c $Date: 2012/01/27 20:15:31 $ $Revision: 1.42 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -648,20 +648,4 @@ get_unix_pw() return pw; } -#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 /*unixmain.c*/ From 734d118d39c3fca6b3267e2ade39601c285631db Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 21 Mar 2015 15:50:03 -0400 Subject: [PATCH 28/49] a sys/winnt/Makefile.msc update --- sys/winnt/Makefile.msc | 92 ++++++++++++++++++++++-------------------- 1 file changed, 49 insertions(+), 43 deletions(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index 0216092cc..a1dfdbcd8 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -1,4 +1,4 @@ -# NetHack 3.5 Makefile.msc $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +# NetHack 3.5 Makefile.msc $NHDT-Date: 1426967393 2015/03/21 19:49:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.72 $ */ # Copyright (c) NetHack PC Development Team 1993-2015 # #============================================================================== @@ -79,6 +79,13 @@ TARGET_CPU=x86 GAMEDIR = ..\binary # Game directory +# +#--------------------------------------------------------------- +# 4. Do you want debug information in the executable? +# + +DEBUGINFO = Y + # This marks the end of the BUILD DECISIONS section. #============================================================================== # @@ -111,7 +118,7 @@ DOC = ..\doc # NetHack documentation files UTIL = ..\util # Utility source SRC = ..\src # Main source SSYS = ..\sys\share # Shared system files -NTSYS = ..\sys\winnt # NT Win32 specific files +MSWSYS= ..\sys\winnt # mswin specific files TTY = ..\win\tty # window port files (tty) WIN32 = ..\win\win32 # window port files (Win32) WSHR = ..\win\share # Tile support files @@ -144,7 +151,7 @@ TARGET_CPU=x86 # -Zd - generate only public symbols and line numbers for debugging # -GS - enable security checks # -ccommon=-c -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -c +ccommon=-c $(CDBFLAG) -DCRTAPI1=_cdecl -DCRTAPI2=_cdecl -nologo -GS -c lflags=/INCREMENTAL:NO /NOLOGO !IF "$(TARGET_CPU)" == "x86" @@ -201,18 +208,6 @@ guilibs = $(winlibs) RANDOM = $(OBJ)\random.o #RANDOM = -# -# Uncomment the next 2 lines _ONLY_ if you DO NOT want any -# debug capability in the object files, or in the NetHack executable. -# Comment them if you want debug capability. - -#ldebug = -#cdebug = - -# -# Compiler and Linker flags -# - PRECOMPHEAD = N # set to Y if you want to use precomp. headers # @@ -276,10 +271,20 @@ DLBFLG = #========================================== #========================================== -PDBFILE= /PDB:"$(O)$(GAME).PDB" -MAPFILE= /MAP:"$(O)$(GAME).MAP" INCLDIR= /I..\include +!IF "$(DEBUGINFO)" == "Y" +CDBGFLAG=-Zi +LDBGFLAG=/debug +cdebug = -Zi -Od +ldebug = /DEBUG +!ELSE +CDBGFLAG= +LDBGFLAG= +ldebug = +cdebug = +!ENDIF + !IF ("$(ldebug)" != "") !IF ("$(ldebug)" != "/RELEASE") ldebug = /DEBUG @@ -316,14 +321,14 @@ LIBS= user32.lib winmm.lib $(ZLIB) !IF ("$(GRAPHICAL)"=="Y") cflagsGame = $(cdebug) $(cflags2) $(guiflags) $(INCLDIR) \ - $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) -lflagsGame = $(ldebug) $(lflags) $(guilibs) + $(WINPFLAG) $(DLBFLG) +lflagsGame = $(ldebug) $(lflags) $(guilibs) $(GAMEPDBFILE) $(GAMEMAPFILE) !ELSE cflagsGame = $(cdebug) $(cflags2) $(conflags) $(INCLDIR) \ - $(WINPFLAG) $(DLBFLG) $(GAMEPDBFILE) $(GAMEMAPFILE) -lflagsGame = $(ldebug) $(lflags) $(conlibs) + $(WINPFLAG) $(DLBFLG) +lflagsGame = $(ldebug) $(lflags) $(conlibs) $(GAMEPDBFILE) $(GAMEMAPFILE) !ENDIF @@ -362,10 +367,10 @@ DLB = # Rules for files in sys\winnt #========================================== -{$(NTSYS)}.c{$(OBJ)}.o: +{$(MSWSYS)}.c{$(OBJ)}.o: @$(CC) $(cflagsUtil) -Fo$@ $< -{$(NTSYS)}.h{$(INCL)}.h: +{$(MSWSYS)}.h{$(INCL)}.h: @copy $< $@ #========================================== @@ -410,7 +415,7 @@ DLB = # referenced later on in the Makefile. # -DEFFILE = $(NTSYS)\$(GAME).def +DEFFILE = $(MSWSYS)\$(GAME).def # # Shorten up the location for some files @@ -595,15 +600,16 @@ $(O)install.tag: $(DAT)\data $(DAT)\rumors $(DAT)\dungeon \ copy $(DAT)\*.lev $(GAMEDIR) if exist $(GAMEDIR)\makefile del $(GAMEDIR)\makefile ! ENDIF + if not exist $(GAMEDIR)\sysconf copy $(MSWSYS)\sysconf $(GAMEDIR) if exist $(DAT)\symbols copy $(DAT)\symbols $(GAMEDIR) if exist $(DOC)\guidebook.txt copy $(DOC)\guidebook.txt $(GAMEDIR)\Guidebook.txt if exist $(DOC)\nethack.txt copy $(DOC)\nethack.txt $(GAMEDIR)\NetHack.txt @if exist $(O)$(GAME).PDB copy $(O)$(GAME).pdb $(GAMEDIR)\$(GAME).pdb @if exist $(GAMEDIR)\$(GAME).PDB echo NOTE: You may want to remove $(GAMEDIR)\$(GAME).pdb to conserve space - -copy $(NTSYS)\defaults.nh $(GAMEDIR)\defaults.nh + -copy $(MSWSYS)\defaults.nh $(GAMEDIR)\defaults.nh echo install done > $@ -# copy $(NTSYS)\winnt.hlp $(GAMEDIR) +# copy $(MSWSYS)\winnt.hlp $(GAMEDIR) recover: $(U)recover.exe if exist $(U)recover.exe copy $(U)recover.exe $(GAMEDIR) @@ -662,8 +668,8 @@ $(NHRES): $(TILEBMP16) $(WIN32)\winhack.rc $(WIN32)\mnsel.bmp \ $(WIN32)\splash.bmp @$(rc) -r -fo$@ -i$(WIN32) -dNDEBUG $(WIN32)\winhack.rc !ELSE -$(NHRES): $(NTSYS)\console.rc $(NTSYS)\NetHack.ico - @$(rc) -r -fo$@ -i$(NTSYS) -dNDEBUG $(NTSYS)\console.rc +$(NHRES): $(MSWSYS)\console.rc $(MSWSYS)\NetHack.ico + @$(rc) -r -fo$@ -i$(MSWSYS) -dNDEBUG $(MSWSYS)\console.rc !ENDIF #========================================== @@ -834,12 +840,12 @@ $(U)uudecode.exe: $(O)uudecode.o $(O)uudecode.o: $(SSYS)\uudecode.c @$(CC) $(cflagsUtil) /D_CRT_SECURE_NO_DEPRECATE -Fo$@ $(SSYS)\uudecode.c -$(NTSYS)\NetHack.ico : $(U)uudecode.exe $(NTSYS)\nhico.uu - chdir $(NTSYS) +$(MSWSYS)\NetHack.ico : $(U)uudecode.exe $(MSWSYS)\nhico.uu + chdir $(MSWSYS) ..\..\util\uudecode.exe nhico.uu chdir ..\..\src -$(WIN32)\NetHack.ico : $(U)uudecode.exe $(NTSYS)\nhico.uu +$(WIN32)\NetHack.ico : $(U)uudecode.exe $(MSWSYS)\nhico.uu chdir $(WIN32) ..\..\util\uudecode.exe ../../sys/winnt/nhico.uu chdir ..\..\src @@ -974,8 +980,8 @@ envchk: # Header files NOT distributed in $(INCL) #=========================================== -$(INCL)\win32api.h: $(NTSYS)\win32api.h - copy $(NTSYS)\win32api.h $@ +$(INCL)\win32api.h: $(MSWSYS)\win32api.h + copy $(MSWSYS)\win32api.h $@ #========================================== @@ -996,8 +1002,8 @@ $(O)dlb.o: $(O)dlb_main.o $(O)alloc.o $(O)panic.o $(INCL)\dlb.h $(O)dlb_main.o: $(UTIL)\dlb_main.c $(INCL)\config.h $(INCL)\dlb.h @$(CC) $(cflagsUtil) /Fo$@ $(UTIL)\dlb_main.c -$(DAT)\porthelp: $(NTSYS)\porthelp - @copy $(NTSYS)\porthelp $@ >nul +$(DAT)\porthelp: $(MSWSYS)\porthelp + @copy $(MSWSYS)\porthelp $@ >nul nhdat: $(U)dlb_main.exe $(DAT)\data $(DAT)\oracles $(OPTIONS_FILE) \ $(DAT)\quest.dat $(DAT)\rumors $(DAT)\help $(DAT)\hh $(DAT)\cmdhelp \ @@ -1292,14 +1298,14 @@ $(DAT)\dungeon: $(O)utility.tag $(DAT)\dungeon.def # NT dependencies # -$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nttty.c - @$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(NTSYS)\nttty.c -$(O)nhkeys.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(NTSYS)\nhkeys.c - @$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(NTSYS)\nhkeys.c -$(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(NTSYS)\winnt.c - @$(CC) $(cflagsUtil) -Fo$@ $(NTSYS)\winnt.c -$(O)ntsound.o: $(HACK_H) $(NTSYS)\ntsound.c - @$(CC) $(cflagsUtil) -Fo$@ $(NTSYS)\ntsound.c +$(O)nttty.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(MSWSYS)\nttty.c + @$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(MSWSYS)\nttty.c +$(O)nhkeys.o: $(HACK_H) $(TILE_H) $(INCL)\win32api.h $(MSWSYS)\nhkeys.c + @$(CC) $(cflagsUtil) -I$(WSHR) -Fo$@ $(MSWSYS)\nhkeys.c +$(O)winnt.o: $(HACK_H) $(INCL)\win32api.h $(MSWSYS)\winnt.c + @$(CC) $(cflagsUtil) -Fo$@ $(MSWSYS)\winnt.c +$(O)ntsound.o: $(HACK_H) $(MSWSYS)\ntsound.c + @$(CC) $(cflagsUtil) -Fo$@ $(MSWSYS)\ntsound.c # # util dependencies From b8515fb5fdbb8efe4d8db4bcfe35dfe454f2ef3e Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 21 Mar 2015 15:54:30 -0400 Subject: [PATCH 29/49] throw in a windows sysconf skeleton --- sys/winnt/sysconf | 78 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sys/winnt/sysconf diff --git a/sys/winnt/sysconf b/sys/winnt/sysconf new file mode 100644 index 000000000..67c0b814d --- /dev/null +++ b/sys/winnt/sysconf @@ -0,0 +1,78 @@ +# +# NetHack 3.5 sysconf $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ +# NetHack 3.5 sysconf $Date: 2012/01/27 20:15:31 $ $Revision: 1.6 $ +# +# Sample sysconf file. +# The sysconf file is only used if NetHack is compiled with SYSCF defined. +# This file uses the same syntax as nethack.cf. + +# Which users can use WIZARD (debugging) mode (the -D flag). +# A value of * allows anyone to enter debugging mode. +WIZARDS=* + +# Users allowed to use the ! (shell escape) command or to suspend the game. +# Uses the same syntax as the WIZARDS option above. +#SHELLERS= + +# Show debugging information originating from these source files. +# Use '*' for all, or list source files separated by spaces. +# Only available if game has been compiled with DEBUG. +#DEBUGFILES=* + +# Limit the number of simultaneous games (see also nethack.sh). +#MAXPLAYERS=10 + +# If not null, added to string "To get local support, " in the support +# information help. +#SUPPORT=call Izchak at extension 42. + +# Uncomment the next line to disable the SEDUCE option. +#SEDUCE=0 + +# Record (high score) file options. +# CAUTION: changing these after people have started playing games can +# lead to lost high scores! +# Maximum entries for one person. +#PERSMAX=10 +# Maximum entries in the record file. +#ENTRYMAX=100 +# Minimum points to get an entry. +#POINTSMIN=1 +# Determine identity of "person" in the score file with name (0) or +# numeric (1) user id. +#PERS_IS_UID=1 + +# Maximum number of score file entries to use for random statue names +#MAX_STATUENAME_RANK=10 + +# *** LOCATIONS *** +# IMPORTANT: If you change any of these locations, the directories they +# point at must exist. NetHack will not create them for you. +# +# HACKDIR is the default location for everything. +# Note: On Windows HACKDIR defaults to the location +# of the NetHack.exe or NetHackw.exe file so +# setting HACKDIR below to override that is +# not usually necessary or recommended. +#HACKDIR=c:\games\nethack +# +# The location that users can adjust their config file startup options +#CONFIGDIR=c:\games\nethack +# +# The location that level files in progress are stored (default=HACKDIR, writeable) +#LEVELDIR=c:\nethack\levels +# +# The location where saved games are kept (default=HACKDIR, writeable) +#SAVEDIR=c:\nethack\save +# +# The location that bones files are kept (default=HACKDIR, writeable) +#BONESDIR=c:\nethack\save +# +# The location that file synchronization locks are stored (default=HACKDIR, writeable) +#LOCKDIR=c:\nethack\levels +# +# The location that a record of game aborts and self-diagnosed game problems +# is kept (default=HACKDIR, writeable) +#TROUBLEDIR=c:\nethack\trouble + + From 349e264ac3eccab996cc065867cd2808785d9e32 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 21 Mar 2015 16:01:03 -0400 Subject: [PATCH 30/49] remove a troublesome line of code Whenever SYSCF was enabled on Windows, the option processing would go bonkers with illegal options at startup. I noticed it months ago, and Derek had it happen the other evening. It turns out, the hard-coded 'defaults.nh' setting was being overwritten with the name sysconf on the first SET_IN_SYS pass, so all subsequent passes were re-opening the SYSC_FILE instead of the user config file. I opted to take it out as I couldn't ascertain why it was there in the first place. --- src/files.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/files.c b/src/files.c index e85a85ae4..eeebd6e08 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 files.c $NHDT-Date: 1426966692 2015/03/21 19:38:12 $ $NHDT-Branch: master $:$NHDT-Revision: 1.135 $ */ +/* NetHack 3.5 files.c $NHDT-Date: 1426968058 2015/03/21 20:00:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.136 $ */ /* 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. */ @@ -1858,7 +1858,6 @@ int src; } else #endif if ((fp = fopenp(filename, "r")) != (FILE *)0) { - configfile = filename; return(fp); #if defined(UNIX) || defined(VMS) } else { From af9af8b7018f481588098974872b887bd8ad63cc Mon Sep 17 00:00:00 2001 From: nhmall Date: Sat, 21 Mar 2015 16:17:17 -0400 Subject: [PATCH 31/49] put mystery line back but !WIN32 Since that line of code is used by a lot of different ports, I decided to recant its removal and just add #ifdef to ensure it isn't compiled on WIN32. I think other ports might encounter the same issue where the first pass with filename set to 'sysconf', is then going to overwrite the hard-coded user config file name, but I can't fix or test those so for those ports, it will be now be back the way it was. --- src/files.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/files.c b/src/files.c index eeebd6e08..b9942246a 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 files.c $NHDT-Date: 1426968058 2015/03/21 20:00:58 $ $NHDT-Branch: master $:$NHDT-Revision: 1.136 $ */ +/* 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. */ @@ -1858,6 +1858,9 @@ int src; } else #endif if ((fp = fopenp(filename, "r")) != (FILE *)0) { +#ifndef WIN32 + configfile = filename; +#endif return(fp); #if defined(UNIX) || defined(VMS) } else { From 91b13d939a7c4e5409cff4b855127b558c2fcd27 Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 21 Mar 2015 15:36:47 -0700 Subject: [PATCH 32/49] wishing fix for "eyes" No, not a blindness cure. :-} Post-3.4.3 revisions to makesingular() inadvertently made it impossible to successfully wish for "the Eyes of the Overworld" because the string got changed into "the Eye of the Overworld" which doesn't match anything. So don't singularize "eyes". (After this fix, wishing for "the Eyes of the Aethiopica" no longer yields the Eye of same, but I think that's the correct behavior.) --- src/objnam.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/objnam.c b/src/objnam.c index fe692b226..898dfb60a 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 objnam.c $NHDT-Date$ $NHDT-Branch$:$NHDT-Revision$ */ +/* NetHack 3.5 objnam.c $NHDT-Date: 1426977394 2015/03/21 22:36:34 $ $NHDT-Branch: master $:$NHDT-Revision: 1.108 $ */ /* NetHack 3.5 objnam.c $Date: 2011/10/27 02:24:54 $ $Revision: 1.101 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1682,7 +1682,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 */ From 86959fe242fe238ab8266345acd1c34ba985850d Mon Sep 17 00:00:00 2001 From: PatR Date: Sat, 21 Mar 2015 19:24:08 -0700 Subject: [PATCH 33/49] fix "mysterious force" probabilities in do.c comment Reported by Alex, the probabilites shown in the comment about the effect of the mysterious force have been wrong ever since they were added 20 or so years ago. Lawfuls and neutrals are much more likely to go down just one level rather than 2 or 3. --- src/do.c | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/src/do.c b/src/do.c index 34635af72..b387752d6 100644 --- a/src/do.c +++ b/src/do.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 do.c $NHDT-Date: 1426497723 2015/03/16 09:22:03 $ $NHDT-Branch: H3724 $:$NHDT-Revision: 1.109 $ */ +/* 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. */ @@ -1014,15 +1014,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)) { From c3c968f87cc04ee155b970c927cbf2b109b76f16 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 22 Mar 2015 10:44:36 -0400 Subject: [PATCH 34/49] options and config file handling With SYSCF, the SYSCF_FILE name was overwriting the default config file name making it unavailable for subsequent user config file options handling. - Keep the name of the last config file successfully opened. - Do it without orphaning the default config file name needed for the next pass. --- include/decl.h | 3 ++- src/files.c | 55 +++++++++++++++++++++++++++++++++----------------- src/options.c | 10 ++++----- 3 files changed, 44 insertions(+), 24 deletions(-) diff --git a/include/decl.h b/include/decl.h index bacff08d9..5dea2ff43 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 decl.h $NHDT-Date: 1425081976 2015/02/28 00:06:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.50 $ */ +/* NetHack 3.5 decl.h $NHDT-Date: 1427035422 2015/03/22 14:43:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.56 $ */ /* NetHack 3.5 decl.h $Date: 2011/12/29 20:06:27 $ $Revision: 1.44 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -184,6 +184,7 @@ E NEARDATA struct kinfo { E long done_money; E const char *configfile; +E char lastconfigfile[BUFSZ]; /* used for messaging */ E NEARDATA char plname[PL_NSIZ]; E NEARDATA char dogname[]; E NEARDATA char catname[]; diff --git a/src/files.c b/src/files.c index b9942246a..e638fa640 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* 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 $NHDT-Date: 1427035432 2015/03/22 14:43:52 $ $NHDT-Branch: master $:$NHDT-Revision: 1.138 $ */ /* 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. */ @@ -1811,6 +1811,8 @@ const char *configfile = # endif #endif +/* used for messaging */ +char lastconfigfile[BUFSZ]; #ifdef MSDOS /* conflict with speed-dial under windows @@ -1857,10 +1859,9 @@ int src; /* fall through to standard names */ } else #endif - if ((fp = fopenp(filename, "r")) != (FILE *)0) { -#ifndef WIN32 - configfile = filename; -#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 { @@ -1874,24 +1875,32 @@ int src; } #if defined(MICRO) || defined(MAC) || defined(__BEOS__) || defined(WIN32) - if ((fp = fopenp(fqname(configfile, CONFIGPREFIX, 0), "r")) - != (FILE *)0) + (void) strncpy(lastconfigfile, + fqname(configfile, CONFIGPREFIX, 0), BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; + if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) { return(fp); + } # ifdef MSDOS - else if ((fp = fopenp(fqname(backward_compat_configfile, - CONFIGPREFIX, 0), "r")) != (FILE *)0) + (void) strncpy(lastconfigfile, + fqname(backward_compat_configfile, CONFIGPREFIX, 0), + BUFSZ-1); + lastconfigfile[BUFSZ-1] = '\0'; + else if ((fp = fopenp(fqname(lastconfigfile, "r")) != (FILE *)0) return(fp); # endif #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); } @@ -1900,6 +1909,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 */ @@ -1908,18 +1920,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 @@ -1934,7 +1953,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 */ diff --git a/src/options.c b/src/options.c index 98ab3724b..c21010ab1 100644 --- a/src/options.c +++ b/src/options.c @@ -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: 1427035440 2015/03/22 14:44:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.163 $ */ /* 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. */ @@ -798,10 +798,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 +821,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); @@ -4070,7 +4070,7 @@ option_help() winid datawin; datawin = create_nhwindow(NHW_TEXT); - Sprintf(buf, "Set options as OPTIONS= in %s", configfile); + Sprintf(buf, "Set options as OPTIONS= in %s", lastconfigfile); opt_intro[CONFIG_SLOT] = (const char *) buf; for (i = 0; opt_intro[i]; i++) putstr(datawin, 0, opt_intro[i]); From 74c5f489aebba3d8d39b9acc5e46135ce3926ddc Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 22 Mar 2015 11:11:41 -0400 Subject: [PATCH 35/49] adjust PREFIXES_IN_USE for SYSCF --- include/decl.h | 9 +++++---- src/decl.c | 6 ++++-- src/files.c | 14 +++++++++++--- 3 files changed, 20 insertions(+), 9 deletions(-) diff --git a/include/decl.h b/include/decl.h index 5dea2ff43..15191842e 100644 --- a/include/decl.h +++ b/include/decl.h @@ -1,4 +1,4 @@ -/* NetHack 3.5 decl.h $NHDT-Date: 1427035422 2015/03/22 14:43:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.56 $ */ +/* NetHack 3.5 decl.h $NHDT-Date: 1425081976 2015/02/28 00:06:16 $ $NHDT-Branch: master $:$NHDT-Revision: 1.50 $ */ /* NetHack 3.5 decl.h $Date: 2011/12/29 20:06:27 $ $Revision: 1.44 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -363,9 +363,10 @@ E const char * const monexplain[], invisexplain[], * const oclass_names[]; #define DATAPREFIX 4 /* this one must match hardcoded value in dlb.c */ #define SCOREPREFIX 5 #define LOCKPREFIX 6 -#define CONFIGPREFIX 7 -#define TROUBLEPREFIX 8 -#define PREFIX_COUNT 9 +#define SYSCONFPREFIX 7 +#define CONFIGPREFIX 8 +#define TROUBLEPREFIX 9 +#define PREFIX_COUNT 10 /* used in files.c; xxconf.h can override if needed */ # ifndef FQN_MAX_FILENAME #define FQN_MAX_FILENAME 512 diff --git a/src/decl.c b/src/decl.c index d0d29a35f..75203c056 100644 --- a/src/decl.c +++ b/src/decl.c @@ -268,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 = { diff --git a/src/files.c b/src/files.c index e638fa640..ace417e7d 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 files.c $NHDT-Date: 1427035432 2015/03/22 14:43:52 $ $NHDT-Branch: master $:$NHDT-Revision: 1.138 $ */ +/* 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); @@ -1858,6 +1860,12 @@ int src; wait_synch(); /* fall through to standard names */ } else +#endif +#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'; @@ -1886,7 +1894,7 @@ int src; fqname(backward_compat_configfile, CONFIGPREFIX, 0), BUFSZ-1); lastconfigfile[BUFSZ-1] = '\0'; - else if ((fp = fopenp(fqname(lastconfigfile, "r")) != (FILE *)0) + else if ((fp = fopenp(lastconfigfile, "r")) != (FILE *)0) return(fp); # endif #else From 3b064145a37df3c4a16e6c8cbff3b28c8fa0e0a3 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 22 Mar 2015 15:05:18 -0400 Subject: [PATCH 36/49] File for explaining code quirks/features/caveats - added NOCWD_ASSUMPTIONS and PREFIXES_IN_USE section. --- DEVEL/code_features.txt | 55 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 DEVEL/code_features.txt diff --git a/DEVEL/code_features.txt b/DEVEL/code_features.txt new file mode 100644 index 000000000..08c42c9d7 --- /dev/null +++ b/DEVEL/code_features.txt @@ -0,0 +1,55 @@ +$NHDT-Date: 1426969026 2015/03/21 20:17:06 $ $NHDT-Branch: master $:$NHDT-Revision: 1.137 $ +code_features.txt + +Developer-useful info about code features, assumptions, purpose, +rationale, etc. + +============================================== +PREFIXES_IN_USE and NOCWD_ASSUMPTIONS + +Those provide a storage mechanism for holding the paths to various different +types of files. Those paths are stored in the fqn_prefix[] array. They are a +mechanism for enabling separation of the different files that NetHack needs. + +The prefixes are added to the beginning of file names by various routines in +files.c immediately prior to opening one of the types of files that the game +uses. + +They aren't about config file options (although config file options would be +one way to set non-default values for some of the paths in the fqn_prefix[] +array). Obviously the very first path needed (now sysconfdir, previously +configdir) isn't viable for setting via config file options, but the game +still needs to hunt it down "someplace." When the "someplace" is figured +out, that place (path) would be stored in fqn_prefix[SYSCONPREFIX]. How it +gets stored in fqn_prefix[SYSCONPREFIX] is up to us as developers. + +Any of the fqn_prefix[] entries can be set somehow. It could be done in port +startup code; in options processing; in config file processing; by +translating a system environment variable such as USERPROFILE; whatever +you/we want. The point is that NOCWD_ASSUMPTIONS and PREFIXES_IN_USE are +there to ensure that there is a place to store that path information. The +code to *utilize* the information is already in files.c (see fqname()). + +There is a fqn_prefix[] entry for holding the path to each of the following: + PREFIX NAME +0 HACKPREFIX hackdir +1 LEVELPREFIX leveldir location to create level files +2 SAVEPREFIX savedir location to create/read saved games +3 BONESPREFIX bonesir location to create/read bones +4 DATAPREFIX datadir location to read data.base etc. +5 SCOREPREFIX scoredir location to read/write scorefile +6 LOCKPREFIX lockdir location to create/read lock files +7 SYSCONFPREFIX sysconfdir location to read SYSCF_FILE +8 CONFIGPREFIX configdir location to read user configuration file +9 TROUBLEPREFIX troubledir location to place panic files etc. + +To recap, they are about enabling "different paths for different things", and +separation of: +- read-only stuff from read-write stuff. +- sysadmin stuff from user-writeable stuff. +etc. + +=================== NEXT FEATURE ========================== + + + From 0e6355e01718fbe71065ec6ebc86511ce42373c7 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 22 Mar 2015 18:04:18 -0400 Subject: [PATCH 37/49] Add note about feature alert mechanism --- DEVEL/code_features.txt | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/DEVEL/code_features.txt b/DEVEL/code_features.txt index 08c42c9d7..414a51dbf 100644 --- a/DEVEL/code_features.txt +++ b/DEVEL/code_features.txt @@ -4,6 +4,34 @@ code_features.txt Developer-useful info about code features, assumptions, purpose, rationale, etc. +============================================== +FEATURE_NOTICE Alerts for a Release + +There is a code mechanism for alterting players to a change in behavior +over prior versions of the game. + +Here's how to do it: + o Where the change in behavior needs to alert the player, + - Add an 'if statement' to invoke the alert behavior + if the condition is met, for example + if (flags.suppress_alert < FEATURE_NOTICE_VER(3.6.0)) + pline("Note: and explain the change here."); + - The example above will alert the users for a new feature + added in 3.6.0 via a one-liner via pline(), but you + could get more elaborate (just make sure it is all done + in the 'if' code block.. + +Once the user finds the alert no longer useful, or becoming +annoying, they can set the "suppress_alert" option. + - The user can only set the suppress_alert to the current + version, not future versions. That restriction is done + so that the feature can be used for new things in new + releases. + - The suppression can be done interactively mid game with + the 'O' command, or via + OPTIONS=suppress_alert:3.6.0 + in the user's config file. + ============================================== PREFIXES_IN_USE and NOCWD_ASSUMPTIONS From a948e6aafbe828a16891b25c75f12c2d73521644 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 22 Mar 2015 18:11:49 -0400 Subject: [PATCH 38/49] remove stale feature alert This old feature alert from 3.3.0 is pretty stale, so remove if from the code because everybody has probably suppressed it by now. /* 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."); --- src/wield.c | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/src/wield.c b/src/wield.c index 9e1447bff..c70bec601 100644 --- a/src/wield.c +++ b/src/wield.c @@ -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 */ From 7b571b72f28d61894638f5e66831b93ec2ebed59 Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 22 Mar 2015 18:22:36 -0700 Subject: [PATCH 39/49] {DEC,IBM,MAC}graphics (1 of 2: core) DECgraphics, IBMgraphics, and MACgraphics used to be recognized when at least 3 letters were supplied back when they were true boolean options. When they got demoted to shortcuts for the symset option, they started needing 10 (DEC and IBM) or all 11 (MAC), otherwise triggering "bad syntax in NETHACKOPTIONS" (or config file). Revert to having the first three letters be sufficient. --- src/options.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/options.c b/src/options.c index c21010ab1..147e0a701 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 options.c $NHDT-Date: 1427035440 2015/03/22 14:44:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.163 $ */ +/* 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. */ @@ -2484,7 +2484,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 +2508,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 +2542,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) { From 97ffd73addcdb6855ded7a71fdb2339ad636ec3e Mon Sep 17 00:00:00 2001 From: PatR Date: Sun, 22 Mar 2015 18:29:37 -0700 Subject: [PATCH 40/49] {DEC,IBM,MAC}graphics (2 of 2: unixmain) Unix command line processing required that the initial 'd' of "-DECgraphics" be lowercase so that it wouldn't conflict with -D for wizard mode. This retains -D for wizard mode and now also recognizes "-debug" (case insensitive, but full 5 letters necessary) for the same thing, and allows "-DECgraphics" to be capitalized as it is throughout the rest of the program (actual matching is case-insensitive, so "-dec" and "-decgraphics" still work. It now requires that anything after "DEC" match the rest of that string instead of accepting "-DECanthing" as a synonym for "-DECgraphics". Likewise for "-IBMgraphics": when more than 3 letters are supplied, the extra ones must be an initial substring of "graphics" rather than arbitrary characters. The raw_printf() warnings don't actually work as intended, but that isn't a change from the old behavior so I've left them in for now. --- sys/unix/unixmain.c | 31 ++++++++++++++++++++----------- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/sys/unix/unixmain.c b/sys/unix/unixmain.c index f7f1ac87e..b31032efb 100644 --- a/sys/unix/unixmain.c +++ b/sys/unix/unixmain.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 unixmain.c $NHDT-Date: 1426966705 2015/03/21 19:38:25 $ $NHDT-Branch: master $:$NHDT-Revision: 1.44 $ */ +/* NetHack 3.5 unixmain.c $NHDT-Date: 1427074144 2015/03/23 01:29:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.45 $ */ /* NetHack 3.5 unixmain.c $Date: 2012/01/27 20:15:31 $ $Revision: 1.42 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -324,7 +324,7 @@ process_options(argc, argv) int argc; char *argv[]; { - int i; + int i, l; /* * Process options. @@ -332,11 +332,25 @@ char *argv[]; while(argc > 1 && argv[1][0] == '-'){ argv++; argc--; + l = (int)strlen(*argv); + /* must supply at least 4 chars to match "-XXXgraphics" */ + if (l < 4) l = 4; + switch(argv[0][1]){ case 'D': - wizard = TRUE, discover = FALSE; + case 'd': + if ((argv[0][1] == 'D' && !argv[0][2]) + || !strcmpi(*argv, "-debug")) { + wizard = TRUE, discover = FALSE; + } else if (!strncmpi(*argv, "-DECgraphics", l)) { + load_symset("DECGraphics", PRIMARY); + switch_symbols(TRUE); + } else { + raw_printf("Unknown option: %s", *argv); + } break; case 'X': + discover = TRUE, wizard = FALSE; break; #ifdef NEWS @@ -356,17 +370,12 @@ char *argv[]; break; case 'I': case 'i': - if (!strncmpi(argv[0]+1, "IBM", 3)) { + if (!strncmpi(*argv, "-IBMgraphics", l)) { load_symset("IBMGraphics", PRIMARY); load_symset("RogueIBM", ROGUESET); switch_symbols(TRUE); - } - break; - /* case 'D': */ - case 'd': - if (!strncmpi(argv[0]+1, "DEC", 3)) { - load_symset("DECGraphics", PRIMARY); - switch_symbols(TRUE); + } else { + raw_printf("Unknown option: %s", *argv); } break; case 'p': /* profession (role) */ From e41b3f71435a4471ba4c2baf41743d2789b676fb Mon Sep 17 00:00:00 2001 From: Sean Hunt Date: Sat, 21 Mar 2015 11:55:30 -0400 Subject: [PATCH 41/49] Fix use-after-frees on dipped objects. --- src/fountain.c | 16 +++++++++------- src/potion.c | 6 +++--- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/src/fountain.c b/src/fountain.c index 88fb6e2a4..405fac4a3 100644 --- a/src/fountain.c +++ b/src/fountain.c @@ -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. */ @@ -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)) { diff --git a/src/potion.c b/src/potion.c index 0af019181..d9e5e9ca8 100644 --- a/src/potion.c +++ b/src/potion.c @@ -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. */ @@ -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; } From dfe967732d181df07a26814848ed4bb285d6781f Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 24 Mar 2015 21:14:49 +0200 Subject: [PATCH 42/49] Add more hallu sounds monsters make when hit --- src/sounds.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/sounds.c b/src/sounds.c index 6204847e8..d8d78b4cc 100644 --- a/src/sounds.c +++ b/src/sounds.c @@ -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 * From d787f45dcbec5b1ab3bd8bec062107c22511b625 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 24 Mar 2015 22:01:29 +0200 Subject: [PATCH 43/49] Add an option to give feedback when bumping walls Boolean option "mention_walls", defaults to off. Useful for blind players. --- doc/Guidebook.mn | 2 ++ doc/fixes35.0 | 2 +- include/flag.h | 1 + src/hack.c | 9 +++++++-- src/options.c | 1 + 5 files changed, 12 insertions(+), 3 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 0b2e5cf3b..04cb9ea5f 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -2053,6 +2053,8 @@ Enable mail delivery during the game (default on). .lp "male " An obsolete synonym for ``gender:male''. Cannot be set with the `O' command. +.lp mention_walls +Give feedback when walking against a wall (default off). .lp menustyle Controls the interface used when you need to choose various objects (in response to the Drop command, for instance). The value specified should diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 5d9f4707a..d1cd02932 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -879,7 +879,7 @@ abuse wisdom in keeping with Rider eating message message inconsistency: death message "swallowed whole" was preceded by "You bite into" improve the messaging when a monster you can't see is causing an obstruction - +add option mention_walls, which gives feedback when bumping against a wall Platform- and/or Interface-Specific Fixes ----------------------------------------- diff --git a/include/flag.h b/include/flag.h index aaff7431c..add59340e 100644 --- a/include/flag.h +++ b/include/flag.h @@ -189,6 +189,7 @@ struct instance_flags { boolean deferred_X; /* deferred entry into explore mode */ boolean num_pad; /* use numbers for movement commands */ boolean news; /* print news */ + boolean mention_walls; /* give feedback when bumping walls */ boolean menu_tab_sep; /* Use tabs to separate option menu fields */ boolean menu_requested; /* Flag for overloaded use of 'm' prefix * on some non-move commands */ diff --git a/src/hack.c b/src/hack.c index 1edfb9f4e..7f15af6ee 100644 --- a/src/hack.c +++ b/src/hack.c @@ -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; } diff --git a/src/options.c b/src/options.c index 147e0a701..d1f5b26de 100644 --- a/src/options.c +++ b/src/options.c @@ -139,6 +139,7 @@ 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}, {"mouse_support", &iflags.wc_mouse_support, TRUE, DISP_IN_GAME}, /*WC*/ From 2ae33fa514490047598db89e9a02be9afe236e25 Mon Sep 17 00:00:00 2001 From: keni Date: Tue, 24 Mar 2015 18:29:02 -0400 Subject: [PATCH 44/49] NHsubst bugfixes and hack for whitespace errors. --- DEVEL/hooksdir/NHsubst | 39 +++++++++++++++++++++++++++++++++++---- 1 file changed, 35 insertions(+), 4 deletions(-) diff --git a/DEVEL/hooksdir/NHsubst b/DEVEL/hooksdir/NHsubst index 2c0c3c774..1039c21e6 100755 --- a/DEVEL/hooksdir/NHsubst +++ b/DEVEL/hooksdir/NHsubst @@ -13,7 +13,8 @@ my $rawin = 0; # feed diff to stdin for testing (do NOT set $debug=1) # this first block because it's expensive and dumpfile() hangs with $rawin. my $sink = ($^O eq "MSWin32") ? "NUL" : "/dev/null"; my $dbgfile = ($^O eq "MSWin32") ? "$ENV{TEMP}.$$" : "/tmp/trace.$$"; -open TRACE, ">>", ($debug==0)? $sink : $dbgfile; +open TRACE, ">>", $rawin?"/dev/tty":(($debug==0)? $sink : $dbgfile); +print TRACE "TEST TRACE\n"; if($debug){ print TRACE "START CLIENT ARGV:\n"; print TRACE "[0] $0\n"; @@ -233,7 +234,7 @@ sub merge_one_line_maybe { $theirval = $1; } } - +print TRACE "MID: $ourstype/$oursval $theirtype/$theirval\n"; # are we done? if(pos($ours)==length $ours && pos($theirs) == length $theirs){ $more = 0; @@ -245,6 +246,12 @@ sub merge_one_line_maybe { # now see if ours and their match or can be resolved # text if($ourstype == 3 && $theirtype == 3){ +#mismatch is \s vs \s\s - where is this coming from? + # HACK - hopefully temporary + if($oursval =~ m/^\s+$/ && $theirval =~ m/^\s+$/){ + $out .= $oursval; + next; + } if($oursval eq $theirval){ $out .= $oursval; next; @@ -273,6 +280,7 @@ sub merge_one_line_maybe { # return undef if we can't merge the values; $NAME: VALUE $ or $NAME$ (as appropriate) if we can. sub merge_one_var_maybe { my($varname, $oursval, $theirval) = @_; +print TRACE "MVM: -$varname-$oursval-$theirval-\n"; my $resolvedas; { no strict; @@ -309,12 +317,28 @@ sub Date { sub Branch { my($PREFIX, $varname, $mine, $theirs) = @_; - return "\$$PREFIX-$varname: $mine \$"; + $mine =~ s/^\s+//; $mine =~ s/\s+$//; + $theirs =~ s/^\s+//; $theirs =~ s/\s+$//; + return "\$$PREFIX-$varname: $mine \$" if(length $mine); + return "\$$PREFIX-$varname: $theirs \$" if(length $theirs); + return "\$$PREFIX-$varname\$" if(length $theirs); } sub Revision { my($PREFIX, $varname, $mine, $theirs) = @_; - return "\$$PREFIX-$varname: $mine \$"; + my($m) = ($mine =~ m/1.(\d+)/); + my($t) = ($theirs =~ m/1.(\d+)/); + if($m > 0 && $t > 0){ + my $q = ($m > $t) ? $m : $t; + return "\$$PREFIX-$varname: 1.$q \$"; + } + if($m > 0){ + return "\$$PREFIX-$varname: 1.$m \$"; + } + if($t > 0){ + return "\$$PREFIX-$varname: 1.$t \$"; + } + return "\$$PREFIX-$varname\$"; } __END__ @@ -364,3 +388,10 @@ $TEST-Branch: mine $ === $TEST-Branch: theirs $ >>> d3 + +TEST 8: +<<< d1 +/* NetHack 3.5 objnam.c $TEST-Date$ $TEST-Branch$:$TEST-Revision$ */ +=== +/* NetHack 3.5 objnam.c $TEST-Date: 1426977394 2015/03/21 22:36:34 $ $TEST-Branch: master $:$TEST-Revision: 1.108 $ */ +>>> d3 From a1cc33d6aed8cec411339736375fc231c2da9699 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 24 Mar 2015 19:20:14 -0400 Subject: [PATCH 45/49] fix invalid pointer dereference in morguemon On 3/23/2015 6:41 PM, a bug reporter wrote: > If the game generates a graveyard, the graveyard places a normal > demon, but all normal demons are extinct at the time, then morguemon (at > mkroom.c line 423) indexes mons with NON_PM (the return value of > ndemon() if it can't find a reference), which is an invalid pointer > dereference. According to the testbench, this mostly seems to happen on > dlvl 12. This fixes the code violation, but the logic will now drop down to the ghost/wraith/zombie code when that happens. Is that desireable, or should something else happen (for variety)? --- doc/fixes35.0 | 2 ++ src/mkroom.c | 16 ++++++++++++---- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index d1cd02932..34a6ac9b4 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -880,6 +880,8 @@ message inconsistency: death message "swallowed whole" was preceded by "You bite into" improve the messaging when a monster you can't see is causing an obstruction add option mention_walls, which gives feedback when bumping against a wall +fix invalid pointer dereference in morguemon if ndemon returns NON_PM + Platform- and/or Interface-Specific Fixes ----------------------------------------- diff --git a/src/mkroom.c b/src/mkroom.c index 7f94076e7..2581ce996 100644 --- a/src/mkroom.c +++ b/src/mkroom.c @@ -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)); From a355911c2c98c5dba8428046b4033c820b46998c Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 24 Mar 2015 22:07:16 -0400 Subject: [PATCH 46/49] no hiding under nothing On 3/23/2015 6:41 PM, a bug reporter wrote: > When you're hiding under an item (e.g. via garter snake polyform), and > that item gets polyshuddered into nonexistence, you continue hiding > (under nothing). This addresses the "hiding under nothing" bug, but does not address this flavor comment also included in the report: > (Incidentally, it's a bit weird that you use > to aim at items that are > flavorwise above you at the time.) --- doc/fixes35.0 | 2 ++ src/zap.c | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 34a6ac9b4..f22cdc80d 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -881,6 +881,8 @@ message inconsistency: death message "swallowed whole" was preceded improve the messaging when a monster you can't see is causing an obstruction add option mention_walls, which gives feedback when bumping against a wall fix invalid pointer dereference in morguemon if ndemon returns NON_PM +after object loss through polyshudder don't get left hiding under nothing + if you're polymorphed into a hider Platform- and/or Interface-Specific Fixes diff --git a/src/zap.c b/src/zap.c index 3134c8b88..fcf0047bf 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 zap.c $NHDT-Date: 1426465444 2015/03/16 00:24:04 $ $NHDT-Branch: debug $:$NHDT-Revision: 1.195 $ */ +/* 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. */ @@ -1750,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); From 907a2dfee0f81a9f9d5f7eaa764a21d776117de5 Mon Sep 17 00:00:00 2001 From: Sean Hunt Date: Wed, 25 Mar 2015 14:34:03 -0400 Subject: [PATCH 47/49] Fix a memory leak on termination. Found by Alex Smith. --- src/save.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/save.c b/src/save.c index 807ecd7dc..f94b1857c 100644 --- a/src/save.c +++ b/src/save.c @@ -1316,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); From f41c51aef064b9399684da428c540bcb26a57b8e Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 25 Mar 2015 22:13:28 +0200 Subject: [PATCH 48/49] Show object symbols in menu headings ... in menus where those object symbols act as menu accelerators. Toggleable via "menu_objsyms" boolean option, defaults to off. --- doc/Guidebook.mn | 3 +++ doc/fixes35.0 | 2 ++ include/extern.h | 2 +- include/flag.h | 1 + src/invent.c | 26 +++++++++++++++++++------- src/o_init.c | 8 ++++---- src/options.c | 1 + src/pickup.c | 10 +++++++--- 8 files changed, 38 insertions(+), 15 deletions(-) diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index 04cb9ea5f..14aa20239 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -2100,6 +2100,9 @@ Default '|'. Menu character accelerator to goto the next menu page. Implemented by the Amiga, Gem and tty ports. Default '>'. +.lp menu_objsyms +Show object symbols in menu headings in menus where +the object symbols act as menu accelerators (default off). .lp menu_previous_page Menu character accelerator to goto the previous menu page. Implemented by the Amiga, Gem and tty ports. diff --git a/doc/fixes35.0 b/doc/fixes35.0 index f22cdc80d..a639b1ff6 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -883,6 +883,8 @@ add option mention_walls, which gives feedback when bumping against a wall fix invalid pointer dereference in morguemon if ndemon returns NON_PM after object loss through polyshudder don't get left hiding under nothing if you're polymorphed into a hider +show object symbols in menu headings in menus where those object symbols + act as menu accelerators, toggleable via "menu_objsyms" option Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index da9bf7eff..30e6c6d43 100644 --- a/include/extern.h +++ b/include/extern.h @@ -911,7 +911,7 @@ E int NDECL(dopramulet); E int NDECL(doprtool); E int NDECL(doprinuse); E void FDECL(useupf, (struct obj *,long)); -E char *FDECL(let_to_name, (CHAR_P,BOOLEAN_P)); +E char *FDECL(let_to_name, (CHAR_P,BOOLEAN_P,BOOLEAN_P)); E void NDECL(free_invbuf); E void NDECL(reassign); E int NDECL(doorganize); diff --git a/include/flag.h b/include/flag.h index add59340e..e7ebafa26 100644 --- a/include/flag.h +++ b/include/flag.h @@ -191,6 +191,7 @@ struct instance_flags { boolean news; /* print news */ boolean mention_walls; /* give feedback when bumping walls */ boolean menu_tab_sep; /* Use tabs to separate option menu fields */ + boolean menu_head_objsym; /* Show obj symbol in menu headings */ boolean menu_requested; /* Flag for overloaded use of 'm' prefix * on some non-move commands */ boolean renameallowed; /* can change hero name during role selection */ diff --git a/src/invent.c b/src/invent.c index 12f0ef1b3..e5100ee5e 100644 --- a/src/invent.c +++ b/src/invent.c @@ -1789,7 +1789,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; @@ -1863,7 +1863,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; @@ -1991,7 +1991,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++; } @@ -2009,7 +2009,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 @@ -2701,10 +2701,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; @@ -2717,7 +2719,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 */ @@ -2727,6 +2730,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; } diff --git a/src/o_init.c b/src/o_init.c index 4ae8892e9..3d95a0d6f 100644 --- a/src/o_init.c +++ b/src/o_init.c @@ -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; diff --git a/src/options.c b/src/options.c index d1f5b26de..285603351 100644 --- a/src/options.c +++ b/src/options.c @@ -142,6 +142,7 @@ static struct Bool_Opt {"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}, diff --git a/src/pickup.c b/src/pickup.c index 1d78dea76..476d85798 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -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; } @@ -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; } } From 12ca92aa4236133e776411ddab81cbde05a9adaa Mon Sep 17 00:00:00 2001 From: "Derek S. Ray" Date: Wed, 25 Mar 2015 17:07:10 -0400 Subject: [PATCH 49/49] Fix 'fetch' syntax, include sparkly 'git log' trick And bolt a couple more Win32-folders onto .gitignore. --- .gitignore | 2 ++ DEVEL/git_recipes.txt | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 302497de0..db40c9ab4 100644 --- a/.gitignore +++ b/.gitignore @@ -32,6 +32,8 @@ core Makefile # Win32-specific ignores +Debug/ +Release/ binary/ build/ Nethack.sln diff --git a/DEVEL/git_recipes.txt b/DEVEL/git_recipes.txt index 88af7f927..5e8d872f9 100644 --- a/DEVEL/git_recipes.txt +++ b/DEVEL/git_recipes.txt @@ -32,6 +32,10 @@ you specify: -pretty=one: format output as a single line for each entry (branch): show the commits from (branch) instead of the current one +[*] git log --pretty=one --decorate --graph --all + +(This is best explained by executing and looking at the output.) + [*] git add (filename) [*] git nhadd (filename) @@ -101,10 +105,10 @@ the prior commit. [/end area-of-concern] -[*] git fetch [-a] +[*] git fetch [--all] Retrieve commits from the remote repository to your machine. -Including -a will get commits for all branches. +Including --all will get commits for all branches. Does NOT merge them into your local repository.