From: Aaron Traas Date: Tue, 4 Jul 2017 13:55:02 +0000 (-0400) Subject: Eliminated bivalve function. X-Git-Tag: takebird~37 X-Git-Url: https://jxself.org/git/?p=open-adventure.git;a=commitdiff_plain;h=16a175bbabffe66a68eeab1ca4ac0703553fdf56 Eliminated bivalve function. Reason: only called in lock(), you can't be TOTING a clam, you can't have the trident at a carryable oyster, and the code IMHO is more readable this way. --- diff --git a/actions.c b/actions.c index cfbb186..c05cfb0 100644 --- a/actions.c +++ b/actions.c @@ -210,38 +210,6 @@ static int bigwords(token_t foo) } } -static int bivalve(token_t verb, token_t obj) -/* Clam/oyster actions */ -{ - bool is_oyster = (obj == OYSTER); - if (verb == LOCK) { - rspeak(HUH_MAN); - return GO_CLEAROBJ; - } - if (!TOTING(TRIDENT)) { - rspeak(is_oyster ? - OYSTER_OPENER : - CLAM_OPENER); - return GO_CLEAROBJ; - } - if (TOTING(obj)) { - rspeak( is_oyster ? - DROP_OYSTER : - DROP_CLAM); - return GO_CLEAROBJ; - } - - if (!is_oyster) { - DESTROY(CLAM); - drop(OYSTER, game.loc); - drop(PEARL, LOC_CULDESAC); - } - rspeak(is_oyster ? - OYSTER_OPENS : - PEARL_FALLS); - return GO_CLEAROBJ; -} - static void blast(void) /* Blast. No effect unless you've got dynamite, which is a neat trick! */ { @@ -946,8 +914,24 @@ static int lock(token_t verb, token_t obj) switch (obj) { case CLAM: + if (verb == LOCK) + rspeak(HUH_MAN); + else if (!TOTING(TRIDENT)) + rspeak(OYSTER_OPENER); + else { + DESTROY(CLAM); + drop(OYSTER, game.loc); + drop(PEARL, LOC_CULDESAC); + rspeak(PEARL_FALLS); + } + return GO_CLEAROBJ; case OYSTER: - return bivalve(verb, obj); + if (verb == LOCK) + rspeak(HUH_MAN); + else + rspeak(OYSTER_OPENER); + + return GO_CLEAROBJ; case DOOR: rspeak((game.prop[DOOR] == DOOR_UNRUSTED) ? OK_MAN : RUSTY_DOOR); break; diff --git a/tests/breakmirror.chk b/tests/breakmirror.chk index 31844d5..2cfc5e3 100644 --- a/tests/breakmirror.chk +++ b/tests/breakmirror.chk @@ -2933,6 +2933,10 @@ Huh? Huh? +> unlock oyster + +You don't have anything strong enough to open the oyster. + > drop oyster OK @@ -2977,7 +2981,7 @@ The resulting ruckus has awakened the dwarves. There are now several threatening little dwarves in the room with you! Most of them throw knives at you! All of them get you! -You scored 383 out of a possible 430, using 475 turns. +You scored 383 out of a possible 430, using 476 turns. Your score puts you in Master Adventurer Class B. diff --git a/tests/breakmirror.log b/tests/breakmirror.log index 7f92bb2..b9534e1 100644 --- a/tests/breakmirror.log +++ b/tests/breakmirror.log @@ -473,6 +473,7 @@ take oyster find oyster lock lock oyster +unlock oyster drop oyster take oyster read oyster