From: NHOrus Date: Sat, 1 Jul 2017 15:23:51 +0000 (+0300) Subject: Change state of vase X-Git-Tag: takebird~142 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=3c8482a6136167677bd46d647e90d649035ebe97 Change state of vase Clear temporary save where it needs to be cleared instead of random places --- diff --git a/actions.c b/actions.c index 43a570e..33c445c 100644 --- a/actions.c +++ b/actions.c @@ -224,23 +224,24 @@ static void blast(void) static int vbreak(token_t verb, token_t obj) /* Break. Only works for mirror in repository and, of course, the vase. */ { - int spk = actions[verb].message; - if (obj == MIRROR) - spk = TOO_FAR; - if (obj == VASE && game.prop[VASE] == 0) { - if (TOTING(VASE)) - drop(VASE, game.loc); - game.prop[VASE] = 2; - game.fixed[VASE] = -1; - spk = BREAK_VASE; - } else { - if (obj == MIRROR && game.closed) { + if (obj == MIRROR) { + if (game.closed) { rspeak(BREAK_MIRROR); return GO_DWARFWAKE; + } else { + rspeak(TOO_FAR); + return GO_CLEAROBJ; } } - rspeak(spk); - return GO_CLEAROBJ; + if (obj == VASE && game.prop[VASE] == VASE_WHOLE) { + if (TOTING(VASE)) + drop(VASE, game.loc); + state_change(VASE, VASE_BROKEN); + game.fixed[VASE] = -1; + return GO_CLEAROBJ; + } + rspeak(actions[verb].message); + return (GO_CLEAROBJ); } static int brief(void) diff --git a/adventure.yaml b/adventure.yaml index 8998d15..5758a36 100644 --- a/adventure.yaml +++ b/adventure.yaml @@ -3081,7 +3081,6 @@ arbitrary_messages: !!omap - DONT_UNDERSTAND: 'I''m afraid I don''t understand.' - HAND_PASSTHROUGH: 'Your hand passes through it as though it weren''t there.' - BREAK_MIRROR: 'You strike the mirror a resounding blow, whereupon it shatters into a\nmyriad tiny fragments.' -- BREAK_VASE: 'You have taken the vase and hurled it delicately to the ground.' - PROD_DWARF: 'You prod the nearest dwarf, who wakes up grumpily, takes one look at\nyou, curses, and grabs for his axe.' - THIS_ACCEPTABLE: 'Is this acceptable?' # This message is not currently used @@ -3678,6 +3677,10 @@ objects: !!omap - [VASE_RESTING, 'The vase is now resting, delicately, on a velvet pillow.'] - [VASE_BROKEN, 'The floor is littered with worthless shards of pottery.'] - [VASE_DROPS, 'The ming vase drops with a delicate crash.'] + changes: + - '' + - '' + - 'You have taken the vase and hurled it delicately to the ground.' - EMERALD: words: ['emera'] inventory: 'Egg-sized emerald' diff --git a/tests/Makefile b/tests/Makefile index a7a55f1..be71aa2 100644 --- a/tests/Makefile +++ b/tests/Makefile @@ -70,7 +70,7 @@ savecheck: savegames advent -l / < pitfall.log > /tmp/coverage_advent_logfail 2>&1 || exit 1 $(ECHO) "TEST advent: Test -r with valid input" advent -r thousand_saves.adv < pitfall.log > /tmp/coverage_advent_readfail 2>&1 || exit 1 - rm -f scratch.tmp /tmp/coverage* + rm -f /tmp/coverage* # General regression testing of commands and output; look at the *.log and # corresponding *.chk files to see which tests this runs. @@ -82,6 +82,6 @@ regress: then diff --text -u $${file}.chk /tmp/regress$$$$ || exit 1; \ else echo "*** Nonzero return status on $${file}!"; exit 1; fi \ done; \ - rm -f /tmp/regress$$$$ + rm -f scratch.tmp /tmp/regress$$$$ # end