bot game result
This commit is contained in:
@@ -103,7 +103,7 @@ impl Instance {
|
||||
Ok(self)
|
||||
}
|
||||
|
||||
fn bot_vs_player_game(&self, player: &Player) -> Game {
|
||||
fn bot_vs_player_game(&self, player: &Player) -> Result<Game, Error> {
|
||||
let current_round = self.current_round(player);
|
||||
|
||||
let plr = self.players.clone().into_iter().find(|p| p.id == player.id).unwrap();
|
||||
@@ -125,12 +125,12 @@ impl Instance {
|
||||
bot_team.set_bot();
|
||||
|
||||
game
|
||||
.team_add(plr_team).unwrap()
|
||||
.team_add(bot_team).unwrap();
|
||||
.team_add(plr_team)?
|
||||
.team_add(bot_team)?;
|
||||
|
||||
game.start();
|
||||
|
||||
game
|
||||
Ok(game)
|
||||
}
|
||||
|
||||
fn can_start(&self) -> bool {
|
||||
@@ -485,7 +485,7 @@ pub fn instance_ready(params: InstanceReadyParams, tx: &mut Transaction, account
|
||||
true => match game_get(tx, game_id) {
|
||||
Ok(g) => g,
|
||||
Err(_) => {
|
||||
let game = instance.bot_vs_player_game(&player);
|
||||
let game = instance.bot_vs_player_game(&player)?;
|
||||
game_write(&game, tx)?;
|
||||
game
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user