rnd-20030722-1-src
[rocksndiamonds.git] / src / game.c
index 78aa51586a8ece24210c35b23ed0c1c3c3b512e1..c2deb648c2f817fb4dcdcfaaedc57b8fc93481b7 100644 (file)
@@ -6417,6 +6417,7 @@ void ScrollScreen(struct PlayerInfo *player, int mode)
 
 void TestIfPlayerTouchesCustomElement(int x, int y)
 {
+  static boolean check_changing = FALSE;
   static int xy[4][2] =
   {
     { 0, -1 },
@@ -6427,6 +6428,12 @@ void TestIfPlayerTouchesCustomElement(int x, int y)
   boolean center_is_player = (IS_PLAYER(x, y));
   int i;
 
+  /* prevent TestIfPlayerTouchesCustomElement() from looping */
+  if (check_changing)
+    return;
+
+  check_changing = TRUE;
+
   for (i=0; i<4; i++)
   {
     int xx = x + xy[i][0];
@@ -6448,10 +6455,13 @@ void TestIfPlayerTouchesCustomElement(int x, int y)
       break;
     }
   }
+
+  check_changing = FALSE;
 }
 
 void TestIfElementTouchesCustomElement(int x, int y)
 {
+  static boolean check_changing = FALSE;
   static int xy[4][2] =
   {
     { 0, -1 },
@@ -6462,6 +6472,12 @@ void TestIfElementTouchesCustomElement(int x, int y)
   boolean center_is_custom = (IS_CUSTOM_ELEMENT(Feld[x][y]));
   int i;
 
+  /* prevent TestIfElementTouchesCustomElement() from looping */
+  if (check_changing)
+    return;
+
+  check_changing = TRUE;
+
   for (i=0; i<4; i++)
   {
     int xx = x + xy[i][0];
@@ -6482,6 +6498,8 @@ void TestIfElementTouchesCustomElement(int x, int y)
       CheckElementChange(xx, yy, Feld[xx][yy], CE_OTHER_IS_TOUCHING);
     }
   }
+
+  check_changing = FALSE;
 }
 
 void TestIfGoodThingHitsBadThing(int good_x, int good_y, int good_move_dir)