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 c1846d6a147ff6abd76ec6caefe8f0e88b7f0d06..fd774e84c30b33e2c80ad0ae00346e2dc8fdf101 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 bba270cd06d9085fab7ff0ecb63b208672fffc31..195f4202a1dce1a8cb858b142f8f3b2dd15c94eb 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 9482566181cbf76fee53fe94b5d20efb6105ef03..946afd1aa0254dad4cb6d59d2937c5be9c0e4177 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 1805b6e0db9702a1363dadde7c424b0b2b5475e9..109e88d0e6e09f49b1cd6cc2de744d716af83725 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 45d46969e91716003c357a636e087a0e3bcc9e4b..5a6268d95fa41d0196881b571c12b031edee4051 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;