// check if game timed out based on block_time_limit
check if game timed out based on block_time_limit
check if game timed out based on block_time_limit
pub fn check_timeout(
        &mut self,
        current_block: u64,
    ) -> Result<&Option<CwChessGameOver>, ContractError> {
        // check if game already over
        if self.status.is_some() {
            return Err(ContractError::GameAlreadyOver {});
        }
        self.status = match self.block_limit {
            None => None,
            Some(block_time_limit) => {
                let block_times = self.get_block_times(current_block);
                if block_times.0 > block_time_limit {
                    Some(CwChessGameOver::WhiteTimeout {})
                } else if block_times.1 > block_time_limit {
                    Some(CwChessGameOver::BlackTimeout {})
                } else {
                    None
                }
            }
        };
        Ok(&self.status)
    }
pub fn check_timeout ( & mut self , current_block : u64 , ) -> Result < & Option < CwChessGameOver > , ContractError > { // check if game already over if self . status . is_some ( ) { return Err ( ContractError :: GameAlreadyOver { } ) ; } self . status = match self . block_limit { None => None , Some ( block_time_limit ) => { let block_times = self . get_block_times ( current_block ) ; if block_times . 0 > block_time_limit { Some ( CwChessGameOver :: WhiteTimeout { } ) } else if block_times . 1 > block_time_limit { Some ( CwChessGameOver :: BlackTimeout { } ) } else { None } } } ; Ok ( & self . status ) }
check if game timed out based on block_time_limit
check if game timed out based on block_time_limit
&mut self
current_block
u64