mirror of
https://github.com/szymon-jozef/checkers.git
synced 2026-10-27 19:20:44 +01:00
fix: server crashing on game end
This commit is contained in:
@@ -337,6 +337,7 @@ impl Server {
|
|||||||
|
|
||||||
/// Should be used after every players move
|
/// Should be used after every players move
|
||||||
async fn on_player_action(&mut self) {
|
async fn on_player_action(&mut self) {
|
||||||
|
if self.state.stage == ServerStage::Game {
|
||||||
self.broadcast_board_view().await;
|
self.broadcast_board_view().await;
|
||||||
self.broadcast_current_turn().await;
|
self.broadcast_current_turn().await;
|
||||||
|
|
||||||
@@ -352,6 +353,7 @@ impl Server {
|
|||||||
if let Some(result) = gm.get_game_result() {
|
if let Some(result) = gm.get_game_result() {
|
||||||
info!("Game ended with result: {:?}", result);
|
info!("Game ended with result: {:?}", result);
|
||||||
self.handle_game_end(result).await;
|
self.handle_game_end(result).await;
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if !captures.is_empty() {
|
if !captures.is_empty() {
|
||||||
@@ -368,6 +370,7 @@ impl Server {
|
|||||||
|
|
||||||
panic!("on_player_action should never get here");
|
panic!("on_player_action should never get here");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async fn send_player_captures(&mut self, current_player: Uuid, captures: Vec<CapturePath>) {
|
async fn send_player_captures(&mut self, current_player: Uuid, captures: Vec<CapturePath>) {
|
||||||
let Some(addr) = self.get_client_by_id(current_player) else {
|
let Some(addr) = self.get_client_by_id(current_player) else {
|
||||||
|
|||||||
Reference in New Issue
Block a user