From: Eric S. Raymond Date: Sun, 2 Jul 2017 03:07:23 +0000 (-0400) Subject: More magic-number elimination. X-Git-Tag: takebird~130 X-Git-Url: https://jxself.org/git/?a=commitdiff_plain;h=4f08537e2d1c8c361d08e07a2d67cd3f53e03f40;p=open-adventure.git More magic-number elimination. --- diff --git a/actions.c b/actions.c index b236cbf..b866007 100644 --- a/actions.c +++ b/actions.c @@ -888,11 +888,7 @@ static int pour(token_t verb, token_t obj) game.prop[PLANT2] = game.prop[PLANT]; return GO_MOVE; } else { - game.prop[DOOR] = 0; - if (obj == OIL) - game.prop[DOOR] = 1; - spk = RUSTED_HINGES + game.prop[DOOR]; - rspeak(spk); + state_change(DOOR, (obj == OIL) ? DOOR_UNRUSTED: DOOR_RUSTED); return GO_CLEAROBJ; } } @@ -1086,7 +1082,7 @@ static int wave(token_t verb, token_t obj) rspeak(spk); return GO_CLEAROBJ; } - /* FIXME: Arithemetic on proprty values */ + /* FIXME: Arithemetic on property values */ if (HERE(BIRD)) spk = FREE_FLY + MOD(game.prop[BIRD], 2); if (spk == FREE_FLY && game.loc == game.place[STEPS] && game.prop[JADE] < 0) { diff --git a/adventure.yaml b/adventure.yaml index 60a148d..0e8949b 100644 --- a/adventure.yaml +++ b/adventure.yaml @@ -2865,8 +2865,6 @@ arbitrary_messages: !!omap - RIDICULOUS_ATTEMPT: 'Don''t be ridiculous!' - RUSTY_DOOR: 'The door is extremely rusty and refuses to open.' - SHAKING_LEAVES: 'The plant indignantly shakes the oil off its leaves and asks, "Water?"' -- RUSTED_HINGES: 'The hinges are quite thoroughly rusted now and won''t budge.' -- OILED_NINGES: 'The oil has freed up the hinges so that the door will now move,\nalthough it requires some effort.' - DEEP_ROOTS: 'The plant has exceptionally deep roots and cannot be pulled free.' - KNIVES_VANISH: 'The dwarves'' knives vanish as they strike the walls of the cave.' - MUST_DROP: 'Something you''re carrying won''t fit through the tunnel with you.\nYou''d best take inventory and drop something.' @@ -3131,8 +3129,11 @@ objects: !!omap locations: LOC_IMMENSE immovable: true descriptions: - - 'The way north is barred by a massive, rusty, iron door.' - - 'The way north leads through a massive, rusty, iron door.' + - [DOOR_RUSTED, 'The way north is barred by a massive, rusty, iron door.'] + - [DOOR_UNRUSTED, 'The way north leads through a massive, rusty, iron door.'] + changes: + - 'The hinges are quite thoroughly rusted now and won''t budge.' + - 'The oil has freed up the hinges so that the door will now move,\nalthough it requires some effort.' - PILLOW: words: ['pillo', 'velve'] inventory: 'Velvet pillow' diff --git a/main.c b/main.c index 9e08f9f..4531be7 100644 --- a/main.c +++ b/main.c @@ -692,7 +692,7 @@ static bool playermove( int motion) * stuff for bear. */ if (game.prop[TROLL] == TROLL_PAIDONCE) { pspeak(TROLL, look, TROLL_PAIDONCE); - game.prop[TROLL] = 0; + game.prop[TROLL] = TROLL_UNPAID; move(TROLL2, 0); move(TROLL2 + NOBJECTS, 0); move(TROLL, objects[TROLL].plac);