From 4821381e1b41e589b30b538cf9a179bc0c3f6021 Mon Sep 17 00:00:00 2001 From: Jonni Liljamo Date: Thu, 11 May 2023 10:14:08 +0300 Subject: [PATCH] feat(client): display_name for player, debug state --- client/src/game_status/mod.rs | 3 ++- client/src/game_status/parser.rs | 2 ++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/client/src/game_status/mod.rs b/client/src/game_status/mod.rs index 62a5095..d3894f6 100644 --- a/client/src/game_status/mod.rs +++ b/client/src/game_status/mod.rs @@ -42,7 +42,7 @@ pub struct SupplyPile { pub amount: usize, } -#[derive(Deserialize, Serialize, Clone, Copy, PartialEq)] +#[derive(Debug, Deserialize, Serialize, Clone, Copy, PartialEq)] pub enum PlayerState { /// e.g. not their turn Idle, @@ -53,6 +53,7 @@ pub enum PlayerState { } pub struct PlayerStatus { + pub display_name: String, pub state: PlayerState, pub plays: i16, pub buys: i16, diff --git a/client/src/game_status/parser.rs b/client/src/game_status/parser.rs index d4e570b..5cffdb5 100644 --- a/client/src/game_status/parser.rs +++ b/client/src/game_status/parser.rs @@ -51,6 +51,7 @@ pub fn parse(game: &Game) -> Result { game_status.players.insert( game.host_id.clone(), PlayerStatus { + display_name: game.host.as_ref().unwrap().username.clone(), state: PlayerState::Idle, plays: 0, buys: 0, @@ -65,6 +66,7 @@ pub fn parse(game: &Game) -> Result { game_status.players.insert( game.guest_id.clone(), PlayerStatus { + display_name: game.guest.as_ref().unwrap().username.clone(), state: PlayerState::Idle, plays: 0, buys: 0, -- 2.44.1