From: Julian Cowley Date: Tue, 8 Mar 2022 02:43:45 +0000 (-1000) Subject: Heed other hazards when bumping the Wumpus X-Git-Tag: 1.8~1 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=4aeaddc2e41651d9b2c173d4cb7a81914feaf4ab;p=wumpus.git Heed other hazards when bumping the Wumpus When you bump the Wumpus by moving into the room where he is, most of the time he moves to another room rather than staying and eating you. There can be other hazards in the same room since he is not bothered by them, and those should also cause you to get affected. Check the room for other hazards after bumping the Wumpus in the event he moves out of the way. --- diff --git a/wumpus.c b/wumpus.c index 5d4efe4..857bce2 100644 --- a/wumpus.c +++ b/wumpus.c @@ -521,8 +521,11 @@ goodmove: /* 1080 RETURN */ (void) puts("... OOPS! BUMPED A WUMPUS!"); move_wumpus(); + if (finished < 0) + return; + /* Fall through since Wumpus could have been in a pit or bat room */ } - else if (scratchloc == loc[PIT1] || scratchloc == loc[PIT2]) + if (scratchloc == loc[PIT1] || scratchloc == loc[PIT2]) { /* 1085 REM *** PIT *** */ /* 1090 IF L=L(3) THEN 1100 */ @@ -532,8 +535,9 @@ goodmove: /* 1110 RETURN */ (void) puts("YYYYIIIIEEEE . . . FELL IN PIT"); finished = LOSE; + return; } - else if (scratchloc == loc[BATS1] || scratchloc == loc[BATS2]) + if (scratchloc == loc[BATS1] || scratchloc == loc[BATS2]) { /* 1115 REM *** BATS *** */ /* 1120 IF L=L(5) THEN 1130 */