From b125fe7b2ad09754364f8bef1f3d72a5837c7b82 Mon Sep 17 00:00:00 2001 From: "Eric S. Raymond" Date: Fri, 10 Mar 2023 16:43:27 -0500 Subject: [PATCH] Fix interrupted-magic-words cosmetic bug. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit C patch by Torbjörn Andersson. --- NEWS | 3 +++ actions.c | 12 +++++++----- main.c | 6 ++++++ tests/foobug.chk | 4 ++-- tests/foobug.log | 2 +- 5 files changed, 19 insertions(+), 8 deletions(-) diff --git a/NEWS b/NEWS index 96daed0..6e432f6 100644 --- a/NEWS +++ b/NEWS @@ -1,5 +1,8 @@ = Open Adventure project news = +Repository head:: + Commands in magic-word sequence now interrupt it, as in original. + 1.14: 2023-03-09:: Added -a option for BBS door systems. -o reverts to the old message on some failed magic words. diff --git a/actions.c b/actions.c index a831d97..4c2fcdb 100644 --- a/actions.c +++ b/actions.c @@ -192,11 +192,13 @@ static phase_codes_t bigwords(vocab_t id) * word we've got. Last word zips the eggs back to the giant room (unless * already there). */ { - if ((game.foobar == WORD_EMPTY && id == FEE) || - (game.foobar == FEE && id == FIE) || - (game.foobar == FIE && id == FOE) || - (game.foobar == FOE && id == FOO) || - (game.foobar == FOE && id == FUM)) { + int foobar = abs(game.foobar); + + if ((foobar == WORD_EMPTY && id == FEE) || + (foobar == FEE && id == FIE) || + (foobar == FIE && id == FOE) || + (foobar == FOE && id == FOO) || + (foobar == FOE && id == FUM)) { game.foobar = id; if ((id != FOO) && (id != FUM)) { rspeak(OK_MAN); diff --git a/main.c b/main.c index 94f2b45..371b3b6 100644 --- a/main.c +++ b/main.c @@ -1125,6 +1125,12 @@ static bool do_command() if (!get_command_input(&command)) return false; + /* Every input, check "foobar" flag. If zero, nothing's going + * on. If pos, make neg. If neg, he skipped a word, so make it + * zero. + */ + game.foobar = (game.foobar > WORD_EMPTY) ? -game.foobar : WORD_EMPTY; + ++game.turns; preprocess_command(&command); } diff --git a/tests/foobug.chk b/tests/foobug.chk index ead29b1..046b820 100644 --- a/tests/foobug.chk +++ b/tests/foobug.chk @@ -1688,11 +1688,11 @@ passage leads south, and a low crawl goes east. > foe -OK +Nothing happens. > foo -Done! +Nothing happens. You scored 311 out of a possible 430, using 291 turns. diff --git a/tests/foobug.log b/tests/foobug.log index 49c25df..8ff35b8 100644 --- a/tests/foobug.log +++ b/tests/foobug.log @@ -1,5 +1,5 @@ ## Test interpersing commands amidst magic words -# Check for "Done" or "Nothing happens." in game output. +# Check for "Nothing happens." in game output indicatung sequence interrupt. no seed 1318612053 e -- 2.31.1