From ff553c6995a57f0c153a79fd0c20646ac2df7ad7 Mon Sep 17 00:00:00 2001 From: "nethack.rankin" Date: Thu, 16 Feb 2006 07:35:00 +0000 Subject: [PATCH] latent level arrival message bug (trunk only) 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 | 1 + include/extern.h | 1 + src/do.c | 5 ++++- src/mkmaze.c | 24 ++++++++++++++++-------- 4 files changed, 22 insertions(+), 9 deletions(-) diff --git a/doc/fixes35.0 b/doc/fixes35.0 index 831e9dace..dbd99b041 100644 --- a/doc/fixes35.0 +++ b/doc/fixes35.0 @@ -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 diff --git a/include/extern.h b/include/extern.h index ffe69555b..acfd0275e 100644 --- a/include/extern.h +++ b/include/extern.h @@ -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); diff --git a/src/do.c b/src/do.c index 02206ffa7..422ded7f0 100644 --- 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); diff --git a/src/mkmaze.c b/src/mkmaze.c index ac2fe3fa7..1589e6abe 100644 --- a/src/mkmaze.c +++ b/src/mkmaze.c @@ -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 -- 2.40.0