diff --git a/grid.js b/grid.js index 5b4127a..beda02e 100644 --- a/grid.js +++ b/grid.js @@ -90,7 +90,7 @@ class Grid check_complete(sub_x, sub_y, x, y) { - if (this.subgrids[sub_x][sub_y].is_won() || this.subgrids[sub_x][sub_y].is_draw()) + if (this.subgrids[sub_y][sub_x].is_won() || this.subgrids[sub_y][sub_x].is_draw()) { this.n_complete_subgrids++; } diff --git a/local_match_manager.js b/local_match_manager.js index 4bedaee..b4d2b81 100644 --- a/local_match_manager.js +++ b/local_match_manager.js @@ -33,7 +33,7 @@ class LocalMatchManager else if (grid.is_complete()) { this.status_label.innerHTML = "Draw. Everybody looses!"; - this.end_game(); + this.end_game(false); } else { @@ -59,9 +59,12 @@ class LocalMatchManager this.grid.player_change_listener(next_player); } - end_game() + end_game(closed_by_player = true) { - this.status_label.innerHTML = "Game Over. Game Closed"; + if (closed_by_player) + { + this.status_label.innerHTML = "Game Over. Game Closed"; + } this.grid.block_all(); } diff --git a/websocket_connection.js b/websocket_connection.js index 13b9a72..f581b18 100644 --- a/websocket_connection.js +++ b/websocket_connection.js @@ -64,7 +64,7 @@ class WebsocketConnection this.relogin(session_id); } - on_close() + on_close(login_failed=false) { var login_failed = !this.registered; this.registered = false;