diff options
Diffstat (limited to 'server')
-rw-r--r-- | server/src/game.rs | 2 | ||||
-rw-r--r-- | server/src/state.rs | 12 |
2 files changed, 13 insertions, 1 deletions
diff --git a/server/src/game.rs b/server/src/game.rs index 599aadbd..54266351 100644 --- a/server/src/game.rs +++ b/server/src/game.rs @@ -62,7 +62,7 @@ pub struct Player { pub struct Game { data: Arc<Gamedata>, tiles: HashMap<IVec2, Tile>, - players: HashMap<PlayerID, Player>, + pub players: HashMap<PlayerID, Player>, packet_out: VecDeque<PacketC>, demand: Option<DemandState>, pub points: i64, diff --git a/server/src/state.rs b/server/src/state.rs index ffcc8fa2..265dbcbc 100644 --- a/server/src/state.rs +++ b/server/src/state.rs @@ -99,6 +99,18 @@ impl State { self.game.load(data, Some(Duration::from_secs(timer))); } Command::End => { + self.tx + .send(PacketC::ServerMessage { + text: format!( + "Game was aborted by {}.", + self.game + .players + .get(&player) + .ok_or(anyhow!("player missing"))? + .name + ), + }) + .ok(); self.game .load(self.index.generate("lobby-none-none".to_string())?, None); } |