More goto eliminations.
[open-adventure.git] / actions.c
index 6a6448bafbc26492eacbdc465506cdafba072fd7..6be80f1e55eb4c9dca3512077be1dc6fcbab08da 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -81,7 +81,7 @@ static int attack(FILE *input, long verb, long obj)
      *  fixed), move rug there (not fixed), and move him there,
      *  too.  Then do a null motion to get new description. */
     RSPEAK(49);
-    GETIN(input,WD1,WD1X,WD2,WD2X);
+    GETIN(input,&WD1,&WD1X,&WD2,&WD2X);
     if (WD1 != MAKEWD(25) && WD1 != MAKEWD(250519))
        return(2607);
     PSPEAK(DRAGON,3);
@@ -780,6 +780,7 @@ static int suspendresume(FILE *input, bool resume)
 /* Suspend and resume */
 {
     int kk;
+    long i;
     if (!resume) {
        /*  Suspend.  Offer to save things in a file, but charging
         *  some points (so can't win by using saved games to retry
@@ -810,8 +811,8 @@ static int suspendresume(FILE *input, bool resume)
      * for I/O. All the SAV* functions can be scrapped.
      */
 
-    DATIME(&I,&K);
-    K=I+650*K;
+    DATIME(&i,&K);
+    K=i+650*K;
     SAVWRD(kk,K);
     K=VRSION;
     SAVWRD(0,K);
@@ -892,8 +893,8 @@ static int throw(FILE *cmdin, long verb, long obj)
     }
     if (obj != AXE)
        return(discard(obj, false));
-    I=ATDWRF(game.loc);
-    if (I <= 0) {
+    int i=ATDWRF(game.loc);
+    if (i <= 0) {
         if (AT(DRAGON) && game.prop[DRAGON] == 0) {
             SPK=152;
             return throw_support(SPK);
@@ -922,8 +923,8 @@ static int throw(FILE *cmdin, long verb, long obj)
         SPK=48;
         return throw_support(SPK);
     }
-    game.dseen[I]=false;
-    game.dloc[I]=0;
+    game.dseen[i]=false;
+    game.dloc[i]=0;
     SPK=47;
     game.dkill=game.dkill+1;
     if (game.dkill == 1)SPK=149;
@@ -1107,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);