rust/hedgewars-server/src/handlers/inroom.rs
changeset 15540 479911540e17
parent 15536 a798e6441a36
child 15541 d122b65bdf6f
--- a/rust/hedgewars-server/src/handlers/inroom.rs	Tue Jan 07 15:17:22 2020 +0100
+++ b/rust/hedgewars-server/src/handlers/inroom.rs	Sat Jan 11 00:44:25 2020 +0300
@@ -259,15 +259,18 @@
                         response,
                     );
 
-                    if let Some(0) = room.teams_in_game() {
-                        if let Some(result) = room_control.end_game() {
-                            super::common::get_end_game_result(
-                                room_control.server(),
-                                room_id,
-                                result,
-                                response,
-                            );
+                    match room.game_info {
+                        Some(ref info) if info.teams_in_game == 0 => {
+                            if let Some(result) = room_control.end_game() {
+                                super::common::get_end_game_result(
+                                    room_control.server(),
+                                    room_id,
+                                    result,
+                                    response,
+                                );
+                            }
                         }
+                        _ => (),
                     }
                 }
                 Err(RemoveTeamError::NoTeam) => response.warn(NO_TEAM_TO_REMOVE),
@@ -458,7 +461,10 @@
                     );
                 }
 
-                if let Some(0) = room.teams_in_game() {
+                if let Some(GameInfo {
+                    teams_in_game: 0, ..
+                }) = room.game_info
+                {
                     if let Some(result) = room_control.end_game() {
                         super::common::get_end_game_result(
                             room_control.server(),