X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=c2deb648c2f817fb4dcdcfaaedc57b8fc93481b7;hb=2ff21518535f914abaacf8ffc72bfbd2f319dcd5;hp=78aa51586a8ece24210c35b23ed0c1c3c3b512e1;hpb=732fd648f26b307fa3ab0e2c44ec06eb28d6f0d6;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index 78aa5158..c2deb648 100644 --- a/src/game.c +++ b/src/game.c @@ -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)