Server: Fix character deletion mentioned in #1327

This commit is contained in:
Xeriab Nabil 2021-09-06 15:59:48 +03:00
parent d5bf9eb6ad
commit c9e2293a6c

View File

@ -544,6 +544,14 @@ pub fn delete_character(
stmt.execute(&[&char_id])?;
drop(stmt);
let pet_ids = get_pet_ids(char_id, transaction)?
.iter()
.map(|x| Value::from(*x))
.collect::<Vec<Value>>();
if !pet_ids.is_empty() {
delete_pets(transaction, char_id, Rc::new(pet_ids))?;
}
// Delete character
let mut stmt = transaction.prepare_cached(
"
@ -598,14 +606,6 @@ pub fn delete_character(
)));
}
let pet_ids = get_pet_ids(char_id, transaction)?
.iter()
.map(|x| Value::from(*x))
.collect::<Vec<Value>>();
if !pet_ids.is_empty() {
delete_pets(transaction, char_id, Rc::new(pet_ids))?;
}
load_character_list(requesting_player_uuid, transaction)
}