From e676663a64d9016efb8c8f33b7d019adeca9bcc1 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 16 Jun 2015 16:35:54 -0700 Subject: [PATCH 1/5] tribute bits Fix a couple of transcription typos and change the abbreviation of page from 'pg.' to 'p.' since pg looks like it could refer to passage or paragraph. --- dat/tribute | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/dat/tribute b/dat/tribute index a9b303888..3e65c7b32 100644 --- a/dat/tribute +++ b/dat/tribute @@ -937,7 +937,7 @@ There's a fifth element, and generally it's called Surprise. # The actual text is probably only novella length. # %title The Last Hero (7) -# pg. 41 (end of 1st paragraph) +# p. 41 (end of 1st paragraph) %passage 1 Too many people, when listing all the perils to be found in the search for lost treasure or ancient wisdom, had forgotten to put at the top of @@ -945,12 +945,12 @@ the list 'the man who arrived just before you'. [The Last Hero, written by Terry Pratchett, illustrated by Paul Kidby] %e passage -# pg. 5 (1st page of text, 4th & 5th paragraphs) +# p. 5 (1st page of text, 4th & 5th paragraphs) # second paragraph is a bit "on the nose" but is too good to leave out %passage 2 The reason for the story was a mix of many things. There was humanity's -desire to do forebidden deeds merely because they were forebidden. -There was its desire to find new horizon's and kill the people who live +desire to do forebidden deeds merely because they were forbidden. +There was its desire to find new horizons and kill the people who live beyond them. There were the mysterious scrolls. There was the cucumber. But mostly there was the knowledge that one day, it would all be over. @@ -964,7 +964,7 @@ or become really, really angry. [The Last Hero, written by Terry Pratchett, illustrated by Paul Kidby] %e passage -# pg. 19 (bottom 20%) +# p. 19 (bottom 20%) %passage 3 'And they're /heroes/,' said Mr Betteridge of the Guild of Historians. @@ -982,7 +982,7 @@ heroes. You had civilisation, such as it was, and you had heroes. [The Last Hero, written by Terry Pratchett, illustrated by Paul Kidby] %e passage -# pg. 25 (2nd & 3rd fifths) +# p. 25 (2nd & 3rd fifths) %passage 4 They were, all of them, old men. Their background conversation was a litany of complaints about feet, stomachs and backs. They moved @@ -995,7 +995,7 @@ the word 'fear'. It was something that happened to other people. [The Last Hero, written by Terry Pratchett, illustrated by Paul Kidby] %e passage -# pg. 97 (middle) +# p. 97 (middle) %passage 5 Captain Carrot saluted. 'Force is always the last resort, sir,' he said. @@ -1017,7 +1017,7 @@ roughly speaking, it means, "We who are about to die don't want to", sir.' [The Last Hero, written by Terry Pratchett, illustrated by Paul Kidby] %e passage -# pg. 125 (near top, then continued half way down) +# p. 125 (near top, then continued half way down) %passage 6 'A good wizard, Rincewind,' said the Chair of Indefinite Studies. 'Not particularly bright, but, frankly, I've never been quite happy with @@ -1038,7 +1038,7 @@ lucky guessing was what being a wizard was all about. [The Last Hero, written by Terry Pratchett, illustrated by Paul Kidby] %e passage -# pg. 146 (top) +# p. 146 (top) %passage 7 Evil Harry looked down and shuffled his feet, his face a battle between pride and relief. From 2939a28aa166543b05d57bbc75972661cf050db9 Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 16 Jun 2015 21:37:12 -0400 Subject: [PATCH 2/5] avoid complaints regarding "and" placement --- src/version.c | 79 +++++++++++++++++++++++++++++++-------------------- 1 file changed, 48 insertions(+), 31 deletions(-) diff --git a/src/version.c b/src/version.c index 84ec78989..5105114d0 100644 --- a/src/version.c +++ b/src/version.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 version.c $NHDT-Date: 1434446944 2015/06/16 09:29:04 $ $NHDT-Branch: master $:$NHDT-Revision: 1.33 $ */ +/* NetHack 3.6 version.c $NHDT-Date: 1434505027 2015/06/17 01:37:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -17,7 +17,7 @@ #define BETA_INFO "Beta2" -STATIC_DCL void FDECL(insert_rtoptions, (winid,char *)); +STATIC_DCL void FDECL(insert_rtoptions, (winid,char *,const char *)); /* fill buffer with short version (so caller can avoid including date.h) */ char * @@ -112,13 +112,13 @@ doextversion() continue; if (!rtadded) { - pd = eos(buf); - pd--; - if (*pd == '.' && strlen(buf) > 1) { - insert_rtoptions(win, buf); - rtadded = TRUE; /* only do it once */ - *buf = 0; - } + const char *catchphrase = ", and basic NetHack features."; + pd = strstri(buf, catchphrase); + if (pd) { + *pd = '\0'; + insert_rtoptions(win, buf, &catchphrase[2]); + rtadded = TRUE; /* only do it once */ + } } if (*buf) putstr(win, 0, buf); @@ -144,42 +144,59 @@ static const char indent[] = " "; * game image, so we insert those options here. */ STATIC_OVL void -insert_rtoptions(win, buf) +insert_rtoptions(win, buf, finalphrase) winid win; char *buf; +const char *finalphrase; { char rtbuf[BUFSZ]; - char *pd; - int l, i = 0; + int l, i, k; + const char *s1 = 0, *s2 = 0, *s3 = 0, *s4 = 0; - if (strlen(buf) >= BUFSZ - 3) + if ((int)strlen(buf) >= (BUFSZ - 1)) return; strcpy(rtbuf, buf); - pd = eos(rtbuf); - pd--; - if (*pd == '.') - *pd = 0; - Strcat(rtbuf, ", "); - l = strlen(rtbuf); + k = SIZE(rt_opts) + 1; - for (i = 0; i < SIZE(rt_opts); i++) { - if (l + strlen(rt_opts[i]) > COLNO - 5) { - putstr(win, 0, rtbuf); - if (strlen(rt_opts[i]) < BUFSZ - (1 + strlen(indent))) { - Strcpy(rtbuf, indent); - } + for (i = 0; i < (SIZE(rt_opts) + 1); i += 2) { + if (i < SIZE(rt_opts)) { + s1 = ", "; + s2 = rt_opts[i]; + s3 = " "; + s4 = rt_opts[i+1]; + } else { + s1 = " "; + s2 = finalphrase; + s3 = ""; + s4 = ""; } - Strcat(rtbuf, rt_opts[i]); - l = strlen(rtbuf); - if (i % 2) - Strcat(rtbuf, (i < SIZE(rt_opts)- 1) ? "," : "."), l++; - else - Strcat(rtbuf, " "), l++; + l = (int)strlen(rtbuf) + (int)strlen(s1) + (int)strlen(s2) + + (int)strlen(s3) + (int)strlen(s4) + 1; + if (l <= (COLNO - 5) && l < (BUFSZ-1)) { + Strcat(rtbuf, s1); + Strcat(rtbuf, s2); + Strcat(rtbuf, s3); + Strcat(rtbuf, s4); + } else { + putstr(win, 0, rtbuf); + if (i >= SIZE(rt_opts)) + s1 = ""; + l = (int)strlen(indent) + (int)strlen(s1) + (int)strlen(s2) + + (int)strlen(s3) + (int)strlen(s4) + 1; + if (l <= (COLNO -5) && l < (BUFSZ-1)) { + Strcpy(rtbuf, indent); + Strcat(rtbuf, s1); + Strcat(rtbuf, s2); + Strcat(rtbuf, s3); + Strcat(rtbuf, s4); + } + } } if (l) putstr(win, 0, rtbuf); + *buf = '\0'; } #ifdef MICRO From 5dc0a5747a5fa96ae187ad4452d0524b06d9880b Mon Sep 17 00:00:00 2001 From: nhmall Date: Tue, 16 Jun 2015 21:45:59 -0400 Subject: [PATCH 3/5] majority opinion on cppregex.cpp declaration --- src/version.c | 6 ++---- sys/share/cppregex.cpp | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/version.c b/src/version.c index 5105114d0..2098427c3 100644 --- a/src/version.c +++ b/src/version.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 version.c $NHDT-Date: 1434505027 2015/06/17 01:37:07 $ $NHDT-Branch: master $:$NHDT-Revision: 1.34 $ */ +/* NetHack 3.6 version.c $NHDT-Date: 1434505545 2015/06/17 01:45:45 $ $NHDT-Branch: master $:$NHDT-Revision: 1.35 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -150,15 +150,13 @@ char *buf; const char *finalphrase; { char rtbuf[BUFSZ]; - int l, i, k; + int l, i; const char *s1 = 0, *s2 = 0, *s3 = 0, *s4 = 0; if ((int)strlen(buf) >= (BUFSZ - 1)) return; strcpy(rtbuf, buf); - k = SIZE(rt_opts) + 1; - for (i = 0; i < (SIZE(rt_opts) + 1); i += 2) { if (i < SIZE(rt_opts)) { s1 = ", "; diff --git a/sys/share/cppregex.cpp b/sys/share/cppregex.cpp index 840d7f939..9d3e88eff 100644 --- a/sys/share/cppregex.cpp +++ b/sys/share/cppregex.cpp @@ -10,7 +10,7 @@ extern "C" { #include - char regex_id[] = "cppregex"; + extern const char regex_id[] = "cppregex"; struct nhregex { std::unique_ptr re; From da1ae4a7da179f2ff2048880e869e7658b4f72c2 Mon Sep 17 00:00:00 2001 From: PatR Date: Tue, 16 Jun 2015 19:23:43 -0700 Subject: [PATCH 4/5] Make #tip at a location which has multiple containers honor menustyle rather than always use a menu. Only affects menustyle:traditional and can be overridden at the time by using the 'm' prefix before the #tip command. When using the menu, add an explicit pick-from-inventory choice. The behavior there stays the same: ask about inventory if no floor container is chosen. --- src/cmd.c | 5 +++-- src/pickup.c | 51 ++++++++++++++++++++++++++++++++++++--------------- 2 files changed, 39 insertions(+), 17 deletions(-) diff --git a/src/cmd.c b/src/cmd.c index 7703233e6..6d0f84dff 100644 --- a/src/cmd.c +++ b/src/cmd.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 cmd.c $NHDT-Date: 1434071945 2015/06/12 01:19:05 $ $NHDT-Branch: master $:$NHDT-Revision: 1.195 $ */ +/* NetHack 3.6 cmd.c $NHDT-Date: 1434507810 2015/06/17 02:23:30 $ $NHDT-Branch: master $:$NHDT-Revision: 1.196 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -3201,7 +3201,8 @@ STATIC_OVL boolean accept_menu_prefix(cmd_func) int NDECL((*cmd_func)); { - if (cmd_func == dopickup || cmd_func == doextcmd || cmd_func == doextlist) + if (cmd_func == dopickup || cmd_func == dotip + || cmd_func == doextcmd || cmd_func == doextlist) return TRUE; return FALSE; } diff --git a/src/pickup.c b/src/pickup.c index 7e1fcb0cc..3a03003d6 100644 --- a/src/pickup.c +++ b/src/pickup.c @@ -1,4 +1,4 @@ -/* NetHack 3.6 pickup.c $NHDT-Date: 1432804962 2015/05/28 09:22:42 $ $NHDT-Branch: master $:$NHDT-Revision: 1.157 $ */ +/* NetHack 3.6 pickup.c $NHDT-Date: 1434507811 2015/06/17 02:23:31 $ $NHDT-Branch: master $:$NHDT-Revision: 1.159 $ */ /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */ /* NetHack may be freely redistributed. See license for details. */ @@ -2691,53 +2691,74 @@ dotip() Sprintf(buf, "You can't tip %s while carrying so much.", !flags.verbose ? "a container" : (boxes > 1) ? "one" : "it"); if (!check_capacity(buf) && able_to_loot(cc.x, cc.y, FALSE)) { - - if (boxes > 1) { + if (boxes > 1 && (flags.menu_style != MENU_TRADITIONAL + || iflags.menu_requested)) { /* use menu to pick a container to tip */ int n, i; winid win; anything any; menu_item *pick_list = NULL; + struct obj dummyobj, *otmp; + any = zeroany; win = create_nhwindow(NHW_MENU); start_menu(win); - for (cobj = level.objects[cc.x][cc.y]; cobj; + for (cobj = level.objects[cc.x][cc.y], i = 0; cobj; cobj = cobj->nexthere) if (Is_container(cobj)) { + ++i; any.a_obj = cobj; add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, doname(cobj), MENU_UNSELECTED); } + if (invent) { + any = zeroany; + add_menu(win, NO_GLYPH, &any, 0, 0, ATR_NONE, + "", MENU_UNSELECTED); + any.a_obj = &dummyobj; + /* use 'i' for inventory unless there are so many + containers that it's already being used */ + i = (i <= 'i' - 'a' && !flags.lootabc) ? 'i' : 0; + add_menu(win, NO_GLYPH, &any, i, 0, ATR_NONE, + "tip something being carried", MENU_SELECTED); + } end_menu(win, "Tip which container?"); n = select_menu(win, PICK_ONE, &pick_list); destroy_nhwindow(win); - - if (n > 0) { - for (i = 0; i < n; i++) { - tipcontainer(pick_list[i].item.a_obj); - free((genericptr_t) pick_list); - return 1; - } - } + /* + * Deal with quirk of preselected item in pick-one menu: + * n == 0 => picked preselected entry, toggling it off; + * n == 1 => accepted preselected choice via SPACE or RETURN; + * n == 2 => picked something other than preselected entry; + * n == -1 => cancelled via ESC; + */ + otmp = (n <= 0) ? (struct obj *) 0 : pick_list[0].item.a_obj; + if (n > 1 && otmp == &dummyobj) + otmp = pick_list[1].item.a_obj; if (pick_list) free((genericptr_t) pick_list); + if (otmp && otmp != &dummyobj) { + tipcontainer(otmp); + return 1; + } if (n == -1) return 0; + /* else pick-from-invent below */ } else { for (cobj = level.objects[cc.x][cc.y]; cobj; cobj = nobj) { nobj = cobj->nexthere; if (!Is_container(cobj)) continue; - - c = ynq(safe_qbuf(qbuf, "There is ", " here, tip it?", cobj, + c = ynq(safe_qbuf(qbuf, "There is ", " here, tip it?", + cobj, doname, ansimpleoname, "container")); if (c == 'q') return 0; if (c == 'n') continue; - tipcontainer(cobj); + /* can only tip one container at a time */ return 1; } } From 1df377b9519427da68f3cccc24cabfce68e7de3f Mon Sep 17 00:00:00 2001 From: Pasi Kallinen Date: Wed, 17 Jun 2015 13:43:59 +0300 Subject: [PATCH 5/5] Lights are floaters From Boudewijn: > y a light (tame yellow light called Snertkat) [seen: normal vision, > infravision] > Snertkat deliberately jumps onto a polymorph trap! So make yellow and black lights floaters. --- include/mondata.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/mondata.h b/include/mondata.h index b3bdb27e4..7f62258a5 100644 --- a/include/mondata.h +++ b/include/mondata.h @@ -22,7 +22,7 @@ #define is_lminion(mon) \ (is_minion((mon)->data) && mon_aligntyp(mon) == A_LAWFUL) #define is_flyer(ptr) (((ptr)->mflags1 & M1_FLY) != 0L) -#define is_floater(ptr) ((ptr)->mlet == S_EYE) +#define is_floater(ptr) ((ptr)->mlet == S_EYE || (ptr)->mlet == S_LIGHT) #define is_clinger(ptr) (((ptr)->mflags1 & M1_CLING) != 0L) #define is_swimmer(ptr) (((ptr)->mflags1 & M1_SWIM) != 0L) #define breathless(ptr) (((ptr)->mflags1 & M1_BREATHLESS) != 0L)