moved (and renamed) global variables to game structure (ZX/ZY)
authorHolger Schemel <info@artsoft.org>
Wed, 14 Nov 2018 20:10:38 +0000 (21:10 +0100)
committerHolger Schemel <info@artsoft.org>
Wed, 14 Nov 2018 20:10:38 +0000 (21:10 +0100)
src/game.c
src/game.h
src/game_mm/mm_main.h
src/main.c
src/main.h

index c1846d6..fd774e8 100644 (file)
@@ -3543,8 +3543,6 @@ void InitGame(void)
   if (network_playing)
     SendToServer_MovePlayer(MV_NONE);
 
-  ZX = ZY = -1;
-
   FrameCounter = 0;
   TimeFrames = 0;
   TimePlayed = 0;
@@ -3557,6 +3555,9 @@ void InitGame(void)
 
   ScrollStepSize = 0;  // will be correctly initialized by ScrollScreen()
 
+  game.robot_wheel_x = -1;
+  game.robot_wheel_y = -1;
+
   game.exit_x = -1;
   game.exit_y = -1;
 
@@ -6846,12 +6847,14 @@ static void TurnRoundExt(int x, int y)
       }
     }
 
-    if (element == EL_ROBOT && ZX >= 0 && ZY >= 0 &&
-       (Feld[ZX][ZY] == EL_ROBOT_WHEEL_ACTIVE ||
+    if (element == EL_ROBOT &&
+       game.robot_wheel_x >= 0 &&
+       game.robot_wheel_y >= 0 &&
+       (Feld[game.robot_wheel_x][game.robot_wheel_y] == EL_ROBOT_WHEEL_ACTIVE ||
         game.engine_version < VERSION_IDENT(3,1,0,0)))
     {
-      attr_x = ZX;
-      attr_y = ZY;
+      attr_x = game.robot_wheel_x;
+      attr_y = game.robot_wheel_y;
     }
 
     if (element == EL_PENGUIN)
@@ -9033,10 +9036,11 @@ static void RunRobotWheel(int x, int y)
 
 static void StopRobotWheel(int x, int y)
 {
-  if (ZX == x && ZY == y)
+  if (game.robot_wheel_x == x &&
+      game.robot_wheel_y == y)
   {
-    ZX = ZY = -1;
-
+    game.robot_wheel_x = -1;
+    game.robot_wheel_y = -1;
     game.robot_wheel_active = FALSE;
   }
 }
@@ -13448,8 +13452,8 @@ void RemovePlayer(struct PlayerInfo *player)
     game.GameOver = TRUE;
   }
 
-  game.exit_x = ZX = jx;
-  game.exit_y = ZY = jy;
+  game.exit_x = game.robot_wheel_x = jx;
+  game.exit_y = game.robot_wheel_y = jy;
 }
 
 void ExitPlayer(struct PlayerInfo *player)
@@ -14072,9 +14076,9 @@ static int DigField(struct PlayerInfo *player,
     if (element == EL_ROBOT_WHEEL)
     {
       Feld[x][y] = EL_ROBOT_WHEEL_ACTIVE;
-      ZX = x;
-      ZY = y;
 
+      game.robot_wheel_x = x;
+      game.robot_wheel_y = y;
       game.robot_wheel_active = TRUE;
 
       TEST_DrawLevelField(x, y);
@@ -15241,9 +15245,6 @@ static ListNode *SaveEngineSnapshotBuffers(void)
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(game));
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(tape));
 
-  SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(ZX));
-  SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(ZY));
-
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(FrameCounter));
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(TimeFrames));
   SaveSnapshotBuffer(&buffers, ARGS_ADDRESS_AND_SIZEOF(TimePlayed));
index bba270c..195f420 100644 (file)
@@ -204,6 +204,7 @@ struct GameInfo
   int players_still_needed;
   int friends_still_needed;
 
+  int robot_wheel_x, robot_wheel_y;
   int exit_x, exit_y;
 
   boolean all_players_gone;
index 9482566..946afd1 100644 (file)
@@ -234,7 +234,6 @@ extern int          FfwdFrameDelay;
 extern int             BX1, BY1, BX2, BY2;
 extern int             SBX_Left, SBX_Right;
 extern int             SBY_Upper, SBY_Lower;
-extern int             ZX, ZY;
 extern int             TimeFrames, TimePlayed, TimeLeft;
 extern boolean         SiebAktiv;
 extern int             SiebCount;
index 1805b6e..109e88d 100644 (file)
@@ -126,7 +126,6 @@ int                 BX1, BY1;
 int                    BX2, BY2;
 int                    SBX_Left, SBX_Right;
 int                    SBY_Upper, SBY_Lower;
-int                    ZX, ZY;
 
 int                    TimeFrames, TimePlayed, TimeLeft, TapeTime;
 
index 45d4696..5a6268d 100644 (file)
@@ -3628,7 +3628,6 @@ extern int                        BX1, BY1;
 extern int                     BX2, BY2;
 extern int                     SBX_Left, SBX_Right;
 extern int                     SBY_Upper, SBY_Lower;
-extern int                     ZX, ZY;
 
 extern int                     TimeFrames, TimePlayed, TimeLeft, TapeTime;