wht
This commit is contained in:
@@ -697,7 +697,7 @@ pub fn instances_idle(tx: &mut Transaction) -> Result<Vec<Instance>, Error> {
|
||||
}
|
||||
|
||||
|
||||
pub fn instance_new(tx: &mut Transaction, account: &Account, construct_ids: Vec<Uuid>, name: String, pve: bool, password: Option<String>) -> Result<Instance, Error> {
|
||||
pub fn instance_new(tx: &mut Transaction, account: &Account, construct_ids: Vec<Uuid>, name: String, pve: bool, _password: Option<String>) -> Result<Instance, Error> {
|
||||
let mut instance = match pve {
|
||||
true => {
|
||||
let bot = bot_player();
|
||||
@@ -716,6 +716,8 @@ pub fn instance_new(tx: &mut Transaction, account: &Account, construct_ids: Vec<
|
||||
instance.add_player(bot)?;
|
||||
instance.player_ready(bot_id)?;
|
||||
|
||||
instance.open = false;
|
||||
|
||||
instance
|
||||
},
|
||||
false => Instance::new()
|
||||
@@ -738,6 +740,10 @@ pub fn instance_join(tx: &mut Transaction, account: &Account, instance_id: Uuid,
|
||||
return Err(format_err!("incorrect player size. ({:})", 3));
|
||||
}
|
||||
|
||||
if instance.players.len() >= instance.max_players {
|
||||
return Err(err_msg("game is full"));
|
||||
}
|
||||
|
||||
let player = player_create(tx, Player::new(account.id, &account.name, constructs), instance.id, account)?;
|
||||
|
||||
instance.add_player(player)?;
|
||||
|
||||
Reference in New Issue
Block a user