Fix interrupted-magic-words cosmetic bug.

C patch by Torbjörn Andersson.
This commit is contained in:
Eric S. Raymond 2023-03-10 16:43:27 -05:00
parent 3971a61ab0
commit b125fe7b2a
5 changed files with 19 additions and 8 deletions

3
NEWS
View file

@ -1,5 +1,8 @@
= Open Adventure project news = = Open Adventure project news =
Repository head::
Commands in magic-word sequence now interrupt it, as in original.
1.14: 2023-03-09:: 1.14: 2023-03-09::
Added -a option for BBS door systems. Added -a option for BBS door systems.
-o reverts to the old message on some failed magic words. -o reverts to the old message on some failed magic words.

View file

@ -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 * word we've got. Last word zips the eggs back to the giant room (unless
* already there). */ * already there). */
{ {
if ((game.foobar == WORD_EMPTY && id == FEE) || int foobar = abs(game.foobar);
(game.foobar == FEE && id == FIE) ||
(game.foobar == FIE && id == FOE) || if ((foobar == WORD_EMPTY && id == FEE) ||
(game.foobar == FOE && id == FOO) || (foobar == FEE && id == FIE) ||
(game.foobar == FOE && id == FUM)) { (foobar == FIE && id == FOE) ||
(foobar == FOE && id == FOO) ||
(foobar == FOE && id == FUM)) {
game.foobar = id; game.foobar = id;
if ((id != FOO) && (id != FUM)) { if ((id != FOO) && (id != FUM)) {
rspeak(OK_MAN); rspeak(OK_MAN);

6
main.c
View file

@ -1125,6 +1125,12 @@ static bool do_command()
if (!get_command_input(&command)) if (!get_command_input(&command))
return false; 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; ++game.turns;
preprocess_command(&command); preprocess_command(&command);
} }

View file

@ -1688,11 +1688,11 @@ passage leads south, and a low crawl goes east.
> foe > foe
OK Nothing happens.
> foo > foo
Done! Nothing happens.
You scored 311 out of a possible 430, using 291 turns. You scored 311 out of a possible 430, using 291 turns.

View file

@ -1,5 +1,5 @@
## Test interpersing commands amidst magic words ## 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 no
seed 1318612053 seed 1318612053
e e