From: Eric S. Raymond Date: Wed, 5 Jul 2017 04:40:14 +0000 (-0400) Subject: Simplify vase-dropping logic using state_change(). X-Git-Tag: takebird~23 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=3d5c7239f1c71b9531cb078520a5b619d4200891;p=open-adventure.git Simplify vase-dropping logic using state_change(). --- diff --git a/actions.c b/actions.c index 48e987f..59ec428 100644 --- a/actions.c +++ b/actions.c @@ -502,10 +502,9 @@ static int discard(token_t verb, token_t obj, bool just_do_it) game.loc == objects[PILLOW].plac) { rspeak(OK_MAN); } else { - game.prop[VASE] = VASE_BROKEN; - if (AT(PILLOW)) - game.prop[VASE] = VASE_WHOLE; - pspeak(VASE, look, game.prop[VASE] + 1, true); + state_change(VASE, AT(PILLOW) + ? VASE_WHOLE + : VASE_DROPPED); if (game.prop[VASE] != VASE_WHOLE) game.fixed[VASE] = -1; } diff --git a/adventure.yaml b/adventure.yaml index 17d88a9..e61a2d3 100644 --- a/adventure.yaml +++ b/adventure.yaml @@ -3738,15 +3738,14 @@ objects: !!omap inventory: 'Ming vase' locations: LOC_ORIENTAL treasure: true - states: [VASE_WHOLE, VASE_RESTING, VASE_BROKEN, VASE_DROPS] + states: [VASE_WHOLE, VASE_DROPPED, VASE_BROKEN] descriptions: - 'There is a delicate, precious, ming vase here!' - - 'The vase is now resting, delicately, on a velvet pillow.' - 'The floor is littered with worthless shards of pottery.' - - 'The ming vase drops with a delicate crash.' + - 'The floor is littered with worthless shards of pottery.' changes: - - '' - - '' + - 'The vase is now resting, delicately, on a velvet pillow.' + - 'The ming vase drops with a delicate crash.' - 'You have taken the vase and hurled it delicately to the ground.' - EMERALD: words: ['emera']