From: Holger Schemel Date: Sat, 29 Feb 2020 13:45:30 +0000 (+0100) Subject: moved removing inactive players to separate loop X-Git-Tag: 4.2.0.0~63 X-Git-Url: https://git.artsoft.org/?a=commitdiff_plain;h=df3efe7374d7a16149a68557512f3e41ebf7b26f;p=rocksndiamonds.git moved removing inactive players to separate loop --- diff --git a/src/game_em/convert.c b/src/game_em/convert.c index 50914804..d8a202d6 100644 --- a/src/game_em/convert.c +++ b/src/game_em/convert.c @@ -376,9 +376,9 @@ void prepare_em_level(void) for (i = 0; i < GAME_TILE_MAX; i++) lev.android_array[i] = map[cav.android_array[i]]; - /* determine number of players in this level */ lev.home_initial = 0; + /* check for players in this level */ for (i = 0; i < MAX_PLAYERS; i++) { ply[i].exists = FALSE; @@ -401,6 +401,7 @@ void prepare_em_level(void) lev.home = lev.home_initial; players_left = lev.home_initial; + /* assign active players */ for (i = 0; i < MAX_PLAYERS; i++) { if (ply[i].exists) @@ -410,15 +411,20 @@ void prepare_em_level(void) ply[i].alive = TRUE; players_left--; } - else - { - int x = cav.player_x[i]; - int y = cav.player_y[i]; + } + } - lev.cave[lev.left + x][lev.top + y] = Xblank; - lev.next[lev.left + x][lev.top + y] = Xblank; - lev.draw[lev.left + x][lev.top + y] = Xblank; - } + /* remove inactive players */ + for (i = 0; i < MAX_PLAYERS; i++) + { + if (ply[i].exists && !ply[i].alive) + { + int x = cav.player_x[i]; + int y = cav.player_y[i]; + + lev.cave[lev.left + x][lev.top + y] = Xblank; + lev.next[lev.left + x][lev.top + y] = Xblank; + lev.draw[lev.left + x][lev.top + y] = Xblank; } }