Restructure quips for invalid movements.
authorNHOrus <jy6x2b32pie9@yahoo.com>
Sat, 8 Jul 2017 14:40:57 +0000 (17:40 +0300)
committerNHOrus <jy6x2b32pie9@yahoo.com>
Sat, 8 Jul 2017 16:59:50 +0000 (19:59 +0300)
adventure.yaml
main.c

index b8778a75ab9b48cd988b255b391ac1d11c7a4527..e137d8cf8afe9455413988a924d1c416d289344c 100644 (file)
@@ -204,9 +204,9 @@ motions: !!omap
     words: ['east', 'e']
 - WEST:
     words: ['west', 'w']
-- MOT_45:
+- NORTH:
     words: ['north', 'n']
-- MOT_46:
+- SOUTH:
     words: ['south', 's']
 - NE:
     words: ['ne']
diff --git a/main.c b/main.c
index f89afcc194ba5a3d7f99ccfe90a2defa070647c6..972e30f582a484fa7ae03acf3472950f72ca1335 100644 (file)
--- a/main.c
+++ b/main.c
@@ -604,25 +604,40 @@ static void playermove( int motion)
         if (travel[travel_entry].stop) {
             /*  Couldn't find an entry matching the motion word passed
              *  in.  Various messages depending on word given. */
-            int spk = CANT_APPLY;
-            if (motion >= EAST && motion <= NW)
-                spk = BAD_DIRECTION;
-            if (motion == UP ||
-                motion == DOWN)
-                spk = BAD_DIRECTION;
-            if (motion == FORWARD ||
-                motion == LEFT ||
-                motion == RIGHT)
-                spk = UNSURE_FACING;
-            if (motion == OUTSIDE ||
-                motion == INSIDE)
-                spk = NO_INOUT_HERE;
-            if (motion == XYZZY ||
-                motion == PLUGH)
-                spk = NOTHING_HAPPENS;
-            if (motion == CRAWL)
-                spk = WHICH_WAY;
-            rspeak(spk);
+            switch (motion) {
+            case EAST:
+            case WEST:
+            case SOUTH:
+            case NORTH:
+            case NE:
+            case NW:
+            case SW:
+            case SE:
+                rspeak(BAD_DIRECTION);
+                break;
+            case UP:
+            case DOWN:
+                rspeak(BAD_DIRECTION);
+                break;
+            case FORWARD:
+            case LEFT:
+            case RIGHT:
+                rspeak(UNSURE_FACING);
+                break;
+            case OUTSIDE:
+            case INSIDE:
+                rspeak(NO_INOUT_HERE);
+                break;
+            case XYZZY:
+            case PLUGH:
+                rspeak(NOTHING_HAPPENS);
+                break;
+            case CRAWL:
+                rspeak(WHICH_WAY);
+                break;
+            default:
+                rspeak(CANT_APPLY);
+            }
             return;
         }
         ++travel_entry;