Localize K to main.c
[open-adventure.git] / actions.c
index de5f83004f828ee86d0d422819c06b536e3ca2d3..3e6933c615943bac7b8298132b736a852b6806c2 100644 (file)
--- a/actions.c
+++ b/actions.c
@@ -4,7 +4,7 @@
 #include "database.h"
 
 /* Limit visibility of ugly globals.  Eventually these should go away. */
-extern long K, WD1, WD1X, WD2, WD2X;
+extern long WD1, WD1X, WD2, WD2X;
 
 static long SPK;       /* This should go away too */
 
@@ -106,7 +106,6 @@ static int attack(FILE *input, long verb, long obj)
            MOVE(obj,k);
     }
     game.loc=k;
-    K=NUL;     /* FIXME: error if removed */
     return(8);
 }
 
@@ -339,10 +338,10 @@ static int discard(long obj, bool just_do_it)
                 if (obj == RUBY)SPK=221;
                 RSPEAK(SPK);
                 if (SPK != 220) {
-                    K=2-game.prop[RUG];
-                    game.prop[RUG]=K;
-                    if (K == 2)K=PLAC[SAPPH];
-                    MOVE(RUG+NOBJECTS,K);
+                    int k = 2-game.prop[RUG];
+                    game.prop[RUG] = k;
+                    if (k == 2) k = PLAC[SAPPH];
+                    MOVE(RUG+NOBJECTS, k);
                 }
             }
         } else if (obj == COINS && HERE(VEND)) {
@@ -372,9 +371,10 @@ static int discard(long obj, bool just_do_it)
             if (game.prop[VASE] != 0)game.fixed[VASE]= -1;
         }
     }
-    K=LIQUID();
-    if (K == obj)obj=BOTTLE;
-    if (obj == BOTTLE && K != 0)game.place[K]=0;
+    int k = LIQUID();
+    if (k == obj)obj=BOTTLE;
+    if (obj == BOTTLE && k != 0)
+       game.place[k]=0;
     if (obj == CAGE && game.prop[BIRD] == 1)DROP(BIRD,game.loc);
     DROP(obj,game.loc);
     if (obj != BIRD) return(2012);
@@ -768,7 +768,6 @@ static int pour(token_t obj)
        PSPEAK(PLANT,game.prop[PLANT]+3);
        game.prop[PLANT]=MOD(game.prop[PLANT]+1,3);
        game.prop[PLANT2]=game.prop[PLANT];
-       K=NUL;
        return(8);
     } else {
        game.prop[DOOR]=0;
@@ -863,7 +862,6 @@ static int throw_support(long spk)
 {
     RSPEAK(spk);
     DROP(AXE,game.loc);
-    K=NUL;
     return(8);
 }