]> granicus.if.org Git - nethack/commitdiff
latent level arrival message bug (trunk only)
authornethack.rankin <nethack.rankin>
Thu, 16 Feb 2006 07:35:00 +0000 (07:35 +0000)
committernethack.rankin <nethack.rankin>
Thu, 16 Feb 2006 07:35:00 +0000 (07:35 +0000)
     Something I noticed during a level change in slash'em:
        You hear the sounds of civilization.  You fly down the stairs.
The first message ought to follow the second.  Our only arrival messages
that are handled via the special level loader occur in the endgame where
travel is by magic portal, and the transit message given for portals is
for entering one rather than exiting at the far side, so this sequencing
problem can't currently be noticed in nethack.  But sooner or later there
will be levels reachable by stairs and having entry messages, or there'll
be some feedback added when magic portal transport finishes, and then we'd
get bitten by this.

     Tested by adding an arrival message to each of the bigroom variants.

doc/fixes35.0
include/extern.h
src/do.c
src/mkmaze.c

index 831e9dace22bb46640aa7d86f1a59f3fa2202586..dbd99b041b0d6d6ade5ef752fddf2cff2ccd7186 100644 (file)
@@ -123,6 +123,7 @@ candles should not be fireproof
 recognize most instances where hallucinatory monster name should be treated
        as a personal name (to avoid "the Barney") instead of a description
 avoid giving misleading or redundant feedback when reading scrolls
+custom arrival message for special levels could be delivered too soon
 
 
 Platform- and/or Interface-Specific Fixes
index ffe69555b913ca948de8b1df093704553c4ce121..acfd0275e5497a68e7dd5aa918bf7e4592895674 100644 (file)
@@ -1082,6 +1082,7 @@ void FDECL(remove_rooms, (int,int,int,int));
 
 E void FDECL(wallification, (int,int,int,int));
 E void FDECL(walkfrom, (int,int));
+E void NDECL(deliver_splev_message);
 E void FDECL(makemaz, (const char *));
 E void FDECL(mazexy, (coord *));
 E void NDECL(bound_digging);
index 02206ffa7dc2f7a7fe56591348db84d4955fbb02..422ded7f051fbdc5f3059a36e4d58933edefed2e 100644 (file)
--- a/src/do.c
+++ b/src/do.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)do.c       3.5     2005/09/02      */
+/*     SCCS Id: @(#)do.c       3.5     2006/02/15      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -1308,6 +1308,9 @@ boolean at_stairs, falling, portal;
         *  Move all plines beyond the screen reset.
         */
 
+       /* special levels can have a custom arrival message */
+       deliver_splev_message();
+
        /* give room entrance message, if any */
        check_special_room(FALSE);
 
index ac2fe3fa7279f0a6db9aa8ea1247a36964cd6cb6..1589e6abef640067d7608db60b3e1ef11050b86a 100644 (file)
@@ -475,21 +475,29 @@ fixup_special()
            }
     }
 
-    if(lev_message) {
-       char *str, *nl;
-       for(str = lev_message; (nl = index(str, '\n')) != 0; str = nl+1) {
+    if (lregions)
+       free((genericptr_t) lregions),  lregions = 0;
+    num_lregions = 0;
+}
+
+/* special levels can include a custom arrival message; display it */
+void
+deliver_splev_message()
+{
+    char *str, *nl;
+
+    /* this used to be inline within fixup_special(),
+       but then the message ended up being given too soon */
+    if (lev_message) {
+       for (str = lev_message; (nl = index(str, '\n')) != 0; str = nl + 1) {
            *nl = '\0';
            pline("%s", str);
        }
-       if(*str)
+       if (*str)
            pline("%s", str);
        free((genericptr_t)lev_message);
        lev_message = 0;
     }
-
-    if (lregions)
-       free((genericptr_t) lregions),  lregions = 0;
-    num_lregions = 0;
 }
 
 void