]> granicus.if.org Git - nethack/commitdiff
fix #H4028 - ':' sometimes doesn't work
authorPatR <rankin@nethack.org>
Tue, 19 Jan 2016 15:13:18 +0000 (07:13 -0800)
committerPatR <rankin@nethack.org>
Tue, 19 Jan 2016 15:13:18 +0000 (07:13 -0800)
User had
MSGTTYPE=norep "You see here"
and complained that once the message had been given while walking
over an object, using ':' to intentionally look at something would
end up doing nothing if its feedback was a repeat of "You see here".

Trying to classify which actions should deliberately override
no-repeat (or no-show) will be an ordeal.  This fixes the case for
the ':' command where the user obviously expects feedback.  I think
it could be done better but am settling for something quick and easy.

doc/fixes36.1
include/flag.h
src/invent.c
src/pline.c

index 78b94aeb91300e05fc6eedc4115c8e17d158b4e7..a719cdd0ef98a542d1e4fe8810c38df19b2e109d 100644 (file)
@@ -119,6 +119,7 @@ make hurtling out of water bubble on the Plane of Water handle entering water
 fix floor descriptions on the Planes when levitating
 fix warning glyph description when monster symbol coincided the warning symbol
 allow the same color names for status hilites and menucolors
+override MSGTYPE=norep while executing the ':' command
 
 
 Platform- and/or Interface-Specific Fixes
index b53bad4ad58ca94eb19c503fb057ef6de73eef8e..6482c7198e7a0acbfc127cded6f2baba891ae5ad 100644 (file)
@@ -363,11 +363,13 @@ extern NEARDATA struct sysflag sysflags;
 extern NEARDATA struct instance_flags iflags;
 
 /* last_msg values */
-#define PLNMSG_UNKNOWN 0             /* arbitrary */
-#define PLNMSG_ONE_ITEM_HERE 1       /* "you see <single item> here" */
-#define PLNMSG_TOWER_OF_FLAME 2      /* scroll of fire */
+#define PLNMSG_NOSHO_OVERRIDE    (-2)
+#define PLNMSG_NOREP_OVERRIDE    (-1)
+#define PLNMSG_UNKNOWN             0 /* arbitrary */
+#define PLNMSG_ONE_ITEM_HERE       1 /* "you see <single item> here" */
+#define PLNMSG_TOWER_OF_FLAME      2 /* scroll of fire */
 #define PLNMSG_CAUGHT_IN_EXPLOSION 3 /* explode() feedback */
-#define PLNMSG_OBJ_GLOWS 4           /* "the <obj> glows <color>" */
+#define PLNMSG_OBJ_GLOWS           4 /* "the <obj> glows <color>" */
 
 /* runmode options */
 #define RUN_TPORT 0 /* don't update display until movement stops */
index 6a2a910bdfbe714652e94f5e164895e7f5fc4905..dc740c4b14621ef2ab8f98baa4f4d37b3e3df1e0 100644 (file)
@@ -2686,6 +2686,7 @@ boolean picked_some;
     skip_objects = (flags.pile_limit > 0 && obj_cnt >= flags.pile_limit);
     if (u.uswallow && u.ustuck) {
         struct monst *mtmp = u.ustuck;
+
         Sprintf(fbuf, "Contents of %s %s", s_suffix(mon_nam(mtmp)),
                 mbodypart(mtmp, STOMACH));
         /* Skip "Contents of " by using fbuf index 12 */
@@ -2829,6 +2830,7 @@ boolean picked_some;
 int
 dolook()
 {
+    iflags.last_msg = PLNMSG_NOREP_OVERRIDE;
     return look_here(0, FALSE);
 }
 
index 141532cadf813fca36f5dcf80c224a6550bf80d2..86ac55a122fff359417e3ea1ce52f5987b3bfa22 100644 (file)
@@ -87,9 +87,26 @@ VA_DECL(const char *, line)
         return;
     }
 
+    /*
+     * Normally the sequence is
+     *  caller: pline("some message");
+     *   pline: vsprintf + putstr + iflags.last_msg = PLNMSG_UNKNOWN;
+     *  caller: iflags.last_msg = PLNMSG_some_message;
+     * and subsequent code can adjust the next message if it is
+     * affected by some_message.
+     *
+     * But some callers can use last_msg to control handling of next
+     * message
+     *  caller: iflags.last_msg = PLNMSG_NOREP_OVERRIDE;
+     *  caller: pline("another message");
+     * to force another_message to be delivered even if is a repeat
+     * and user's MSGTYPE settings have classified it as don't-repeat.
+     */
+
     msgtyp = msgtype_type(line, no_repeat);
-    if (msgtyp == MSGTYP_NOSHOW
-        || (msgtyp == MSGTYP_NOREP && !strcmp(line, prevmsg)))
+    if ((msgtyp == MSGTYP_NOSHOW && iflags.last_msg != PLNMSG_NOSHO_OVERRIDE)
+        || (msgtyp == MSGTYP_NOREP && iflags.last_msg != PLNMSG_NOREP_OVERRIDE
+            && !strcmp(line, prevmsg)))
         return;
     if (vision_full_recalc)
         vision_recalc(0);