X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame.c;h=666d992d5c535f572dde2a4298f63211da230566;hb=1b1972065887ca03077a3f0fc1af51f9bdaed9a2;hp=dafcbbd47c8441f42cc99a351c062e821d6e8912;hpb=c42db18f39053cf2ec85943c37a20b8caa742d09;p=rocksndiamonds.git diff --git a/src/game.c b/src/game.c index dafcbbd4..666d992d 100644 --- a/src/game.c +++ b/src/game.c @@ -5405,17 +5405,9 @@ void Moving2Blocked(int x, int y, int *goes_to_x, int *goes_to_y) void Blocked2Moving(int x, int y, int *comes_from_x, int *comes_from_y) { - int oldx = x, oldy = y; int direction = MovDir[x][y]; - - if (direction == MV_LEFT) - oldx++; - else if (direction == MV_RIGHT) - oldx--; - else if (direction == MV_UP) - oldy++; - else if (direction == MV_DOWN) - oldy--; + int oldx = x + (direction & MV_LEFT ? +1 : direction & MV_RIGHT ? -1 : 0); + int oldy = y + (direction & MV_UP ? +1 : direction & MV_DOWN ? -1 : 0); *comes_from_x = oldx; *comes_from_y = oldy;