instance btn file
This commit is contained in:
@@ -748,6 +748,13 @@ pub fn pvp(tx: &mut Transaction, a: &Account, b: &Account) -> Result<Instance, E
|
||||
|
||||
pub fn instance_abandon(tx: &mut Transaction, account: &Account, instance_id: Uuid) -> Result<RpcMessage, Error> {
|
||||
let mut instance = instance_get(tx, instance_id)?;
|
||||
|
||||
if let Some(game_id) = instance.current_game_id() {
|
||||
let mut game = game_get(tx, game_id)?;
|
||||
game.player_by_id(account.id)?.forfeit();
|
||||
game_update(tx, &game)?;
|
||||
}
|
||||
|
||||
instance.account_player(account.id)?.set_lose();
|
||||
instance.account_opponent(account.id)?.set_win();
|
||||
instance.next_round();
|
||||
|
||||
Reference in New Issue
Block a user