More magic-number elimination.

This commit is contained in:
Eric S. Raymond 2017-07-01 23:07:23 -04:00
parent 5c2b76f762
commit 4f08537e2d
3 changed files with 8 additions and 11 deletions

View file

@ -888,11 +888,7 @@ static int pour(token_t verb, token_t obj)
game.prop[PLANT2] = game.prop[PLANT]; game.prop[PLANT2] = game.prop[PLANT];
return GO_MOVE; return GO_MOVE;
} else { } else {
game.prop[DOOR] = 0; state_change(DOOR, (obj == OIL) ? DOOR_UNRUSTED: DOOR_RUSTED);
if (obj == OIL)
game.prop[DOOR] = 1;
spk = RUSTED_HINGES + game.prop[DOOR];
rspeak(spk);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
} }
@ -1086,7 +1082,7 @@ static int wave(token_t verb, token_t obj)
rspeak(spk); rspeak(spk);
return GO_CLEAROBJ; return GO_CLEAROBJ;
} }
/* FIXME: Arithemetic on proprty values */ /* FIXME: Arithemetic on property values */
if (HERE(BIRD)) if (HERE(BIRD))
spk = FREE_FLY + MOD(game.prop[BIRD], 2); spk = FREE_FLY + MOD(game.prop[BIRD], 2);
if (spk == FREE_FLY && game.loc == game.place[STEPS] && game.prop[JADE] < 0) { if (spk == FREE_FLY && game.loc == game.place[STEPS] && game.prop[JADE] < 0) {

View file

@ -2865,8 +2865,6 @@ arbitrary_messages: !!omap
- RIDICULOUS_ATTEMPT: 'Don''t be ridiculous!' - RIDICULOUS_ATTEMPT: 'Don''t be ridiculous!'
- RUSTY_DOOR: 'The door is extremely rusty and refuses to open.' - 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?"' - 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.' - 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.' - 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.' - 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 locations: LOC_IMMENSE
immovable: true immovable: true
descriptions: descriptions:
- 'The way north is barred by a massive, rusty, iron door.' - [DOOR_RUSTED, 'The way north is barred by a massive, rusty, iron door.']
- 'The way north leads through 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: - PILLOW:
words: ['pillo', 'velve'] words: ['pillo', 'velve']
inventory: 'Velvet pillow' inventory: 'Velvet pillow'

2
main.c
View file

@ -692,7 +692,7 @@ static bool playermove( int motion)
* stuff for bear. */ * stuff for bear. */
if (game.prop[TROLL] == TROLL_PAIDONCE) { if (game.prop[TROLL] == TROLL_PAIDONCE) {
pspeak(TROLL, look, TROLL_PAIDONCE); pspeak(TROLL, look, TROLL_PAIDONCE);
game.prop[TROLL] = 0; game.prop[TROLL] = TROLL_UNPAID;
move(TROLL2, 0); move(TROLL2, 0);
move(TROLL2 + NOBJECTS, 0); move(TROLL2 + NOBJECTS, 0);
move(TROLL, objects[TROLL].plac); move(TROLL, objects[TROLL].plac);