More goto eliminations.
authorEric S. Raymond <esr@thyrsus.com>
Fri, 9 Jun 2017 21:22:20 +0000 (17:22 -0400)
committerEric S. Raymond <esr@thyrsus.com>
Fri, 9 Jun 2017 21:22:20 +0000 (17:22 -0400)
actions.c

index 1031d8ef19ef1915a1ef7b828a17e3e83e35cc61..6be80f1e55eb4c9dca3512077be1dc6fcbab08da 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -1108,29 +1108,26 @@ L5100:
        goto L5010;
     if ((LIQ(0) == obj && HERE(BOTTLE)) || obj == LIQLOC(game.loc))
        goto L5010;
-    if (obj != OIL || !HERE(URN) || game.prop[URN] == 0)
-       goto L5120;
-    obj=URN;
-    goto L5010;
-L5120:
-    if (obj != PLANT || !AT(PLANT2) || game.prop[PLANT2] == 0)
-       goto L5130;
-    obj=PLANT2;
-    goto L5010;
-L5130:
-    if (obj != KNIFE || game.knfloc != game.loc)
-       goto L5140;
-    game.knfloc= -1;
-    SPK=116;
-    return(2011);
-L5140:
-    if (obj != ROD || !HERE(ROD2))
-       goto L5190;
-    obj=ROD2;
-    goto L5010;
-L5190:
+    if (obj == OIL && HERE(URN) && game.prop[URN] != 0) {
+       obj=URN;
+       goto L5010;
+    }
+    if (obj == PLANT && AT(PLANT2) && game.prop[PLANT2] != 0) {
+       obj=PLANT2;
+       goto L5010;
+    }
+    if (obj == KNIFE && game.knfloc == game.loc) {
+       game.knfloc= -1;
+       SPK=116;
+       return(2011);
+    }
+    if (obj == ROD && HERE(ROD2)) {
+       obj=ROD2;
+       goto L5010;
+    }
     if ((verb == FIND || verb == INVENT) && WD2 <= 0)
        goto L5010;
+
     SETPRM(1,WD1,WD1X);
     RSPEAK(256);
     return(2012);