Skip to content

Commit

Permalink
Minor fix battle contract (#499)
Browse files Browse the repository at this point in the history
Co-authored-by: Vadim Tokar <[email protected]>
Co-authored-by: sergey filyanin <[email protected]>
  • Loading branch information
3 people authored Nov 1, 2024
1 parent e150f31 commit 506fc06
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions contracts/battle/app/src/services/game/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,6 @@ impl Battle {
}
}

pub fn delete_players(&mut self, loser_1: &ActorId, loser_2: &ActorId, pair_id: u16) {
let player_loser_1 = self
.participants
.remove(loser_1)
.expect("The player must exist");
let player_loser_2 = self
.participants
.remove(loser_2)
.expect("The player must exist");

self.defeated_participants.insert(*loser_1, player_loser_1);
self.defeated_participants.insert(*loser_2, player_loser_2);

self.pairs.remove(&pair_id);
self.players_to_pairs.remove(loser_1);
self.players_to_pairs.remove(loser_2);
}

pub fn check_min_player_amount(&self) -> Result<(), BattleError> {
if self.participants.len() <= 1 {
return Err(BattleError::NotEnoughPlayers);
Expand Down Expand Up @@ -183,6 +165,7 @@ impl Battle {
self.pairs.insert(self.pair_id, pair);
self.players_to_pairs.insert(player.owner, self.pair_id);
self.waiting_player = Some((player.owner, self.pair_id));
self.pair_id += 1;
}
}
pub fn send_delayed_message_make_move_from_reservation(&mut self, time_for_move: u32) {
Expand Down

0 comments on commit 506fc06

Please sign in to comment.