From 5dd00aca54cec68813fbf1832ba63c6d50dfe71e Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 12 Apr 2015 12:16:59 -0400 Subject: [PATCH 01/18] Makefile bit following merge --- sys/winnt/Makefile.msc | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/sys/winnt/Makefile.msc b/sys/winnt/Makefile.msc index c808440ed..e8632f598 100644 --- a/sys/winnt/Makefile.msc +++ b/sys/winnt/Makefile.msc @@ -1,4 +1,4 @@ -# NetHack 3.5 Makefile.msc $NHDT-Date: 1427076358 2015/03/23 02:05:58 $ $NHDT-Branch: nhmall-booktribute $:$NHDT-Revision: 1.75 $ */ +# NetHack 3.5 Makefile.msc $NHDT-Date: 1428855415 2015/04/12 16:16:55 $ $NHDT-Branch: master $:$NHDT-Revision: 1.80 $ */ # Copyright (c) NetHack PC Development Team 1993-2015 # #============================================================================== @@ -403,6 +403,9 @@ DLB = {$(SSYS)}.c{$(OBJ)}.o: @$(CC) $(cflagsUtil) -Fo$@ $< +{$(SSYS)}.cpp{$(OBJ)}.o: + @$(CC) $(cflagsUtil) -Fo$@ $< + #========================================== # Rules for files in sys\winnt #========================================== @@ -528,9 +531,10 @@ VOBJ24 = $(O)track.o $(O)trap.o $(O)u_init.o $(O)uhitm.o VOBJ25 = $(O)vault.o $(O)vis_tab.o $(O)vision.o $(O)weapon.o VOBJ26 = $(O)were.o $(O)wield.o $(O)windows.o $(O)wizard.o VOBJ27 = $(O)worm.o $(O)worn.o $(O)write.o $(O)zap.o - DLBOBJ = $(O)dlb.o +REGEX = $(O)cppregex.o + TTYOBJ = $(O)topl.o $(O)getline.o $(O)wintty.o SOBJ = $(O)winnt.o $(O)pcsys.o $(O)pcunix.o \ @@ -541,7 +545,7 @@ OBJS = $(VOBJ01) $(VOBJ02) $(VOBJ03) $(VOBJ04) $(VOBJ05) \ $(VOBJ11) $(VOBJ12) $(VOBJ13) $(VOBJ14) $(VOBJ15) \ $(VOBJ16) $(VOBJ17) $(VOBJ18) $(VOBJ19) $(VOBJ20) \ $(VOBJ21) $(VOBJ22) $(VOBJ23) $(VOBJ24) $(VOBJ25) \ - $(VOBJ26) $(VOBJ27) $(VOBJ28) $(VOBJ29) + $(VOBJ26) $(VOBJ27) $(VOBJ28) $(VOBJ29) $(REGEX) WINPOBJ = $(WINPORT) From 636da9887b231c17f1b5d0d05b11da4a85683470 Mon Sep 17 00:00:00 2001 From: nhmall Date: Sun, 12 Apr 2015 13:27:36 -0400 Subject: [PATCH 02/18] more regex integration bits --- win/win32/NetHackW.vcxproj | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/win/win32/NetHackW.vcxproj b/win/win32/NetHackW.vcxproj index c90ff1112..3919d8cc7 100644 --- a/win/win32/NetHackW.vcxproj +++ b/win/win32/NetHackW.vcxproj @@ -637,6 +637,15 @@ copy ..\sys\winnt\defaults.nh ..\binary\defaults.nh %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) + %(AdditionalIncludeDirectories) + %(PreprocessorDefinitions) + %(PreprocessorDefinitions) + %(AdditionalIncludeDirectories) %(AdditionalIncludeDirectories) From ee5002210f7fa4d603352431a26910d53de116c8 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 13 Apr 2015 08:30:47 +0300 Subject: [PATCH 03/18] Fix gitignored --- .gitignore | 2 +- dat/.gitignore | 1 + util/.gitignore | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index aedf39f50..614c54f6d 100644 --- a/.gitignore +++ b/.gitignore @@ -4,7 +4,7 @@ TAGS .make.state .nse_depinfo *~ -#* +\#* .#* ,* _$* diff --git a/dat/.gitignore b/dat/.gitignore index caece5a59..c2fecbb7c 100644 --- a/dat/.gitignore +++ b/dat/.gitignore @@ -9,6 +9,7 @@ bogusmon engrave epitaph x11tiles +nhtiles.bmp *.lev spec_levs quest_levs diff --git a/util/.gitignore b/util/.gitignore index 98b003527..22139b7ab 100644 --- a/util/.gitignore +++ b/util/.gitignore @@ -8,5 +8,6 @@ lev_yacc.c tile2x11 lev_comp tileedit +tile2bmp dlb recover From 0b0c769a051f27f480e872ec466f421cbaafd74e Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 13 Apr 2015 10:07:12 +0300 Subject: [PATCH 04/18] Use our dupstr instead of strdup --- src/sp_lev.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/sp_lev.c b/src/sp_lev.c index 60e2ea759..3acac5032 100644 --- a/src/sp_lev.c +++ b/src/sp_lev.c @@ -408,7 +408,7 @@ opvar_clone(ov) case SPOVAR_VARIABLE: case SPOVAR_STRING: case SPOVAR_SEL: - tmpov->vardata.str = strdup(ov->vardata.str); + tmpov->vardata.str = dupstr(ov->vardata.str); break; default: impossible("Unknown push value type (%i)!", ov->spovartyp); } @@ -2678,7 +2678,7 @@ spo_monster(coder) case SP_M_V_NAME: if ((OV_typ(parm) == SPOVAR_STRING) && !tmpmons.name.str) - tmpmons.name.str = strdup(OV_s(parm)); + tmpmons.name.str = dupstr(OV_s(parm)); break; case SP_M_V_APPEAR: if ((OV_typ(parm) == SPOVAR_INT) && @@ -2686,7 +2686,7 @@ spo_monster(coder) tmpmons.appear = OV_i(parm); opvar_free(parm); OV_pop(parm); - tmpmons.appear_as.str = strdup(OV_s(parm)); + tmpmons.appear_as.str = dupstr(OV_s(parm)); } break; case SP_M_V_ASLEEP: @@ -2821,7 +2821,7 @@ spo_object(coder) case SP_O_V_NAME: if ((OV_typ(parm) == SPOVAR_STRING) && !tmpobj.name.str) - tmpobj.name.str = strdup(OV_s(parm)); + tmpobj.name.str = dupstr(OV_s(parm)); break; case SP_O_V_CORPSENM: if (OV_typ(parm) == SPOVAR_MONST) { @@ -3926,7 +3926,7 @@ spo_levregion(coder) tmplregion->del_islev = OV_i(del_islev); tmplregion->rtype = OV_i(rtype); tmplregion->padding = OV_i(padding); - tmplregion->rname.str = strdup(OV_s(rname)); + tmplregion->rname.str = dupstr(OV_s(rname)); if(!tmplregion->in_islev) { get_location(&tmplregion->inarea.x1, &tmplregion->inarea.y1, @@ -4495,7 +4495,7 @@ spo_var_init(coder) tmpvar = (struct splev_var *)malloc(sizeof(struct splev_var)); if (!tmpvar) panic("newvar tmpvar alloc"); tmpvar->next = coder->frame->variables; - tmpvar->name = strdup(OV_s(vname)); + tmpvar->name = dupstr(OV_s(vname)); coder->frame->variables = tmpvar; if (OV_i(arraylen) < 0) { From eba5bf7d5e7444321e19b69819ea7546f3b3b30d Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 13 Apr 2015 18:30:49 +0300 Subject: [PATCH 05/18] Add litmus test Original patch by Dylan O'Donnell --- doc/fixes35.0 | 1 + include/decl.h | 3 ++- src/decl.c | 2 +- src/potion.c | 9 +++++++++ src/pray.c | 2 +- 5 files changed, 14 insertions(+), 3 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 27c9aca0d..0900fd8b7 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -897,6 +897,7 @@ allow showing legal positions for stinking cloud, jumping and polearms cloned creatures (of any type) don't deathdrop items pudding corpses behave somewhat differently than before mithril armor should have silver color +lichen corpse is an acid indicator Platform- and/or Interface-Specific Fixes diff --git a/include/decl.h b/include/decl.h index 417ca9d62..0b5c06831 100644 --- a/include/decl.h +++ b/include/decl.h @@ -266,7 +266,7 @@ E NEARDATA struct c_color_names { const char *const c_black, *const c_amber, *const c_golden, *const c_light_blue,*const c_red, *const c_green, *const c_silver, *const c_blue, *const c_purple, - *const c_white; + *const c_white, *const c_orange; } c_color_names; #define NH_BLACK c_color_names.c_black #define NH_AMBER c_color_names.c_amber @@ -278,6 +278,7 @@ E NEARDATA struct c_color_names { #define NH_BLUE c_color_names.c_blue #define NH_PURPLE c_color_names.c_purple #define NH_WHITE c_color_names.c_white +#define NH_ORANGE c_color_names.c_orange /* The names of the colors used for gems, etc. */ E const char *c_obj_colors[]; diff --git a/src/decl.c b/src/decl.c index d9429dbcf..3508b2621 100644 --- a/src/decl.c +++ b/src/decl.c @@ -216,7 +216,7 @@ NEARDATA struct c_color_names c_color_names = { "black", "amber", "golden", "light blue", "red", "green", "silver", "blue", "purple", - "white" + "white", "orange" }; struct menucoloring *menu_colorings = NULL; diff --git a/src/potion.c b/src/potion.c index 86fdcdff8..fbea23c7c 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1819,6 +1819,15 @@ dodip() return 1; } + if(potion->otyp == POT_ACID && obj->otyp == CORPSE && + obj->corpsenm == PM_LICHEN & !Blind) { + pline("%s %s %s around the edges.", The(cxname(obj)), + otense(obj, "turn"), potion->odiluted ? + hcolor(NH_ORANGE) : hcolor(NH_RED)); + potion->in_use = FALSE; /* didn't go poof */ + return(1); + } + if(is_poisonable(obj)) { if(potion->otyp == POT_SICKNESS && !obj->opoisoned) { char buf[BUFSZ]; diff --git a/src/pray.c b/src/pray.c index 20e5d348d..0d5aab920 100644 --- a/src/pray.c +++ b/src/pray.c @@ -1370,7 +1370,7 @@ dosacrifice() a_gname(), u_gname()); pline("%s is enraged...", u_gname()); pline("Fortunately, %s permits you to live...", a_gname()); - pline(cloud_of_smoke, hcolor("orange")); + pline(cloud_of_smoke, hcolor(NH_ORANGE)); done(ESCAPED); } else { /* super big win */ adjalign(10); From 6209d458f98c0f5e730e83ffdf9969078ff32d1b Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 13 Apr 2015 18:54:20 +0300 Subject: [PATCH 06/18] A camera may contain a picture-painting demon Original patch by Leon Arnott --- doc/fixes35.0 | 1 + include/extern.h | 1 + src/dothrow.c | 18 ++++++++++++++++++ src/uhitm.c | 1 + 4 files changed, 21 insertions(+) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 0900fd8b7..ae084f321 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -898,6 +898,7 @@ cloned creatures (of any type) don't deathdrop items pudding corpses behave somewhat differently than before mithril armor should have silver color lichen corpse is an acid indicator +camera may contain a picture-painting demon Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 997885882..227396f54 100644 --- a/include/extern.h +++ b/include/extern.h @@ -497,6 +497,7 @@ E int FDECL(omon_adj, (struct monst *,struct obj *,BOOLEAN_P)); E int FDECL(thitmonst, (struct monst *,struct obj *)); E int FDECL(hero_breaks, (struct obj *,XCHAR_P,XCHAR_P,BOOLEAN_P)); E int FDECL(breaks, (struct obj *,XCHAR_P,XCHAR_P)); +E void FDECL(release_camera_demon, (struct obj *, XCHAR_P,XCHAR_P)); E void FDECL(breakobj, (struct obj *,XCHAR_P,XCHAR_P,BOOLEAN_P,BOOLEAN_P)); E boolean FDECL(breaktest, (struct obj *)); E boolean FDECL(walk_path, (coord *, coord *, boolean (*)(genericptr_t,int,int), genericptr_t)); diff --git a/src/dothrow.c b/src/dothrow.c index ab4b96497..679d49a6e 100644 --- a/src/dothrow.c +++ b/src/dothrow.c @@ -1665,6 +1665,21 @@ xchar x, y; /* object location (ox, oy may not be right) */ return 1; } +void +release_camera_demon(obj, x,y) +struct obj *obj; +xchar x,y; +{ + struct monst *mtmp; + if (!rn2(3) && (mtmp = makemon(&mons[rn2(3) ? PM_HOMUNCULUS : PM_IMP],x,y, NO_MM_FLAGS)) != 0) { + if (canspotmon(mtmp)) + pline("%s is released!", Hallucination ? + An(rndmonnam(NULL)) : "The picture-painting demon"); + mtmp->mpeaceful = !obj->cursed; + set_malign(mtmp); + } +} + /* * Unconditionally break an object. Assumes all resistance checks * and break messages have been delivered prior to getting here. @@ -1707,6 +1722,9 @@ boolean from_invent; } /* monster breathing isn't handled... [yet?] */ break; + case EXPENSIVE_CAMERA: + release_camera_demon(obj, x,y); + break; case EGG: /* breaking your own eggs is bad luck */ if (hero_caused && obj->spe && obj->corpsenm >= LOW_PM) diff --git a/src/uhitm.c b/src/uhitm.c index 2bf963c94..50c0523f6 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -741,6 +741,7 @@ int thrown; /* HMON_xxx (0 => hand-to-hand, other => ranged) */ case EXPENSIVE_CAMERA: You("succeed in destroying %s. Congratulations!", ysimple_name(obj)); + release_camera_demon(obj, u.ux, u.uy); useup(obj); return(TRUE); /*NOTREACHED*/ From 1c970b171e2b1e8f1a140eec9dfea6b76d472efe Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 13 Apr 2015 19:36:49 +0300 Subject: [PATCH 07/18] Some monsters can eat through iron bars Any monster with rusting or corrosion attack can eat through the bars. This includes rust monsters, grey oozes, and black puddings. Original patch by Malcolm Ryan --- doc/fixes35.0 | 1 + include/extern.h | 1 + src/hack.c | 20 +++++++++++++++----- src/mondata.c | 1 + src/monmove.c | 17 ++++++++++++++++- 5 files changed, 34 insertions(+), 6 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index ae084f321..c18e548ae 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -899,6 +899,7 @@ pudding corpses behave somewhat differently than before mithril armor should have silver color lichen corpse is an acid indicator camera may contain a picture-painting demon +some monsters can eat through iron bars Platform- and/or Interface-Specific Fixes diff --git a/include/extern.h b/include/extern.h index 227396f54..f5600661d 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1367,6 +1367,7 @@ E boolean FDECL(onscary, (int,int,struct monst *)); E void FDECL(monflee, (struct monst *, int, BOOLEAN_P, BOOLEAN_P)); E int FDECL(dochug, (struct monst *)); E int FDECL(m_move, (struct monst *,int)); +E void FDECL(dissolve_bars, (int,int)); E boolean FDECL(closed_door, (int,int)); E boolean FDECL(accessible, (int,int)); E void FDECL(set_apparxy, (struct monst *)); diff --git a/src/hack.c b/src/hack.c index ebf1ce891..e8e095da5 100644 --- a/src/hack.c +++ b/src/hack.c @@ -347,7 +347,7 @@ still_chewing(x,y) if (!boulder && IS_ROCK(lev->typ) && !may_dig(x,y)) { You("hurt your teeth on the %s.", - IS_TREE(lev->typ) ? "tree" : "hard stone"); + lev->typ == IRONBARS ? "bars" : (IS_TREE(lev->typ) ? "tree" : "hard stone")); nomul(0); return 1; } else if (context.digging.pos.x != x || context.digging.pos.y != y || @@ -362,9 +362,10 @@ still_chewing(x,y) context.digging.effort = (IS_ROCK(lev->typ) && !IS_TREE(lev->typ) ? 30 : 60) + u.udaminc; You("start chewing %s %s.", - (boulder || IS_TREE(lev->typ)) ? "on a" : "a hole in the", + (boulder || IS_TREE(lev->typ) || lev->typ == IRONBARS) ? "on a" : "a hole in the", boulder ? "boulder" : - IS_TREE(lev->typ) ? "tree" : IS_ROCK(lev->typ) ? "rock" : "door"); + IS_TREE(lev->typ) ? "tree" : IS_ROCK(lev->typ) ? "rock" : + lev->typ == IRONBARS ? "bar" : "door"); watch_dig((struct monst *)0, x, y, FALSE); return 1; } else if ((context.digging.effort += (30 + u.udaminc)) <= 100) { @@ -373,7 +374,8 @@ still_chewing(x,y) context.digging.chew ? "continue" : "begin", boulder ? "boulder" : IS_TREE(lev->typ) ? "tree" : - IS_ROCK(lev->typ) ? "rock" : "door"); + IS_ROCK(lev->typ) ? "rock" : + lev->typ == IRONBARS ? "bars" : "door"); context.digging.chew = TRUE; watch_dig((struct monst *)0, x, y, FALSE); return 1; @@ -418,6 +420,9 @@ still_chewing(x,y) } else if (IS_TREE(lev->typ)) { digtxt = "chew through the tree."; lev->typ = ROOM; + } else if (lev->typ == IRONBARS) { + digtxt = "eat through the bars."; + dissolve_bars(x,y); } else if (lev->typ == SDOOR) { if (lev->doormask & D_TRAPPED) { lev->doormask = D_NODOOR; @@ -630,10 +635,15 @@ int mode; if (Passes_walls && may_passwall(x,y)) { ; /* do nothing */ } else if (tmpr->typ == IRONBARS) { + if ((dmgtype(youmonst.data, AD_RUST) || + dmgtype(youmonst.data, AD_CORR)) && + mode == DO_MOVE && still_chewing(x,y)) { + return FALSE; + } if (!(Passes_walls || passes_bars(youmonst.data))) { if (iflags.mention_walls) You("cannot pass through the bars."); - return FALSE; + return FALSE; } } else if (tunnels(youmonst.data) && !needspick(youmonst.data)) { /* Eat the rock. */ diff --git a/src/mondata.c b/src/mondata.c index 98c3244f5..0c26a6005 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -285,6 +285,7 @@ struct permonst *mptr; { return (boolean) (passes_walls(mptr) || amorphous(mptr) || unsolid(mptr) || is_whirly(mptr) || verysmall(mptr) || + dmgtype(mptr, AD_CORR) || dmgtype(mptr, AD_RUST) || (slithy(mptr) && !bigmonst(mptr))); } diff --git a/src/monmove.c b/src/monmove.c index 81eb563d3..a7a3ca46f 100644 --- a/src/monmove.c +++ b/src/monmove.c @@ -1180,7 +1180,14 @@ postmov: add_damage(mtmp->mx, mtmp->my, 0L); } } else if (levl[mtmp->mx][mtmp->my].typ == IRONBARS) { - if (flags.verbose && canseemon(mtmp)) + if (may_dig(mtmp->mx,mtmp->my) && + (dmgtype(ptr, AD_RUST) || dmgtype(ptr, AD_CORR))) { + if (canseemon(mtmp)) + pline("%s eats through the iron bars.", + Monnam(mtmp)); + dissolve_bars(mtmp->mx, mtmp->my); + return(3); + } else if (flags.verbose && canseemon(mtmp)) Norep("%s %s %s the iron bars.", Monnam(mtmp), /* pluralization fakes verb conjugation */ makeplural(locomotion(ptr, "pass")), @@ -1266,6 +1273,14 @@ postmov: return(mmoved); } +void +dissolve_bars(x, y) +register int x, y; +{ + levl[x][y].typ = (Is_special(&u.uz) || *in_rooms(x,y,0)) ? ROOM : CORR; + newsym(x, y); +} + boolean closed_door(x, y) register int x, y; From 1dd43be26687e7735f8ff44069a1ce71eee65a36 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 13 Apr 2015 19:50:54 +0300 Subject: [PATCH 08/18] Inaccessible niches occasionally have iron bars --- doc/fixes35.0 | 1 + src/mklev.c | 9 +++++++++ 2 files changed, 10 insertions(+) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index c18e548ae..9744a0a4c 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -900,6 +900,7 @@ mithril armor should have silver color lichen corpse is an acid indicator camera may contain a picture-painting demon some monsters can eat through iron bars +inaccessible niches occasionally have iron bars in front Platform- and/or Interface-Specific Fixes diff --git a/src/mklev.c b/src/mklev.c index 744eb31f2..858a61664 100644 --- a/src/mklev.c +++ b/src/mklev.c @@ -493,6 +493,15 @@ int trap_type; if(rn2(7)) dosdoor(xx, yy, aroom, rn2(5) ? SDOOR : DOOR); else { + /* inaccessible niches occasionally have iron bars */ + if (!rn2(5) && IS_WALL(levl[xx][yy].typ)) { + levl[xx][yy].typ = IRONBARS; + if (rn2(3)) + (void) mkcorpstat(CORPSE, + (struct monst *)0, + mkclass(S_HUMAN, 0), + xx, yy+dy, TRUE); + } if (!level.flags.noteleport) (void) mksobj_at(SCR_TELEPORTATION, xx, yy+dy, TRUE, FALSE); From 879f6d55c20f9eb848279feebc1e2d6de9c68ce8 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Mon, 13 Apr 2015 20:49:38 +0300 Subject: [PATCH 09/18] Add Auto open doors -patch --- dat/opthelp | 1 + doc/Guidebook.mn | 2 ++ doc/Guidebook.tex | 3 +++ doc/fixes35.0 | 1 + include/context.h | 1 + include/extern.h | 1 + include/flag.h | 1 + include/patchlevel.h | 2 +- src/hack.c | 15 ++++++++++----- src/lock.c | 13 ++++++++++++- src/options.c | 1 + 11 files changed, 34 insertions(+), 7 deletions(-) diff --git a/dat/opthelp b/dat/opthelp index ce1d743cc..1cffdeb73 100644 --- a/dat/opthelp +++ b/dat/opthelp @@ -3,6 +3,7 @@ Boolean options not under specific compile flags (with default values in []): option setting, which is reached via the 'O' cmd.) autodig dig if moving and wielding digging tool [FALSE] +autoopen walking into a door attempts to open it [TRUE] autopickup automatically pick up objects you move over [TRUE] autoquiver when firing with an empty quiver, select some suitable inventory weapon to fill the quiver [FALSE] diff --git a/doc/Guidebook.mn b/doc/Guidebook.mn index a62cfd02a..8b32a50aa 100644 --- a/doc/Guidebook.mn +++ b/doc/Guidebook.mn @@ -1905,6 +1905,8 @@ Cannot be set with the `O' command. .lp autodig Automatically dig if you are wielding a digging tool and moving into a place that can be dug (default false). +.lp autoopen +Walking into a door attempts to open it (default true). .lp "autopickup " Automatically pick up things onto which you move (default on). See diff --git a/doc/Guidebook.tex b/doc/Guidebook.tex index d31fa52aa..057fbc8e9 100644 --- a/doc/Guidebook.tex +++ b/doc/Guidebook.tex @@ -2306,6 +2306,9 @@ Cannot be set with the `{\tt O}' command. Automatically dig if you are wielding a digging tool and moving into a place that can be dug (default false). %.lp +\item[\ib{autoopen}] +Walking into a door attempts to open it (default true). +%.lp \item[\ib{autopickup}] Automatically pick up things onto which you move (default on). See ``{\it pickup\_types\/}'' to refine the behavior. diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 9744a0a4c..9e5c508d3 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -1165,6 +1165,7 @@ Aardvark Joe's Extended Logfile Michael Deutschmann's use_darkgray Clive Crous' dark_room sortloot by Jeroen Demeyer and Jukka Lahtinen +Auto open doors by Stefano Busti Code Cleanup and Reorganization diff --git a/include/context.h b/include/context.h index a544f6ae0..dfacbb5ad 100644 --- a/include/context.h +++ b/include/context.h @@ -110,6 +110,7 @@ struct context_info { boolean bypasses; /* bypass flag is set on at least one fobj */ boolean botl; /* partially redo status line */ boolean botlx; /* print an entirely new bottom line */ + boolean door_opened; /* set to true if door was opened during test_move */ struct dig_info digging; struct victual_info victual; struct tin_info tin; diff --git a/include/extern.h b/include/extern.h index f5600661d..ebe38de5e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -980,6 +980,7 @@ E int NDECL(doforce); E boolean FDECL(boxlock, (struct obj *,struct obj *)); E boolean FDECL(doorlock, (struct obj *,int,int)); E int NDECL(doopen); +E int FDECL(doopen_indir, (int,int)); E int NDECL(doclose); #ifdef MAC diff --git a/include/flag.h b/include/flag.h index dc58375e4..38dbe48ce 100644 --- a/include/flag.h +++ b/include/flag.h @@ -19,6 +19,7 @@ struct flag { boolean acoustics; /* allow dungeon sound messages */ boolean autodig; /* MRKR: Automatically dig */ boolean autoquiver; /* Automatically fill quiver */ + boolean autoopen; /* open doors by walking into them */ boolean beginner; boolean biff; /* enable checking for mail */ boolean bones; /* allow saving/loading bones */ diff --git a/include/patchlevel.h b/include/patchlevel.h index 76d514afa..0665df6fe 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 60 +#define EDITLEVEL 61 #define COPYRIGHT_BANNER_A \ "NetHack, Copyright 1985-2015" diff --git a/src/hack.c b/src/hack.c index e8e095da5..df437391a 100644 --- a/src/hack.c +++ b/src/hack.c @@ -627,6 +627,7 @@ int mode; register struct rm *tmpr = &levl[x][y]; register struct rm *ust; + context.door_opened = FALSE; /* * Check for physical obstacles. First, the place we are going. */ @@ -680,8 +681,10 @@ int mode; if (mode == DO_MOVE) { if (amorphous(youmonst.data)) You("try to ooze under the door, but can't squeeze your possessions through."); - else if (x == ux || y == uy) { - if (Blind || Stunned || ACURR(A_DEX) < 10 || Fumbling) { + if (flags.autoopen && !context.run && !Confusion && !Stunned && !Fumbling) { + context.door_opened = context.move = doopen_indir(x, y); + } else if (x == ux || y == uy) { + if (Blind || Stunned || ACURR(A_DEX) < 10 || Fumbling) { if (u.usteed) { You_cant("lead %s through that closed door.", y_monnam(u.usteed)); @@ -1405,9 +1408,11 @@ domove() } if (!test_move(u.ux, u.uy, x-u.ux, y-u.uy, DO_MOVE)) { - context.move = 0; - nomul(0); - return; + if (!context.door_opened) { + context.move = 0; + nomul(0); + } + return; } /* Move ball and chain. */ diff --git a/src/lock.c b/src/lock.c index 3de76fe66..c29be8549 100644 --- a/src/lock.c +++ b/src/lock.c @@ -523,6 +523,14 @@ doforce() /* try to force a chest with your weapon */ int doopen() /* try to open a door */ { + return doopen_indir(0, 0); +} + +int +doopen_indir(x, y) /* try to open a door in direction u.dx/u.dy */ +int x, y; +{ + coord cc; register struct rm *door; struct monst *mtmp; @@ -539,7 +547,10 @@ doopen() /* try to open a door */ return 0; } - if(!get_adjacent_loc((char *)0, (char *)0, u.ux, u.uy, &cc)) return(0); + if (x > 0 && y > 0) { + cc.x = x; + cc.y = y; + } else if(!get_adjacent_loc((char *)0, (char *)0, u.ux, u.uy, &cc)) return(0); if((cc.x == u.ux) && (cc.y == u.uy)) return(0); diff --git a/src/options.c b/src/options.c index 83c3c0abf..2291b0c13 100644 --- a/src/options.c +++ b/src/options.c @@ -78,6 +78,7 @@ static struct Bool_Opt {"asksavedisk", (boolean *)0, FALSE, SET_IN_FILE}, #endif {"autodig", &flags.autodig, FALSE, SET_IN_GAME}, + {"autoopen", &flags.autoopen, TRUE, SET_IN_GAME}, {"autopickup", &flags.pickup, TRUE, SET_IN_GAME}, {"autoquiver", &flags.autoquiver, FALSE, SET_IN_GAME}, #if defined(MICRO) && !defined(AMIGA) From 4e45cf3e7fb895cda58bdad341f01f00b99906bb Mon Sep 17 00:00:00 2001 From: keni Date: Mon, 13 Apr 2015 19:32:51 -0400 Subject: [PATCH 10/18] nhsub: handle git add/commit options that take an argument --- DEVEL/hooksdir/nhsub | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/DEVEL/hooksdir/nhsub b/DEVEL/hooksdir/nhsub index 2dbc97800..c169609be 100644 --- a/DEVEL/hooksdir/nhsub +++ b/DEVEL/hooksdir/nhsub @@ -267,6 +267,8 @@ my $count = s/\$$PREFIX-(([A-Za-z][A-Za-z0-9_]*)(: ([^\x24]+))?)\$/&handlevar($2 rename $ofile, $file or die "Can't rename $ofile to $file"; } +# XXX docs for --fixup and --squash are wrong in synopsis. --file missing +# --message --template -t sub cmdparse { my(@in) = @_; @@ -315,6 +317,21 @@ sub cmdparse { if($opt{cmd} eq 'add' && $single eq 'n'){ exit 0; } +#need to deal with options that eat a following element (-m, -F etc etc) +#add: nothing? +#commit: -c -C -F -m +# -u mode is optional +# -S keyid is optional + if($opt{cmd} eq 'commit'){ + if($single =~ m/[uS]/){ + last; + } + if($single =~ m/[cCFm]/){ +#XXX this will be a mess if the argument is wrong, but can we tell? No. + shift @in; + last; + } + } } } shift @in; From cf74f1cfd8201a14fef3b76e346b411fd263a22c Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 13 Apr 2015 17:21:59 -0700 Subject: [PATCH 11/18] regex lint For the POSIX regexp interface, move local declaration to beginning of block to avoid requiring C99. Also switch to alloc() from bare malloc() so that MONITOR_HEAP won't log a free which doesn't match up to any allocation. This results in a change in behavior: if the allocation fails, nethack will panic rather than report an option parsing error. In practice there will be no difference because nethack is not going to run out of dynamic memory during initial options processing. --- sys/share/posixregex.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/sys/share/posixregex.c b/sys/share/posixregex.c index 17cb2841e..3540d3b4c 100644 --- a/sys/share/posixregex.c +++ b/sys/share/posixregex.c @@ -1,8 +1,8 @@ -/* NetHack 3.5 posixregex.c $NHDT-Date: 1428590280 2015/04/09 14:38:00 $ $NHDT-Branch: scshunt-regex $:$NHDT-Revision: 1.0 $ */ +/* NetHack 3.5 posixregex.c $NHDT-Date: 1428970913 2015/04/14 00:21:53 $ $NHDT-Branch: master $:$NHDT-Revision: 1.0 $ */ /* Copyright (c) Sean Hunt 2015. */ /* NetHack may be freely redistributed. See license for details. */ -#include +#include "hack.h" #include @@ -50,7 +50,7 @@ struct nhregex { }; struct nhregex *regex_init() { - return malloc (sizeof (struct nhregex)); + return (struct nhregex *)alloc(sizeof (struct nhregex)); } boolean regex_compile(const char *s, struct nhregex *re) { @@ -65,7 +65,7 @@ const char *regex_error_desc(struct nhregex *re) { static char buf[BUFSZ]; if (!re || !re->err) - return NULL; + return (const char *)0; /* FIXME: Using a static buffer here is not ideal, but avoids memory * leaks. Consider the allocation more carefully. */ @@ -75,11 +75,12 @@ const char *regex_error_desc(struct nhregex *re) { } boolean regex_match(const char *s, struct nhregex *re) { + int result; + if (!re) return FALSE; - int result; - if ((result = regexec(&re->re, s, 0, NULL, 0))) { + if ((result = regexec(&re->re, s, 0, (genericptr_t)0, 0))) { if (result != REG_NOMATCH) re->err = result; return FALSE; From 615b25f5fc8682cc634257513ef3ba263c85681d Mon Sep 17 00:00:00 2001 From: PatR Date: Mon, 13 Apr 2015 17:50:17 -0700 Subject: [PATCH 12/18] lint bits --- src/files.c | 8 +++----- src/potion.c | 4 ++-- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/files.c b/src/files.c index cd6f735d5..8e942f757 100644 --- a/src/files.c +++ b/src/files.c @@ -1,4 +1,4 @@ -/* NetHack 3.5 files.c $NHDT-Date: 1427337311 2015/03/26 02:35:11 $ $NHDT-Branch: derek-farming $:$NHDT-Revision: 1.141 $ */ +/* NetHack 3.5 files.c $NHDT-Date: 1428972596 2015/04/14 00:49:56 $ $NHDT-Branch: master $:$NHDT-Revision: 1.164 $ */ /* 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. */ @@ -3346,10 +3346,8 @@ int tribpassage; char *endp; char line[BUFSZ]; - int scopes[4] = {0, SECTIONSCOPE, TITLESCOPE, PASSAGESCOPE}; - int scope = 0, section = 0, passage = 0, book = 0; - int linect = 0, passagecnt = 0, targetpassage = 0, textcnt = 0; - char *sectionnm = "", *booknm = ""; + int scope = 0; + int linect = 0, passagecnt = 0, targetpassage = 0; const char *badtranslation = "an incomprehensible foreign translation"; boolean matchedsection = FALSE, matchedtitle = FALSE; winid tribwin = WIN_ERR; diff --git a/src/potion.c b/src/potion.c index fbea23c7c..e669018d3 100644 --- a/src/potion.c +++ b/src/potion.c @@ -1,4 +1,4 @@ -/* 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 $NHDT-Date: 1428972597 2015/04/14 00:49:57 $ $NHDT-Branch: master $:$NHDT-Revision: 1.111 $ */ /* 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. */ @@ -1820,7 +1820,7 @@ dodip() } if(potion->otyp == POT_ACID && obj->otyp == CORPSE && - obj->corpsenm == PM_LICHEN & !Blind) { + obj->corpsenm == PM_LICHEN && !Blind) { pline("%s %s %s around the edges.", The(cxname(obj)), otense(obj, "turn"), potion->odiluted ? hcolor(NH_ORANGE) : hcolor(NH_RED)); From 31eed002c3ec3111b513f8714882e61377affca0 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 14 Apr 2015 08:45:29 +0300 Subject: [PATCH 13/18] YAFM for dragon sitting on gold --- src/sit.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/sit.c b/src/sit.c index 19cd63471..fd4207af5 100644 --- a/src/sit.c +++ b/src/sit.c @@ -67,9 +67,14 @@ dosit() register struct obj *obj; obj = level.objects[u.ux][u.uy]; - You("sit on %s.", the(xname(obj))); - if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH)) - pline("It's not very comfortable..."); + if (youmonst.data->mlet == S_DRAGON && obj->oclass == COIN_CLASS) { + You("coil up around your %shoard.", + (obj->quan + money_cnt(invent) < u.ulevel*1000) ? "meager " : ""); + } else { + You("sit on %s.", the(xname(obj))); + if (!(Is_box(obj) || objects[obj->otyp].oc_material == CLOTH)) + pline("It's not very comfortable..."); + } } else if (trap != 0 || (u.utrap && (u.utraptype >= TT_LAVA))) { if (u.utrap) { exercise(A_WIS, FALSE); /* you're getting stuck longer */ From f1a5de16d94fe46176a8c11e778432d65f93de3e Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 14 Apr 2015 08:55:43 +0300 Subject: [PATCH 14/18] Guard against merge segfaults Trying to throw a quivered object resulted in a segfault, when the code tried to merge the quivered object into itself. --- src/invent.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/invent.c b/src/invent.c index 9e4041603..c66129cf0 100644 --- a/src/invent.c +++ b/src/invent.c @@ -2540,6 +2540,7 @@ mergable(otmp, obj) /* returns TRUE if obj & otmp can be merged */ register struct obj *otmp, *obj; { int objnamelth = 0, otmpnamelth = 0; + if (obj == otmp) return FALSE; /* already the same object */ if (obj->otyp != otmp->otyp) return FALSE; /* coins of the same kind will always merge */ if (obj->oclass == COIN_CLASS) return TRUE; From 9b2c298fecff7e27cd26c0b46ff3296ee2cd4877 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 14 Apr 2015 19:21:32 +0300 Subject: [PATCH 15/18] Sinks may be teleported or polymorphed by rings Original patches by Leon Arnott and me. --- doc/fixes35.0 | 1 + src/do.c | 87 ++++++++++++++++++++++++++++++++++++++++++++++----- 2 files changed, 81 insertions(+), 7 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 9e5c508d3..36894c697 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -901,6 +901,7 @@ lichen corpse is an acid indicator camera may contain a picture-painting demon some monsters can eat through iron bars inaccessible niches occasionally have iron bars in front +sinks may teleport or polymorph Platform- and/or Interface-Specific Fixes diff --git a/src/do.c b/src/do.c index 75b61159e..476cd2451 100644 --- a/src/do.c +++ b/src/do.c @@ -9,6 +9,8 @@ #include "lev.h" STATIC_DCL void FDECL(trycall, (struct obj *)); +STATIC_DCL void NDECL(polymorph_sink); +STATIC_DCL boolean NDECL(teleport_sink); STATIC_DCL void FDECL(dosinkring, (struct obj *)); STATIC_PTR int FDECL(drop, (struct obj *)); @@ -260,6 +262,72 @@ register struct obj *obj; docall(obj); } +/** Transforms the sink at the player's position into + * a fountain, throne, altar or grave. */ +STATIC_DCL +void +polymorph_sink() +{ + if (levl[u.ux][u.uy].typ != SINK) return; + + level.flags.nsinks--; + levl[u.ux][u.uy].doormask = 0; + switch(rn2(4)) { + default: + case 0: + levl[u.ux][u.uy].typ = FOUNTAIN; + level.flags.nfountains++; + break; + case 1: + levl[u.ux][u.uy].typ = THRONE; + break; + case 2: + levl[u.ux][u.uy].typ = ALTAR; + levl[u.ux][u.uy].altarmask = Align2amask(rn2((int)A_LAWFUL+2) - 1); + break; + case 3: + levl[u.ux][u.uy].typ = ROOM; + make_grave(u.ux, u.uy, (char *) 0); + break; + } + pline_The("sink transforms into %s!", + (levl[u.ux][u.uy].typ == THRONE) ? + "a throne" : an(surface(u.ux, u.uy))); + newsym(u.ux,u.uy); +} + +/** Teleports the sink at the player's position. + * @return TRUE if sink teleported */ +STATIC_DCL +boolean +teleport_sink() +{ + int cx, cy; + int cnt = 0; + struct trap *trp; + struct engr *eng; + do { + cx = rnd(COLNO-1); + cy = rn2(ROWNO); + trp = t_at(cx,cy); + eng = engr_at(cx,cy); + } while (((levl[cx][cy].typ != ROOM) || (trp) || (eng) || + cansee(cx,cy)) && (cnt++ < 200)); + if ((levl[cx][cy].typ == ROOM) && !trp && !eng) { + /* create sink at new position */ + levl[cx][cy].typ = SINK; + levl[cx][cy].looted = levl[u.ux][u.uy].looted; + newsym(cx,cy); + /* remove old sink */ + levl[u.ux][u.uy].typ = ROOM; + levl[u.ux][u.uy].looted = 0; + newsym(u.ux,u.uy); + return TRUE; + } + return FALSE; +} + + STATIC_OVL void dosinkring(obj) /* obj is a ring being dropped over a kitchen sink */ @@ -267,6 +335,7 @@ register struct obj *obj; { register struct obj *otmp,*otmp2; register boolean ideed = TRUE; + boolean nosink = FALSE; You("drop %s down the drain.", doname(obj)); obj->in_use = TRUE; /* block free identification via interrupt */ @@ -289,8 +358,9 @@ giveback: You("smell rotten %s.", makeplural(fruitname(FALSE))); break; case RIN_AGGRAVATE_MONSTER: - pline("Several flies buzz angrily around the sink."); - break; + pline("Several %s buzz angrily around the sink.", + Hallucination ? makeplural(rndmonnam(NULL)) : "flies"); + break; case RIN_SHOCK_RESISTANCE: pline("Static electricity surrounds the sink."); break; @@ -355,7 +425,8 @@ giveback: You_see("the ring slide right down the drain!"); break; case RIN_SEE_INVISIBLE: - You_see("some air in the sink."); + You_see("some %s in the sink.", + Hallucination ? "oxygen molecules" : "air"); break; case RIN_STEALTH: pline_The("sink seems to blend into the floor for a moment."); @@ -377,13 +448,15 @@ giveback: pline_The("sink glows %s for a moment.", hcolor(NH_WHITE)); break; case RIN_TELEPORTATION: - pline_The("sink momentarily vanishes."); + nosink = teleport_sink(); + pline_The("sink %svanishes.", nosink ? "" : "momentarily "); break; case RIN_TELEPORT_CONTROL: pline_The("sink looks like it is being beamed aboard somewhere."); break; case RIN_POLYMORPH: - pline_The("sink momentarily looks like a fountain."); + polymorph_sink(); + nosink = TRUE; break; case RIN_POLYMORPH_CONTROL: pline_The("sink momentarily looks like a regularly erupting geyser."); @@ -392,9 +465,9 @@ giveback: } if(ideed) trycall(obj); - else + else if (!nosink) You_hear("the ring bouncing down the drainpipe."); - if (!rn2(20)) { + if (!rn2(20) && !nosink) { pline_The("sink backs up, leaving %s.", doname(obj)); obj->in_use = FALSE; dropx(obj); From cd3b0efe5d91b90f61b7770c4d3c9740174e5352 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 14 Apr 2015 19:41:44 +0300 Subject: [PATCH 16/18] Unify description of hero's visage into single function --- include/extern.h | 1 + src/apply.c | 11 +++++++++-- src/do_name.c | 5 +---- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/include/extern.h b/include/extern.h index ebe38de5e..3a0535cf0 100644 --- a/include/extern.h +++ b/include/extern.h @@ -39,6 +39,7 @@ E void FDECL(m_unleash, (struct monst *,BOOLEAN_P)); E void NDECL(unleash_all); E boolean NDECL(next_to_u); E struct obj *FDECL(get_mleash, (struct monst *)); +E const char *NDECL(beautiful); E void FDECL(check_leash, (XCHAR_P,XCHAR_P)); E boolean FDECL(um_dist, (XCHAR_P,XCHAR_P,XCHAR_P)); E boolean FDECL(snuff_candle, (struct obj *)); diff --git a/src/apply.c b/src/apply.c index 40249be1f..e8b0bfea4 100644 --- a/src/apply.c +++ b/src/apply.c @@ -703,6 +703,14 @@ register xchar x, y; } } +const char * +beautiful() +{ + return (ACURR(A_CHA) > 14) ? + (poly_gender() == 1 ? "beautiful" : "handsome") : "ugly"; +} + + #define WEAK 3 /* from eat.c */ static const char look_str[] = "look %s."; @@ -720,8 +728,7 @@ struct obj *obj; if(!getdir((char *)0)) return 0; invis_mirror = Invis; useeit = !Blind && (!invis_mirror || See_invisible); - uvisage = (ACURR(A_CHA) > 14) ? - (poly_gender() == 1 ? "beautiful" : "handsome") : "ugly"; + uvisage = beautiful(); mirror = simpleonames(obj); /* "mirror" or "looking glass" */ if(obj->cursed && !rn2(2)) { if (!Blind) diff --git a/src/do_name.c b/src/do_name.c index c8a49a443..b89374804 100644 --- a/src/do_name.c +++ b/src/do_name.c @@ -421,10 +421,7 @@ do_mname() mtmp = u.usteed; else { pline("This %s creature is called %s and cannot be renamed.", - ACURR(A_CHA) > 14 ? - (flags.female ? "beautiful" : "handsome") : - "ugly", - plname); + beautiful(), plname); return; } } else From dc7d8eb244d77b77d79243e2d2dab42ed51d5e79 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 14 Apr 2015 20:04:46 +0300 Subject: [PATCH 17/18] YAFM for magic flute --- src/music.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/music.c b/src/music.c index 24a7b75bd..3fabfec06 100644 --- a/src/music.c +++ b/src/music.c @@ -453,7 +453,7 @@ struct obj *instr; if (do_spec && instr->spe > 0) { consume_obj_charge(instr, TRUE); - You("produce soft music."); + You("produce %s music.", Hallucination ? "piped" : "soft"); put_monsters_to_sleep(u.ulevel * 5); exercise(A_DEX, TRUE); break; From 647a072b6224562d9b1a8c225223472ba0249dd6 Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Tue, 14 Apr 2015 20:33:30 +0300 Subject: [PATCH 18/18] Move triplicate defines into single place --- include/hack.h | 9 +++++++++ src/attrib.c | 9 --------- src/eat.c | 10 +--------- src/pray.c | 10 ---------- 4 files changed, 10 insertions(+), 28 deletions(-) diff --git a/include/hack.h b/include/hack.h index c85f95d8d..2dcc91699 100644 --- a/include/hack.h +++ b/include/hack.h @@ -44,6 +44,15 @@ #define EXT_ENCUMBER 4 /* Overtaxed */ #define OVERLOADED 5 /* Overloaded */ +/* hunger states - see hu_stat in eat.c */ +#define SATIATED 0 +#define NOT_HUNGRY 1 +#define HUNGRY 2 +#define WEAK 3 +#define FAINTING 4 +#define FAINTED 5 +#define STARVED 6 + /* Macros for how a rumor was delivered in outrumor() */ #define BY_ORACLE 0 #define BY_COOKIE 1 diff --git a/src/attrib.c b/src/attrib.c index f7af4fee8..32b0be275 100644 --- a/src/attrib.c +++ b/src/attrib.c @@ -372,15 +372,6 @@ boolean inc_or_dec; if (moves > 0 && (i == A_STR || i == A_CON)) (void)encumber_msg(); } -/* hunger values - from eat.c */ -#define SATIATED 0 -#define NOT_HUNGRY 1 -#define HUNGRY 2 -#define WEAK 3 -#define FAINTING 4 -#define FAINTED 5 -#define STARVED 6 - STATIC_OVL void exerper() { diff --git a/src/eat.c b/src/eat.c index ea3f77691..2226a7b37 100644 --- a/src/eat.c +++ b/src/eat.c @@ -40,15 +40,6 @@ STATIC_DCL boolean FDECL(maybe_cannibal, (int,BOOLEAN_P)); char msgbuf[BUFSZ]; -/* hunger texts used on bottom line (each 8 chars long) */ -#define SATIATED 0 -#define NOT_HUNGRY 1 -#define HUNGRY 2 -#define WEAK 3 -#define FAINTING 4 -#define FAINTED 5 -#define STARVED 6 - /* also used to see if you're allowed to eat cats and dogs */ #define CANNIBAL_ALLOWED() (Role_if(PM_CAVEMAN) || Race_if(PM_ORC)) @@ -76,6 +67,7 @@ STATIC_OVL NEARDATA const char allobj[] = { STATIC_OVL boolean force_save_hs = FALSE; +/* see hunger states in hack.h - texts used on bottom line */ const char *hu_stat[] = { "Satiated", " ", diff --git a/src/pray.c b/src/pray.c index 0d5aab920..36cdf37e0 100644 --- a/src/pray.c +++ b/src/pray.c @@ -149,16 +149,6 @@ in_trouble() struct obj *otmp; int i, j, count=0; -/* Borrowed from eat.c */ - -#define SATIATED 0 -#define NOT_HUNGRY 1 -#define HUNGRY 2 -#define WEAK 3 -#define FAINTING 4 -#define FAINTED 5 -#define STARVED 6 - /* * major troubles */