fix too many players bug
This commit is contained in:
parent
39e9f5229b
commit
c33caffd7f
@ -155,6 +155,10 @@ impl Instance {
|
||||
}
|
||||
|
||||
fn add_player(&mut self, player: Player) -> Result<&mut Instance, Error> {
|
||||
if self.players.len() >= self.max_players {
|
||||
return Err(err_msg("game full"))
|
||||
}
|
||||
|
||||
match self.players.iter().find(|p| p.id == player.id) {
|
||||
Some(_p) => return Err(err_msg("already joined")),
|
||||
None => (),
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user