Display timeout in game UI
This commit is contained in:
@ -78,6 +78,7 @@ impl PrintableMap for PrintableCurrentGameMapStatus {
|
||||
|
||||
#[derive(Debug, serde::Serialize, serde::Deserialize, Clone, Default)]
|
||||
pub struct CurrentGameStatus {
|
||||
pub remaining_time_for_strike: Option<u64>,
|
||||
pub rules: GameRules,
|
||||
pub your_map: CurrentGameMapStatus,
|
||||
pub opponent_map: CurrentGameMapStatus,
|
||||
|
@ -257,6 +257,9 @@ impl Game {
|
||||
/// Get current game status for a specific player
|
||||
fn get_game_status_for_player(&self, id: usize) -> CurrentGameStatus {
|
||||
CurrentGameStatus {
|
||||
remaining_time_for_strike: self.rules.strike_timeout.map(|v| {
|
||||
((self.curr_strike_request_started + v) as i64 - time() as i64).max(0) as u64
|
||||
}),
|
||||
rules: self.rules.clone(),
|
||||
your_map: self.player_map(id).current_map_status(false),
|
||||
opponent_map: self
|
||||
|
Reference in New Issue
Block a user