diff --git a/dat/tribute b/dat/tribute index ef2b776cd..e1ea7590b 100644 --- a/dat/tribute +++ b/dat/tribute @@ -6759,7 +6759,7 @@ pretty good sigh. IT APPEARS THAT THE BUTLER DID IT. IT IS A MADE-UP STORY. VERY STRANGE. ALL ONE NEEDS TO DO IS TURN TO THE LAST PAGE AND THE ANSWER IS THERE. WHAT, THEREFORE, IS THE POINT OF -DELIBERATEDLY NOT KNOWING? +DELIBERATELY NOT KNOWING? It sounded like gibberish to Vimes, so he ignored it. Some of the aches had gone, although his head still hammered. There was an empty feeling @@ -6815,7 +6815,7 @@ favor. "I have been know to have the occasional 'little flutter,' sir." "Given, then, a contest between an invisible and very powerful quasidemonic -/thing/ of pure vengence on the one hand, and the commander on the other, +/thing/ of pure vengeance on the one hand, and the commander on the other, where would you wager, say... one dollar?" "I wouldn't, sir. That looks like one that would go to the judges." diff --git a/doc/fixes36.1 b/doc/fixes36.1 index 8b63f9015..96aba09c7 100644 --- a/doc/fixes36.1 +++ b/doc/fixes36.1 @@ -29,6 +29,7 @@ negative intrinsic protection shouldn't confer MC=1, "you are warded" (not possible from divine protection but is possible from eating rings) make a slight adjustment to the quickmimic() sense wording fix typo in passage 1 of The Colour of Magic +fix typos in passages 2 and 6 of Thud! falling asleep when reading dull spellbook ignored sleep resistance getpos() complaint about invalid movement keystroke didn't describe meta-chars accurately @@ -322,6 +323,17 @@ clarify that shape-shifted vampires revert to vampire form when petrified or digested; when back in 'V' form, they're vulnerable to such damage when poly'd into an engulfer which does digestion damage, a kill resulting in a level gain gave "welcome to level N+1" before "you digest " +any corpse eaten by omnivorous hero always tasted "terrible" +eating the corpse of a unique non-named monster (Wizard of Yendor, Oracle, + Chromatic Dragon, others) gave "The the tastes ..." +when escaping the dungeon, change "you were here" annotation in dungeon + overview to "you left from here" +option parsing will crash if 'playmode' option is present without a value +any item drained of enchantment was blamed on the player as far as shop + billing was concerned, even if caused by disenchanter attack +if user supplied a specific monster name when asked to choose a monster class, + first prefix match was picked rather than best match ("titan" yielded + S_quadruped due to being preceded by "titanothere" in mons[]) Fixes to Post-3.6.0 Problems that Were Exposed Via git Repository @@ -333,17 +345,25 @@ rings covered by non-cursed gloves not listed as 'R' candidates in baalz_fixup, move any monster away from the two fake pool spots switching farlook from xname to doname was giving away information for items located via object detection (quantity of detected gold) +changing doname to use "some" instead of precise quantity when an item's + dknown flag is not set could result in blind hero getting + "There is a some jackal corpses here. Eat one?" and + "You can only lift some of the some jackal corpses. Continue?" catch up win/Qt/qt_win.cpp on 18-Dec-2015 change to formatkiller() fix for long lines in config file (28-Jan-2016) made 'O' command's 'list' and 'remove' menu choices in interactive handling for menu colorings, message types, and autopickup exceptions subject to buffer overflow when picking a destination for #jump, '$' to show valid dest. is more accurate enchant armor gave "your pair of boots/gloves glow", should have been "glows" +when autopickup is overridden in a shop, always-pick-up exceptions and + pickup_thrown still picked unpaid items up Platform- and/or Interface-Specific Fixes ----------------------------------------- tiles: wrinkled spellbook had a spurious brown pixel on far right edge of tile +tiles: when statues are displayed as corresponding monsters, total_tiles_used + in generated src/tile.c had incorrect value tty: M-N gave "Unknown command 'M-" with "'." finishing the sentence on the line below it, leaving bogus '.' displayed on the top row of the map tty: specifying all four of role, race, gender, and alignment still prompted @@ -390,6 +410,8 @@ X11: make the extended command menu be easier to use and look a little nicer X11: make the getline text entry widget display a bigger text entry area X11: color didn't work when the map was displayed as text rather than tiles X11: use grayscale monster tiles for statues +X11/USE_XPM: [post-3.6.0 issue] the 'tiles' bug of incorrect total_tiles_used + for STATUES_LOOK_LIKE_MONSTERS broke XPM manipulation of tiles data General New Features diff --git a/include/extern.h b/include/extern.h index a383d0d30..12e709e45 100644 --- a/include/extern.h +++ b/include/extern.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 extern.h $NHDT-Date: 1461967848 2016/04/29 22:10:48 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.558 $ */ +/* NetHack 3.6 extern.h $NHDT-Date: 1471112244 2016/08/13 18:17:24 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.570 $ */ /* Copyright (c) Steve Creps, 1988. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1609,6 +1609,7 @@ E boolean FDECL(the_unique_pm, (struct permonst *)); E boolean FDECL(erosion_matters, (struct obj *)); E char *FDECL(doname, (struct obj *)); E char *FDECL(doname_with_price, (struct obj *)); +E char *FDECL(doname_vague_quan, (struct obj *)); E boolean FDECL(not_fully_identified, (struct obj *)); E char *FDECL(corpse_xname, (struct obj *, const char *, unsigned)); E char *FDECL(cxname, (struct obj *)); @@ -2774,7 +2775,7 @@ E struct monst *FDECL(montraits, (struct obj *, coord *)); E struct monst *FDECL(revive, (struct obj *, BOOLEAN_P)); E int FDECL(unturn_dead, (struct monst *)); E void FDECL(cancel_item, (struct obj *)); -E boolean FDECL(drain_item, (struct obj *)); +E boolean FDECL(drain_item, (struct obj *, BOOLEAN_P)); E struct obj *FDECL(poly_obj, (struct obj *, int)); E boolean FDECL(obj_resists, (struct obj *, int, int)); E boolean FDECL(obj_shudders, (struct obj *)); diff --git a/include/sp_lev.h b/include/sp_lev.h index df2ca6bbd..d437795d2 100644 --- a/include/sp_lev.h +++ b/include/sp_lev.h @@ -1,4 +1,4 @@ -/* NetHack 3.6 sp_lev.h $NHDT-Date: 1432512780 2015/05/25 00:13:00 $ $NHDT-Branch: master $:$NHDT-Revision: 1.14 $ */ +/* NetHack 3.6 sp_lev.h $NHDT-Date: 1470212260 2016/08/03 08:17:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.17 $ */ /* Copyright (c) 1989 by Jean-Christophe Collet */ /* NetHack may be freely redistributed. See license for details. */ @@ -229,28 +229,31 @@ enum opcode_defs { #define SP_COORD_X(l) (l & 0xff) #define SP_COORD_Y(l) ((l >> 16) & 0xff) -#define SP_COORD_PACK(x, y) (((x) &0xff) + (((y) &0xff) << 16)) +#define SP_COORD_PACK(x, y) (((x) & 0xff) + (((y) & 0xff) << 16)) #define SP_COORD_PACK_RANDOM(f) (SP_COORD_IS_RANDOM | (f)) #define SP_REGION_X1(l) (l & 0xff) #define SP_REGION_Y1(l) ((l >> 8) & 0xff) #define SP_REGION_X2(l) ((l >> 16) & 0xff) #define SP_REGION_Y2(l) ((l >> 24) & 0xff) -#define SP_REGION_PACK(x1, y1, x2, y2) \ - (((x1) &0xff) + (((y1) &0xff) << 8) + (((x2) &0xff) << 16) \ - + (((y2) &0xff) << 24)) +#define SP_REGION_PACK(x1, y1, x2, y2) \ + (((x1) & 0xff) + (((y1) & 0xff) << 8) + (((x2) & 0xff) << 16) \ + + (((y2) & 0xff) << 24)) -#define SP_MONST_CLASS(l) (l & 0xff) -#define SP_MONST_PM(l) ((l >> 8) & 0xffff) -#define SP_MONST_PACK(m, c) (((m) << 8) + ((char) (c))) +/* permonst index, object index, and lit value might be negative; + * add 10 to accept -1 through -9 while forcing non-negative for bit shift + */ +#define SP_MONST_CLASS(l) ((l) & 0xff) +#define SP_MONST_PM(l) ((((l) >> 8) & 0xffff) - 10) +#define SP_MONST_PACK(pm, cls) (((10 + (pm)) << 8) | ((cls) & 0xff)) -#define SP_OBJ_CLASS(l) (l & 0xff) -#define SP_OBJ_TYP(l) ((l >> 8) & 0xffff) -#define SP_OBJ_PACK(o, c) (((o) << 8) + ((char) (c))) +#define SP_OBJ_CLASS(l) ((l) & 0xff) +#define SP_OBJ_TYP(l) ((((l) >> 8) & 0xffff) - 10) +#define SP_OBJ_PACK(ob, cls) (((10 + (ob)) << 8) | ((cls) & 0xff)) -#define SP_MAPCHAR_TYP(l) (l & 0xff) -#define SP_MAPCHAR_LIT(l) ((l >> 8) & 0xff) -#define SP_MAPCHAR_PACK(typ, lit) (((lit) << 8) + ((char) (typ))) +#define SP_MAPCHAR_TYP(l) ((l) & 0xff) +#define SP_MAPCHAR_LIT(l) ((((l) >> 8) & 0xffff) - 10) +#define SP_MAPCHAR_PACK(typ, lit) (((10 + (lit)) << 8) | ((typ) & 0xff)) struct opvar { xchar spovartyp; /* one of SPOVAR_foo */ diff --git a/src/botl.c b/src/botl.c index fd1880cf5..8fc6ab521 100644 --- a/src/botl.c +++ b/src/botl.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 botl.c $NHDT-Date: 1452660188 2016/01/13 04:43:08 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.70 $ */ +/* NetHack 3.6 botl.c $NHDT-Date: 1469930895 2016/07/31 02:08:15 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.75 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1311,17 +1311,18 @@ boolean from_configfile; /* Now finally, we notify the window port */ if (!from_configfile) status_threshold(idx, status_hilites[idx].anytype, - status_hilites[idx].threshold, - status_hilites[idx].behavior, - status_hilites[idx].coloridx[0], - status_hilites[idx].coloridx[1]); + status_hilites[idx].threshold, + status_hilites[idx].behavior, + status_hilites[idx].coloridx[0], + status_hilites[idx].coloridx[1]); return TRUE; } +/*ARGUSED*/ void status_notify_windowport(all) -boolean all; +boolean all UNUSED; { int idx; anything it; diff --git a/src/dungeon.c b/src/dungeon.c index 8a93b5e5c..78dd19d6c 100644 --- a/src/dungeon.c +++ b/src/dungeon.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 dungeon.c $NHDT-Date: 1462486971 2016/05/05 22:22:51 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.73 $ */ +/* NetHack 3.6 dungeon.c $NHDT-Date: 1470275509 2016/08/04 01:51:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.76 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2864,7 +2864,9 @@ boolean printdun; Sprintf(eos(buf), " \"%s\"", mptr->custom); if (on_level(&u.uz, &mptr->lev)) Sprintf(eos(buf), " <- You %s here.", - (!final || (final == 1 && how == ASCENDED)) ? "are" : "were"); + (!final || (final == 1 && how == ASCENDED)) ? "are" + : (final == 1 && how == ESCAPED) ? "left from" + : "were"); putstr(win, !final ? ATR_BOLD : 0, buf); if (mptr->flags.forgot) diff --git a/src/eat.c b/src/eat.c index 52e29def5..ff5390496 100644 --- a/src/eat.c +++ b/src/eat.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 eat.c $NHDT-Date: 1467028559 2016/06/27 11:55:59 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.171 $ */ +/* NetHack 3.6 eat.c $NHDT-Date: 1470272344 2016/08/04 00:59:04 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.172 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1662,22 +1662,33 @@ struct obj *otmp; } else if (mnum == PM_FLOATING_EYE && u.umonnum == PM_RAVEN) { You("peck the eyeball with delight."); } else { - /* [is this right? omnivores end up always disliking the taste] */ - boolean yummy = vegan(&mons[mnum]) - ? (!carnivorous(youmonst.data) - && herbivorous(youmonst.data)) - : (carnivorous(youmonst.data) - && !herbivorous(youmonst.data)); + /* yummy is always False for omnivores, palatable always True */ + boolean yummy = (vegan(&mons[mnum]) + ? (!carnivorous(youmonst.data) + && herbivorous(youmonst.data)) + : (carnivorous(youmonst.data) + && !herbivorous(youmonst.data))), + palatable = (vegetarian(&mons[mnum]) + ? herbivorous(youmonst.data) + : carnivorous(youmonst.data)); + const char *pmxnam = food_xname(otmp, FALSE); + if (!strncmpi(pmxnam, "the ", 4)) + pmxnam += 4; pline("%s%s %s!", type_is_pname(&mons[mnum]) - ? "" : the_unique_pm(&mons[mnum]) ? "The " : "This ", - food_xname(otmp, FALSE), + ? "" : the_unique_pm(&mons[mnum]) ? "The " : "This ", + pmxnam, + /* tiger reference is to TV ads for "Frosted Flakes", + breakfast cereal targeted at kids by "Tony the tiger" */ Hallucination ? (yummy ? ((u.umonnum == PM_TIGER) ? "is gr-r-reat" : "is gnarly") - : "is grody") - : (yummy ? "is delicious" : "tastes terrible")); + : palatable ? "is copacetic" + : "is grody") + : (yummy ? "tastes delicious" + : palatable ? "tastes okay" + : "tastes terrible")); } return retcode; diff --git a/src/mhitm.c b/src/mhitm.c index 273fecf09..e4a5d9f39 100644 --- a/src/mhitm.c +++ b/src/mhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mhitm.c $NHDT-Date: 1456992461 2016/03/03 08:07:41 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.86 $ */ +/* NetHack 3.6 mhitm.c $NHDT-Date: 1470819842 2016/08/10 09:04:02 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.92 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1522,7 +1522,7 @@ int mdead; goto assess_dmg; case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */ if (mhit && !mdef->mcan && otmp) { - (void) drain_item(otmp); + (void) drain_item(otmp, FALSE); /* No message */ } break; diff --git a/src/mhitu.c b/src/mhitu.c index e07718fda..1cdd7bce7 100644 --- a/src/mhitu.c +++ b/src/mhitu.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mhitu.c $NHDT-Date: 1456992469 2016/03/03 08:07:49 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.136 $ */ +/* NetHack 3.6 mhitu.c $NHDT-Date: 1470819843 2016/08/10 09:04:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.144 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1597,7 +1597,27 @@ register struct attack *mattk; if (uncancelled) { struct obj *obj = some_armor(&youmonst); - if (drain_item(obj)) { + if (!obj) { + /* some rings are susceptible; + amulets and blindfolds aren't (at present) */ + switch (rn2(5)) { + case 0: + break; + case 1: + obj = uright; + break; + case 2: + obj = uleft; + break; + case 3: + obj = uamul; + break; + case 4: + obj = ublindf; + break; + } + } + if (drain_item(obj, FALSE)) { pline("%s less effective.", Yobjnam2(obj, "seem")); } } @@ -2691,7 +2711,9 @@ register struct attack *mattk; } case AD_ENCH: /* KMH -- remove enchantment (disenchanter) */ if (otmp) { - (void) drain_item(otmp); + /* by_you==True: passive counterattack to hero's action + is hero's fault */ + (void) drain_item(otmp, TRUE); /* No message */ } return 1; diff --git a/src/mkmaze.c b/src/mkmaze.c index c02c26fe2..639b17108 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mkmaze.c $NHDT-Date: 1461571093 2016/04/25 07:58:13 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.47 $ */ +/* NetHack 3.6 mkmaze.c $NHDT-Date: 1469930897 2016/07/31 02:08:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.50 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -47,7 +47,7 @@ STATIC_OVL int iswall(x, y) int x, y; { - register int type; + int type; if (!isok(x, y)) return 0; @@ -132,7 +132,7 @@ wall_cleanup(x1, y1, x2, y2) int x1, y1, x2, y2; { uchar type; - register int x, y; + int x, y; struct rm *lev; /* sanity check on incoming variables */ @@ -164,7 +164,7 @@ fix_wall_spines(x1, y1, x2, y2) int x1, y1, x2, y2; { uchar type; - register int x,y; + int x, y; struct rm *lev; int FDECL((*loc_f), (int, int)); int bits; @@ -232,7 +232,7 @@ int x1, y1, x2, y2; STATIC_OVL boolean okay(x, y, dir) int x, y; -register int dir; +int dir; { mz_move(x, y, dir); mz_move(x, y, dir); @@ -466,9 +466,9 @@ static boolean was_waterlevel; /* ugh... this shouldn't be needed */ void fixup_special() { - register lev_region *r = lregions; + lev_region *r = lregions; struct d_level lev; - register int x, y; + int x, y; struct mkroom *croom; boolean added_branch = FALSE; @@ -606,7 +606,7 @@ fixup_special() create_secret_door(croom, W_ANY); } else if (on_level(&u.uz, &orcus_level)) { - register struct monst *mtmp, *mtmp2; + struct monst *mtmp, *mtmp2; /* it's a ghost town, get rid of shopkeepers */ for (mtmp = fmon; mtmp; mtmp = mtmp2) { @@ -631,7 +631,7 @@ fixup_special() void makemaz(s) -register const char *s; +const char *s; { int x, y; char protofile[20]; @@ -850,7 +850,7 @@ walkfrom(x, y, typ) int x, y; schar typ; { - register int q, a, dir; + int q, a, dir; int dirs[4]; if (!typ) { @@ -898,7 +898,8 @@ coord *cc; && levl[cc->x][cc->y].typ != (level.flags.corrmaze ? CORR : ROOM)); if (cpt >= 100) { - register int x, y; + int x, y; + /* last try */ for (x = 0; x < (x_maze_max >> 1) - 1; x++) for (y = 0; y < (y_maze_max >> 1) - 1; y++) { @@ -926,9 +927,9 @@ coord *cc; void bound_digging() { - register int x, y; - register unsigned typ; - register struct rm *lev; + int x, y; + unsigned typ; + struct rm *lev; boolean found, nonwall; int xmin, xmax, ymin, ymax; @@ -1035,8 +1036,10 @@ fumaroles() for (n = rn2(3) + 2; n; n--) { xchar x = rn1(COLNO - 4, 3); xchar y = rn1(ROWNO - 4, 3); + if (levl[x][y].typ == LAVAPOOL) { NhRegion *r = create_gas_cloud(x, y, 4 + rn2(5), rn1(10, 5)); + clear_heros_fault(r); snd = TRUE; if (distu(x, y) < 15) @@ -1054,11 +1057,6 @@ fumaroles() * other source files, but they are all so nicely encapsulated here. */ -#ifdef DEBUG -/* to ease the work of debuggers at this stage */ -#define register -#endif - #define CONS_OBJ 0 #define CONS_MON 1 #define CONS_HERO 2 @@ -1082,8 +1080,8 @@ void movebubbles() { static boolean up; - register struct bubble *b; - register int x, y, i, j; + struct bubble *b; + int x, y, i, j; struct trap *btrap; static const struct rm water_pos = { cmap_to_glyph(S_water), WATER, 0, 0, 0, 0, 0, 0, 0, 0 }; @@ -1205,7 +1203,7 @@ movebubbles() */ up = !up; for (b = up ? bbubbles : ebubbles; b; b = up ? b->next : b->prev) { - register int rx = rn2(3), ry = rn2(3); + int rx = rn2(3), ry = rn2(3); mv_bubble(b, b->dx + 1 - (!b->dx ? rx : (rx ? 1 : 0)), b->dy + 1 - (!b->dy ? ry : (ry ? 1 : 0)), FALSE); @@ -1221,8 +1219,8 @@ movebubbles() void water_friction() { - register int x, y, dx, dy; - register boolean eff = FALSE; + int x, y, dx, dy; + boolean eff = FALSE; if (Swimming && rn2(4)) return; /* natural swimmers have advantage */ @@ -1256,7 +1254,7 @@ void save_waterlevel(fd, mode) int fd, mode; { - register struct bubble *b; + struct bubble *b; if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz)) return; @@ -1279,11 +1277,10 @@ int fd, mode; void restore_waterlevel(fd) -register int fd; +int fd; { - register struct bubble *b = (struct bubble *) 0, *btmp; - register int i; - int n; + struct bubble *b = (struct bubble *) 0, *btmp; + int i, n; if (!Is_waterlevel(&u.uz) && !Is_airlevel(&u.uz)) return; @@ -1316,7 +1313,7 @@ const char * waterbody_name(x, y) xchar x, y; { - register struct rm *lev; + struct rm *lev; schar ltyp; if (!isok(x, y)) @@ -1355,10 +1352,10 @@ set_wportal() STATIC_OVL void setup_waterlevel() { - register int x, y; - register int xskip, yskip; - register int water_glyph = cmap_to_glyph(S_water); - register int air_glyph = cmap_to_glyph(S_air); + int x, y; + int xskip, yskip; + int water_glyph = cmap_to_glyph(S_water), + air_glyph = cmap_to_glyph(S_air); /* ouch, hardcoded... */ @@ -1391,7 +1388,7 @@ setup_waterlevel() STATIC_OVL void unsetup_waterlevel() { - register struct bubble *b, *bb; + struct bubble *b, *bb; /* free bubbles */ @@ -1404,7 +1401,7 @@ unsetup_waterlevel() STATIC_OVL void mk_bubble(x, y, n) -register int x, y, n; +int x, y, n; { /* * These bit masks make visually pleasing bubbles on a normal aspect @@ -1413,14 +1410,15 @@ register int x, y, n; * in situ, either. The first two elements tell the dimensions of * the bubble's bounding box. */ - static uchar bm2[] = { 2, 1, 0x3 }, bm3[] = { 3, 2, 0x7, 0x7 }, + static uchar bm2[] = { 2, 1, 0x3 }, + bm3[] = { 3, 2, 0x7, 0x7 }, bm4[] = { 4, 3, 0x6, 0xf, 0x6 }, bm5[] = { 5, 3, 0xe, 0x1f, 0xe }, bm6[] = { 6, 4, 0x1e, 0x3f, 0x3f, 0x1e }, bm7[] = { 7, 4, 0x3e, 0x7f, 0x7f, 0x3e }, bm8[] = { 8, 4, 0x7e, 0xff, 0xff, 0x7e }, *bmask[] = { bm2, bm3, bm4, bm5, bm6, bm7, bm8 }; - register struct bubble *b; + struct bubble *b; if (x >= bxmax || y >= bymax) return; @@ -1466,11 +1464,11 @@ register int x, y, n; */ STATIC_OVL void mv_bubble(b, dx, dy, ini) -register struct bubble *b; -register int dx, dy; -register boolean ini; +struct bubble *b; +int dx, dy; +boolean ini; { - register int x, y, i, j, colli = 0; + int x, y, i, j, colli = 0; struct container *cons, *ctemp; /* clouds move slowly */ diff --git a/src/mondata.c b/src/mondata.c index 0e924f3fc..a9d054f4c 100644 --- a/src/mondata.c +++ b/src/mondata.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 mondata.c $NHDT-Date: 1446604115 2015/11/04 02:28:35 $ $NHDT-Branch: master $:$NHDT-Revision: 1.58 $ */ +/* NetHack 3.6 mondata.c $NHDT-Date: 1470966820 2016/08/12 01:53:40 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.61 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -855,16 +855,12 @@ int *mndx_p; if ((p = strstri(x, in_str)) != 0 && (p == x || *(p - 1) == ' ')) return i; } - /* check individual species names; not as thorough as mon_to_name() - but our caller can call that directly if desired */ - for (i = LOW_PM; i < NUMMONS; i++) { - x = mons[i].mname; - if ((p = strstri(x, in_str)) != 0 - && (p == x || *(p - 1) == ' ')) { - if (mndx_p) - *mndx_p = i; - return mons[i].mlet; - } + /* check individual species names */ + i = name_to_mon(in_str); + if (i != NON_PM) { + if (mndx_p) + *mndx_p = i; + return mons[i].mlet; } } return 0; diff --git a/src/objnam.c b/src/objnam.c index 24e444056..d395ea747 100644 --- a/src/objnam.c +++ b/src/objnam.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 objnam.c $NHDT-Date: 1462067746 2016/05/01 01:55:46 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.169 $ */ +/* NetHack 3.6 objnam.c $NHDT-Date: 1471112245 2016/08/13 18:17:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.178 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -17,6 +17,7 @@ STATIC_DCL char *NDECL(nextobuf); STATIC_DCL void FDECL(releaseobuf, (char *)); STATIC_DCL char *FDECL(minimal_xname, (struct obj *)); STATIC_DCL void FDECL(add_erosion_words, (struct obj *, char *)); +STATIC_DCL char *FDECL(doname_base, (struct obj *obj, unsigned)); STATIC_DCL boolean FDECL(singplur_lookup, (char *, char *, BOOLEAN_P, const char *const *)); STATIC_DCL char *FDECL(singplur_compound, (char *)); @@ -580,7 +581,7 @@ unsigned cxn_flags; /* bitmask of CXN_xxx values */ brown potion -- if oc_name_known not set potion of object detection -- if discovered */ -static char * +STATIC_OVL char * minimal_xname(obj) struct obj *obj; { @@ -756,12 +757,17 @@ struct obj *obj; return FALSE; } -static char * -doname_base(obj, with_price) -register struct obj *obj; -boolean with_price; +#define DONAME_WITH_PRICE 1 +#define DONAME_VAGUE_QUAN 2 + +STATIC_OVL char * +doname_base(obj, doname_flags) +struct obj *obj; +unsigned doname_flags; { - boolean ispoisoned = FALSE; + boolean ispoisoned = FALSE, + with_price = (doname_flags & DONAME_WITH_PRICE) != 0, + vague_quan = (doname_flags & DONAME_VAGUE_QUAN) != 0; boolean known, dknown, cknown, bknown, lknown; int omndx = obj->corpsenm; char prefix[PREFIX]; @@ -792,7 +798,7 @@ boolean with_price; } if (obj->quan != 1L) { - if (dknown) + if (dknown || !vague_quan) Sprintf(prefix, "%ld ", obj->quan); else Strcpy(prefix, "some "); @@ -816,11 +822,11 @@ boolean with_price; making the prefix be redundant; note that 'known' flag isn't set when emptiness gets discovered because then charging magic would yield known number of new charges) */ - && (obj->otyp == BAG_OF_TRICKS + && ((obj->otyp == BAG_OF_TRICKS) ? (obj->spe == 0 && !obj->known) /* not bag of tricks: empty if container which has no contents */ - : (Is_container(obj) || obj->otyp == STATUE) - && !Has_contents(obj))) + : ((Is_container(obj) || obj->otyp == STATUE) + && !Has_contents(obj)))) Strcat(prefix, "empty "); if (bknown && obj->oclass != COIN_CLASS @@ -872,11 +878,9 @@ boolean with_price; Strcat(prefix, "greased "); if (cknown && Has_contents(obj)) { - /* we count all objects (obj->quantity); perhaps we should - count separate stacks instead (or even introduce a user - preference option to choose between the two alternatives) - since it's somewhat odd so see "containing 1002 items" - when there are 2 scrolls plus 1000 gold pieces */ + /* we count the number of separate stacks, which corresponds + to the number of inventory slots needed to be able to take + everything out if no merges occur */ long itemcount = count_contents(obj, FALSE, FALSE, TRUE); Sprintf(eos(bp), " containing %ld item%s", itemcount, @@ -960,8 +964,13 @@ boolean with_price; if (obj->oeaten) Strcat(prefix, "partly eaten "); if (obj->otyp == CORPSE) { - Sprintf(prefix, "%s ", - corpse_xname(obj, prefix, CXN_ARTICLE | CXN_NOCORPSE)); + /* (quan == 1) => want corpse_xname() to supply article, + (quan != 1) => already have count or "some" as prefix; + "corpse" is already in the buffer returned by xname() */ + unsigned cxarg = (((obj->quan != 1L) ? 0 : CXN_ARTICLE) + | CXN_NOCORPSE); + + Sprintf(prefix, "%s ", corpse_xname(obj, prefix, cxarg)); } else if (obj->otyp == EGG) { #if 0 /* corpses don't tell if they're stale either */ if (known && stale_egg(obj)) @@ -1074,23 +1083,43 @@ boolean with_price; char * doname(obj) -register struct obj *obj; +struct obj *obj; { - return doname_base(obj, FALSE); + return doname_base(obj, (unsigned) 0); } /* Name of object including price. */ char * doname_with_price(obj) -register struct obj *obj; +struct obj *obj; { - return doname_base(obj, TRUE); + return doname_base(obj, DONAME_WITH_PRICE); +} + +/* "some" instead of precise quantity if obj->dknown not set */ +char * +doname_vague_quan(obj) +struct obj *obj; +{ + /* Used by farlook. + * If it hasn't been seen up close and quantity is more than one, + * use "some" instead of the quantity: "some gold pieces" rather + * than "25 gold pieces". This is suboptimal, to put it mildly, + * because lookhere and pickup report the precise amount. + * Picking the item up while blind also shows the precise amount + * for inventory display, then dropping it while still blind leaves + * obj->dknown unset so the count reverts to "some" for farlook. + * + * TODO: add obj->qknown flag for 'quantity known' on stackable + * items; it could overlay obj->cknown since no containers stack. + */ + return doname_base(obj, DONAME_VAGUE_QUAN); } /* used from invent.c */ boolean not_fully_identified(otmp) -register struct obj *otmp; +struct obj *otmp; { /* gold doesn't have any interesting attributes [yet?] */ if (otmp->oclass == COIN_CLASS) @@ -3448,14 +3477,14 @@ typfnd: otmp->spe = 0; /* No spinach */ if (dead_species(mntmp, FALSE)) { otmp->corpsenm = NON_PM; /* it's empty */ - } else if (!(mons[mntmp].geno & G_UNIQ) + } else if ((!(mons[mntmp].geno & G_UNIQ) || wizard) && !(mvitals[mntmp].mvflags & G_NOCORPSE) && mons[mntmp].cnutrit != 0) { otmp->corpsenm = mntmp; } break; case CORPSE: - if (!(mons[mntmp].geno & G_UNIQ) + if ((!(mons[mntmp].geno & G_UNIQ) || wizard) && !(mvitals[mntmp].mvflags & G_NOCORPSE)) { if (mons[mntmp].msound == MS_GUARDIAN) mntmp = genus(mntmp, 1); diff --git a/src/options.c b/src/options.c index 1245c276b..4edc94fe0 100644 --- a/src/options.c +++ b/src/options.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 options.c $NHDT-Date: 1461102048 2016/04/19 21:40:48 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.268 $ */ +/* NetHack 3.6 options.c $NHDT-Date: 1470357737 2016/08/05 00:42:17 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.279 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -500,6 +500,7 @@ static boolean initial, from_file; STATIC_DCL void FDECL(nmcpy, (char *, const char *, int)); STATIC_DCL void FDECL(escapes, (const char *, char *)); STATIC_DCL void FDECL(rejectoption, (const char *)); +STATIC_DCL void FDECL(badoptmsg, (const char *, const char *)); STATIC_DCL void FDECL(badoption, (const char *)); STATIC_DCL char *FDECL(string_for_opt, (char *, BOOLEAN_P)); STATIC_DCL char *FDECL(string_for_env_opt, (const char *, char *, BOOLEAN_P)); @@ -927,40 +928,43 @@ const char *optname; } STATIC_OVL void -badoption(opts) +badoptmsg(opts, reason) const char *opts; +const char *reason; /* "Bad syntax" or "Missing value" */ { + const char *linesplit = ""; + if (!initial) { if (!strncmp(opts, "h", 1) || !strncmp(opts, "?", 1)) option_help(); else - pline("Bad syntax: %s. Enter \"?g\" for help.", opts); + pline("%s: %s. Enter \"?g\" for help.", reason, opts); return; - } #ifdef MAC - else + } else { return; #endif + } +#ifdef WIN32 + linesplit = "\n"; +#endif if (from_file) - raw_printf("Bad syntax in OPTIONS in %s: %s%s.\n", configfile, -#ifdef WIN32 - "\n", -#else - "", -#endif - opts); + raw_printf("%s in OPTIONS in %s: %s%s.\n", + reason, configfile, linesplit, opts); else - raw_printf("Bad syntax in NETHACKOPTIONS: %s%s.\n", -#ifdef WIN32 - "\n", -#else - "", -#endif - opts); + raw_printf("%s in NETHACKOPTIONS: %s%s.\n", + reason, linesplit, opts); wait_synch(); } +STATIC_OVL void +badoption(opts) +const char *opts; +{ + badoptmsg(opts, "Bad syntax"); +} + STATIC_OVL char * string_for_opt(opts, val_optional) char *opts; @@ -975,7 +979,7 @@ boolean val_optional; if (!colon || !*++colon) { if (!val_optional) - badoption(opts); + badoptmsg(opts, "Missing value"); return (char *) 0; } return colon; @@ -2700,7 +2704,9 @@ boolean tinitial, tfrom_file; bad_negation(fullname, FALSE); if (duplicate || negated) return; - op = string_for_opt(opts, TRUE); + op = string_for_opt(opts, FALSE); + if (!op) + return; if (!strncmpi(op, "normal", 6) || !strcmpi(op, "play")) { wizard = discover = FALSE; } else if (!strncmpi(op, "explore", 6) diff --git a/src/pager.c b/src/pager.c index b00c425a9..de932073d 100644 --- a/src/pager.c +++ b/src/pager.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pager.c $NHDT-Date: 1466638086 2016/06/22 23:28:06 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.111 $ */ +/* NetHack 3.6 pager.c $NHDT-Date: 1471112245 2016/08/13 18:17:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.112 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -203,7 +203,7 @@ int x, y, glyph; if (otmp) { Strcpy(buf, (otmp->otyp != STRANGE_OBJECT) - ? distant_name(otmp, doname) + ? distant_name(otmp, doname_vague_quan) : obj_descr[STRANGE_OBJECT].oc_name); if (fakeobj) dealloc_obj(otmp), otmp = 0; diff --git a/src/pickup.c b/src/pickup.c index 0f8b5b5d4..4b42be708 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pickup.c $NHDT-Date: 1461919368 2016/04/29 08:42:48 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.177 $ */ +/* NetHack 3.6 pickup.c $NHDT-Date: 1470449858 2016/08/06 02:17:38 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.184 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -21,7 +21,7 @@ STATIC_DCL boolean FDECL(all_but_uchain, (struct obj *)); #if 0 /* not used */ STATIC_DCL boolean FDECL(allow_cat_no_uchain, (struct obj *)); #endif -STATIC_DCL boolean FDECL(autopick_testobj, (struct obj *)); +STATIC_DCL boolean FDECL(autopick_testobj, (struct obj *, BOOLEAN_P)); STATIC_DCL int FDECL(autopick, (struct obj *, int, menu_item **)); STATIC_DCL int FDECL(count_categories, (struct obj *, int)); STATIC_DCL long FDECL(carry_count, (struct obj *, struct obj *, long, @@ -685,30 +685,42 @@ boolean grab; /* forced pickup, rather than forced leave behind? */ /* * Does the text description of this match an exception? */ - char *objdesc = makesingular(doname(obj)); struct autopickup_exception *ape = (grab) ? iflags.autopickup_exceptions[AP_GRAB] : iflags.autopickup_exceptions[AP_LEAVE]; - while (ape) { - if (regex_match(objdesc, ape->regex)) - return TRUE; - ape = ape->next; + if (ape) { + char *objdesc = makesingular(doname(obj)); + + while (ape) { + if (regex_match(objdesc, ape->regex)) + return TRUE; + ape = ape->next; + } } return FALSE; } -boolean -autopick_testobj(otmp) +STATIC_OVL boolean +autopick_testobj(otmp, calc_costly) struct obj *otmp; +boolean calc_costly; { + static boolean costly = FALSE; const char *otypes = flags.pickup_types; - /* pick if in pickup_types and not unpaid item in shop */ - boolean pickit = ((!*otypes || index(otypes, otmp->oclass)) - && !(otmp->where == OBJ_FLOOR - && !otmp->no_charge - && isok(otmp->ox, otmp->oy) - && costly_spot(otmp->ox, otmp->oy))); + boolean pickit; + + /* calculate 'costly' just once for a given autopickup operation */ + if (calc_costly) + costly = (otmp->where == OBJ_FLOOR + && costly_spot(otmp->ox, otmp->oy)); + + /* first check: reject if an unpaid item in a shop */ + if (costly && !otmp->no_charge) + return FALSE; + + /* check for pickup_types */ + pickit = (!*otypes || index(otypes, otmp->oclass)); /* check for "always pick up */ if (!pickit) pickit = is_autopickup_exception(otmp, TRUE); @@ -737,17 +749,19 @@ menu_item **pick_list; /* list of objects and counts to pick up */ menu_item *pi; /* pick item */ struct obj *curr; int n; + boolean check_costly = TRUE; /* first count the number of eligible items */ for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow)) { - if (autopick_testobj(curr)) + if (autopick_testobj(curr, check_costly)) ++n; + check_costly = FALSE; /* only need to check once per autopickup */ } if (n) { *pick_list = pi = (menu_item *) alloc(sizeof (menu_item) * n); for (n = 0, curr = olist; curr; curr = FOLLOW(curr, follow)) { - if (autopick_testobj(curr)) { + if (autopick_testobj(curr, FALSE)) { pi[n].item.a_obj = curr; pi[n].count = curr->quan; n++; diff --git a/src/uhitm.c b/src/uhitm.c index 1217b5b48..832390694 100644 --- a/src/uhitm.c +++ b/src/uhitm.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 uhitm.c $NHDT-Date: 1460103141 2016/04/08 08:12:21 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.156 $ */ +/* NetHack 3.6 uhitm.c $NHDT-Date: 1470819843 2016/08/10 09:04:03 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.164 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2537,12 +2537,12 @@ boolean wep_was_destroyed; */ void passive_obj(mon, obj, mattk) -register struct monst *mon; -register struct obj *obj; /* null means pick uwep, uswapwep or uarmg */ +struct monst *mon; +struct obj *obj; /* null means pick uwep, uswapwep or uarmg */ struct attack *mattk; /* null means we find one internally */ { struct permonst *ptr = mon->data; - register int i; + int i; /* if caller hasn't specified an object, use uwep, uswapwep or uarmg */ if (!obj) { @@ -2589,7 +2589,7 @@ struct attack *mattk; /* null means we find one internally */ break; case AD_ENCH: if (!mon->mcan) { - if (drain_item(obj) && carried(obj) + if (drain_item(obj, TRUE) && carried(obj) && (obj->known || obj->oclass == ARMOR_CLASS)) { pline("%s less effective.", Yobjnam2(obj, "seem")); } diff --git a/src/zap.c b/src/zap.c index ea246aabb..927bcb1dc 100644 --- a/src/zap.c +++ b/src/zap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 zap.c $NHDT-Date: 1464163779 2016/05/25 08:09:39 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.258 $ */ +/* NetHack 3.6 zap.c $NHDT-Date: 1470819844 2016/08/10 09:04:04 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.263 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -1062,8 +1062,9 @@ register struct obj *obj; * possibly carried by you or a monster */ boolean -drain_item(obj) -register struct obj *obj; +drain_item(obj, by_you) +struct obj *obj; +boolean by_you; { boolean u_ring; @@ -1078,7 +1079,8 @@ register struct obj *obj; return FALSE; /* Charge for the cost of the object */ - costly_alteration(obj, COST_DRAIN); + if (by_you) + costly_alteration(obj, COST_DRAIN); /* Drain the object and any implied effects */ obj->spe--; @@ -1110,6 +1112,10 @@ register struct obj *obj; if ((obj->owornmask & W_RING) && u_ring) u.udaminc--; break; + case RIN_PROTECTION: + if (u_ring) + context.botl = 1; /* bot() will recalc u.uac */ + break; case HELM_OF_BRILLIANCE: if ((obj->owornmask & W_ARMH) && (obj == uarmh)) { ABON(A_INT)--; @@ -1123,10 +1129,11 @@ register struct obj *obj; context.botl = 1; } break; - case RIN_PROTECTION: - context.botl = 1; + default: break; } + if (context.botl) + bot(); if (carried(obj)) update_inventory(); return TRUE; @@ -1935,7 +1942,7 @@ struct obj *obj, *otmp; #endif break; case SPE_DRAIN_LIFE: - (void) drain_item(obj); + (void) drain_item(obj, TRUE); break; case WAN_TELEPORTATION: case SPE_TELEPORT_AWAY: diff --git a/win/share/tilemap.c b/win/share/tilemap.c index cae25fdfb..a14d9203e 100644 --- a/win/share/tilemap.c +++ b/win/share/tilemap.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 tilemap.c $NHDT-Date: 1465163425 2016/06/05 21:50:25 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.30 $ */ +/* NetHack 3.6 tilemap.c $NHDT-Date: 1470537037 2016/08/07 02:30:37 $ $NHDT-Branch: NetHack-3.6.0 $:$NHDT-Revision: 1.32 $ */ /* NetHack may be freely redistributed. See license for details. */ /* @@ -464,8 +464,11 @@ FILE *ofp; fprintf(ofp, "%s\n", epilog[i]); } - fprintf(ofp, "\nint total_tiles_used = %d;\n", start); lastothtile = start - 1; +#ifdef STATUES_LOOK_LIKE_MONSTERS + start = laststatuetile + 1; +#endif + fprintf(ofp, "\nint total_tiles_used = %d;\n", start); } int @@ -500,7 +503,9 @@ main() fprintf(ofp, "\n#define MAXMONTILE %d\n", lastmontile); fprintf(ofp, "#define MAXOBJTILE %d\n", lastobjtile); fprintf(ofp, "#define MAXOTHTILE %d\n", lastothtile); - +#ifdef STATUES_LOOK_LIKE_MONSTERS + fprintf(ofp, "/* #define MAXSTATUETILE %d */\n", laststatuetile); +#endif fprintf(ofp, "\n/*tile.c*/\n"); fclose(ofp);