Magic-number and state-arithmetic removal.
[open-adventure.git] / actions.c
index fbd7f550237937ca4c0a93115c1d1e5079587c3b..4d6944f6d043125443cc12b59f8b2c60c745dc55 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -93,8 +93,12 @@ static int attack(struct command_t *command)
         }
         spk = (dwarves > 1) ? OGRE_PANIC1 : OGRE_PANIC2;
     } else if (obj == BEAR) {
-        /* FIXME: Arithmetic on message numbers */
-        spk = BEAR_HANDS + (game.prop[BEAR] + 1) / 2;
+       switch (game.prop[BEAR]) {
+       case UNTAMED_BEAR: spk = BEAR_HANDS; break; 
+       case SITTING_BEAR: spk = BEAR_CONFUSED; break;
+       case CONTENTED_BEAR: spk = BEAR_CONFUSED; break;
+       case BEAR_DEAD: spk = ALREADY_DEAD; break;
+       }
     } else if (obj == DRAGON && game.prop[DRAGON] == 0) {
         /*  Fun stuff for dragon.  If he insists on attacking it, win!
          *  Set game.prop to dead, move dragon to central loc (still
@@ -966,8 +970,8 @@ static int say(struct command_t *command)
     char word1[6];
     packed_to_token(command->wd1, word1);
     int wd = (int) get_vocab_id(word1);
-    /* FIXME: issue in lexical analyzer, last two magic numbers can't change */
-    if (wd == XYZZY || wd == PLUGH || wd == PLOVER || wd == 2025 || wd == 2034) {
+    /* FIXME: magic numbers */
+    if (wd == XYZZY || wd == PLUGH || wd == PLOVER || wd == ACTION_WORD(GIANTWORDS) || wd == ACTION_WORD(PART)) {
         /* FIXME: scribbles on the interpreter's command block */
         wordclear(&command->wd2);
         return GO_LOOKUP;