From 29672a64476e72db0e71931c1001fb345b5dae36 Mon Sep 17 00:00:00 2001 From: NHOrus Date: Sun, 2 Jul 2017 17:50:42 +0300 Subject: [PATCH] Fixed logic, documented it in notes and tests --- actions.c | 8 ++++++-- notes.adoc | 1 + tests/urntest.chk | 20 ++++++++++++++++++-- tests/urntest.log | 4 ++++ 4 files changed, 29 insertions(+), 4 deletions(-) diff --git a/actions.c b/actions.c index 51a3f59..f2ec65a 100644 --- a/actions.c +++ b/actions.c @@ -528,7 +528,9 @@ static int extinguish(token_t verb, int obj) obj = LAMP; if (HERE(URN) && game.prop[URN] == URN_LIT) obj = URN; - if (obj == INTRANSITIVE) + if (obj == INTRANSITIVE || + HERE(LAMP) && game.prop[LAMP] == LAMP_BRIGHT && + HERE(URN) && game.prop[URN] == URN_LIT) return GO_UNKNOWN; } @@ -739,7 +741,9 @@ static int light(token_t verb, token_t obj) obj = LAMP; if (HERE(URN) && game.prop[URN] == URN_DARK) obj = URN; - if (obj == INTRANSITIVE || obj == 0 || obj > NOBJECTS) + if (obj == INTRANSITIVE || + HERE(LAMP) && game.prop[LAMP] == LAMP_DARK && game.limit >= 0 && + HERE(URN) && game.prop[URN] == URN_DARK) return GO_UNKNOWN; } diff --git a/notes.adoc b/notes.adoc index 884d1ce..4f4e1c4 100644 --- a/notes.adoc +++ b/notes.adoc @@ -93,6 +93,7 @@ what you are running when you do "make check". In the process we found and fixed a few minor bugs. Most notably, reading the relocated Witt's End sign in the endgame didn't work. Behavior when saying the giant's magic words outside his room wasn't quite right either. +Attempt to extinguish dark urn would have cause it do lose oil. The move to modern C entailed some structural changes. The most important was the refactoring of over 350 gotos into if/loop/break diff --git a/tests/urntest.chk b/tests/urntest.chk index 8beba1b..8dec2a7 100644 --- a/tests/urntest.chk +++ b/tests/urntest.chk @@ -1989,6 +1989,10 @@ There's no way to get the oil out of the urn. Don't be ridiculous! +> light + +Light what? + > light urn The urn is now lit. @@ -2015,6 +2019,10 @@ A small oil flame extrudes from an urn embedded in the rock. The urn is now dark. +> extinguish + +Extin what? + > look Sorry, but I am not allowed to give more detail. I will repeat the @@ -2025,10 +2033,14 @@ down, but a small ledge can be seen to the west across the chasm. A small urn full of oil is embedded in the rock. -> light +> light urn The urn is now lit. +> light + +Your lamp is now on. + > look Sorry, but I am not allowed to give more detail. I will repeat the @@ -2043,6 +2055,10 @@ A small oil flame extrudes from an urn embedded in the rock. The urn is now dark. +> extinguish + +Your lamp is now off. + > look The forest thins out here to reveal a steep cliff. There is no way @@ -2056,7 +2072,7 @@ If you mean to use the persian rug, it does not appear inclined to cooperate. -You scored 267 out of a possible 430, using 345 turns. +You scored 267 out of a possible 430, using 349 turns. You have reached "Junior Master" status. diff --git a/tests/urntest.log b/tests/urntest.log index 4cd8c31..88acaa1 100644 --- a/tests/urntest.log +++ b/tests/urntest.log @@ -338,14 +338,18 @@ light urn pour bottle fill bottle drink oil +light light urn fill urn read urn look extinguish +extinguish look +light urn light look extinguish urn +extinguish look fly -- 2.31.1