Cleaned up eat
authorNHOrus <jy6x2b32pie9@yahoo.com>
Thu, 6 Jul 2017 07:18:18 +0000 (10:18 +0300)
committerNHOrus <jy6x2b32pie9@yahoo.com>
Thu, 6 Jul 2017 07:18:18 +0000 (10:18 +0300)
actions.c

index ec7fb1c0a481d44d335da93ebe61e97e74cb7b41..4a7c514207ae74235e2a84fa9170e9fc1990436e 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -557,31 +557,28 @@ static int eat(token_t verb, obj_t obj)
 /*  Eat.  Intransitive: assume food if present, else ask what.  Transitive: food
  *  ok, some things lose appetite, rest are ridiculous. */
 {
-    if (obj == INTRANSITIVE) {
+    switch (obj) {
+    case INTRANSITIVE:
         if (!HERE(FOOD))
             return GO_UNKNOWN;
+    case FOOD:
         DESTROY(FOOD);
         rspeak(THANKS_DELICIOUS);
-        return GO_CLEAROBJ;
-    }
-    if (obj == FOOD) {
-        DESTROY(FOOD);
-        rspeak(THANKS_DELICIOUS);
-        return GO_CLEAROBJ;
-    }
-    if (obj == BIRD ||
-        obj == SNAKE ||
-        obj == CLAM ||
-        obj == OYSTER ||
-        obj == DWARF ||
-        obj == DRAGON ||
-        obj == TROLL ||
-        obj == BEAR ||
-        obj == OGRE) {
+        break;
+    case BIRD:
+    case SNAKE:
+    case CLAM:
+    case OYSTER:
+    case DWARF:
+    case DRAGON:
+    case TROLL:
+    case BEAR:
+    case OGRE:
         rspeak(LOST_APPETITE);
-        return GO_CLEAROBJ;
+        break;
+    default:
+        speak(actions[verb].message);
     }
-    speak(actions[verb].message);
     return GO_CLEAROBJ;
 }