X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_em%2Fsynchro_1.c;fp=src%2Fgame_em%2Fsynchro_1.c;h=b45330149723e044c168e83d1ed99bf46bbdbe85;hb=cfaefce799e67af6d8352f516a99d121b10d0cf6;hp=38607713370c2cf3e6e136aefc48e8dabd85d2ae;hpb=1fcb3ddbb8404effdcfa5ebbd53d3ff5009260f6;p=rocksndiamonds.git diff --git a/src/game_em/synchro_1.c b/src/game_em/synchro_1.c index 38607713..b4533014 100644 --- a/src/game_em/synchro_1.c +++ b/src/game_em/synchro_1.c @@ -548,13 +548,26 @@ static void check_player(struct PLAYER *ply) int oldy = ply->y; int x = oldx + dx; int y = oldy + dy; - boolean can_move = TRUE; + boolean players_visible_before_move; + boolean players_visible_after_move; + boolean can_move; + + players_visible_before_move = checkIfAllPlayersFitToScreen(); ply->x = x; ply->y = y; + players_visible_after_move = checkIfAllPlayersFitToScreen(); + + /* + player is allowed to move only in the following cases: + - it is not needed to display all players (not focussed to all players) + - all players are (still or again) visible after the move + - some players were already outside visible screen area before the move + */ can_move = (game.centered_player_nr != -1 || - checkIfAllPlayersFitToScreen()); + players_visible_after_move || + !players_visible_before_move); ply->x = oldx; ply->y = oldy;