]> granicus.if.org Git - nethack/commitdiff
pets accompanying ascension or dungeon escape
authornethack.rankin <nethack.rankin>
Sat, 3 Mar 2007 06:20:14 +0000 (06:20 +0000)
committernethack.rankin <nethack.rankin>
Sat, 3 Mar 2007 06:20:14 +0000 (06:20 +0000)
     There was a report recently about "<pet> is still eating" coming out
on the console at end of game for player using X11 or Qt.  That happened
because the end-of-game pet handling takes place after the message window
has been closed.  It won't happen with the dev code any more because eating
no longer prevents pets from accompanying on final ascent or escape.  But
a pet carrying the Amulet should still fail to tag along and yield similar
result.  However, levl_follower() was changed (probably by me...) to have
pets not attempt to follow when they carried the Amulet, rendering code
in keepdogs()--which reported them as being confused--unreachable.  This
reverts levl_follower() to have Amulet-carrying monsters other than the
Wizard try to accompany the hero during level changes (and keepdogs still
prevents them from succeeding).  It also reorganizes keepdogs() a bit,
giving trapped followers an extra chance to escape from their trap and
preventing those who fail that chance from tagging along (previously,
non-pets ignored being trapped).

     After doing that, I got tty to behave similarly to the X11/Qt report:
a message behaved strangely.  In my case, it was delivered between a pair
of clearings of the screen and only visible by using terminal emulator's
scrolling buffer.  I think there's a wait_synch() missing somewhere, but
haven't tried to figure out where.  Instead, this makes the end-of-game
call to keepdogs() take place sooner, while pline() still works normally.

doc/fixes34.4
src/dog.c
src/end.c
src/mondata.c

index 18e40805513dad7f6b83397fe8e94ec0c67cfc49..ce9bea4d0ad93641a346646eddf596f269960355 100644 (file)
@@ -101,6 +101,7 @@ avoid giving extra information about things that break out of sight
 avoid giving away wand type for near misses while blind
 avoid excessive repetition of "monsters are aware of your presence"
 monster's aggravation spell now affects meditating monsters
+handle pets sooner at end-of-game to avoid message delivery anomalies
 busy pet won't miss out upon ascension
 fix various places that "finally finished" could be displayed after the hero
        stopped doing something other than eating
index cc7e81ead4c43adf5a3481c5f95015a75f191c61..f1f810b1ac8ed0f4f0855a51994ca81505df1f30 100644 (file)
--- a/src/dog.c
+++ b/src/dog.c
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)dog.c      3.5     2006/10/20      */
+/*     SCCS Id: @(#)dog.c      3.5     2007/03/02      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -524,9 +524,6 @@ boolean pets_only;  /* true for ascension or final escape */
                mtmp->mcanmove = 1;
            }
            if (((monnear(mtmp, u.ux, u.uy) && levl_follower(mtmp)) ||
-#ifdef STEED
-                       (mtmp == u.usteed) ||
-#endif
                /* the wiz will level t-port from anywhere to chase
                   the amulet; if you don't have it, will chase you
                   only if in range. -3. */
@@ -541,32 +538,25 @@ boolean pets_only;        /* true for ascension or final escape */
                /* monster won't follow if it hasn't noticed you yet */
                && !(mtmp->mstrategy & STRAT_WAITFORU)) {
                stay_behind = FALSE;
+               if (mtmp->mtrapped) (void)mintrap(mtmp); /* try to escape */
 #ifdef STEED
                if (mtmp == u.usteed) {
-                   /* make sure steed is eligible to accompany hero;
-                      start by having mintrap() give a chance to escape
-                      trap normally but if that fails, force the untrap
-                      (note: handle traps first because normal escape
-                      has the potential to set monster->meating) */
-                   if (mtmp->mtrapped && mintrap(mtmp))
-                       mtmp->mtrapped = 0;             /* escape trap */
+                   /* make sure steed is eligible to accompany hero */
+                   mtmp->mtrapped = 0;         /* escape trap */
                    mtmp->meating = 0;          /* terminate eating */
                    mdrop_special_objs(mtmp);   /* drop Amulet */
                } else
 #endif
-               if (mtmp->mtame && mtmp->meating) {
+               if (mtmp->meating || mtmp->mtrapped) {
                        if (canseemon(mtmp))
-                           pline("%s is still eating.", Monnam(mtmp));
+                           pline("%s is still %s.", Monnam(mtmp),
+                                 mtmp->meating ? "eating" : "trapped");
                        stay_behind = TRUE;
                } else if (mon_has_amulet(mtmp)) {
                        if (canseemon(mtmp))
                            pline("%s seems very disoriented for a moment.",
                                Monnam(mtmp));
                        stay_behind = TRUE;
-               } else if (mtmp->mtame && mtmp->mtrapped) {
-                       if (canseemon(mtmp))
-                           pline("%s is still trapped.", Monnam(mtmp));
-                       stay_behind = TRUE;
                }
                if (stay_behind) {
                        if (mtmp->mleashed) {
index d359a71fee1b6958983a590809c39d388f19eed9..98bbe545ab5cc6088b4c78bb22bede43b980d9f2 100644 (file)
--- a/src/end.c
+++ b/src/end.c
@@ -700,6 +700,9 @@ die:
                make_grave(u.ux, u.uy, pbuf);
            }
        }
+       /* if pets will contribute to score, populate mydogs list now
+          (bones creation isn't a factor, but pline() messaging is) */
+       if (how == ESCAPED || how == ASCENDED) keepdogs(TRUE);
 
        if (how == QUIT) {
            killer.format = NO_KILLER_PREFIX;
@@ -836,7 +839,6 @@ die:
            /* count the points for artifacts */
            artifact_score(invent, TRUE, endwin);
 
-           keepdogs(TRUE);
            viz_array[0][0] |= IN_SIGHT; /* need visibility for naming */
            mtmp = mydogs;
            if (!done_stopprint) Strcpy(pbuf, "You");
index a3a017e03d23e72b7f652a2b0886d6e99eb46ba7..4e67fb096173d1816875045d651a80c58a709940 100644 (file)
@@ -1,4 +1,4 @@
-/*     SCCS Id: @(#)mondata.c  3.5     2007/02/05      */
+/*     SCCS Id: @(#)mondata.c  3.5     2007/03/02      */
 /* Copyright (c) Stichting Mathematisch Centrum, Amsterdam, 1985. */
 /* NetHack may be freely redistributed.  See license for details. */
 
@@ -662,8 +662,12 @@ boolean
 levl_follower(mtmp)
 struct monst *mtmp;
 {
-       /* monsters with the Amulet--even pets--won't follow across levels */
-       if (mon_has_amulet(mtmp)) return FALSE;
+#ifdef STEED
+       if (mtmp == u.usteed) return TRUE;
+#endif
+
+       /* Wizard with Amulet won't bother trying to follow across levels */
+       if (mtmp->iswiz && mon_has_amulet(mtmp)) return FALSE;
 
        /* some monsters will follow even while intending to flee from you */
        if (mtmp->mtame || mtmp->iswiz || is_fshk(mtmp)) return TRUE;