fix tutorial construct order bug

This commit is contained in:
ntr 2020-01-10 12:21:37 +10:00
parent 15bc05b3d4
commit 5871f3129b
2 changed files with 4 additions and 3 deletions

View File

@ -104,7 +104,6 @@ impl Game {
// let player_description = player.constructs.iter().map(|c| c.name.clone()).collect::<Vec<String>>().join(", ");
// self.log.push(format!("{:} has joined the game. [{:}]", player.name, player_description));
player.constructs.sort_unstable_by_key(|c| c.id);
self.players.push(player);
Ok(self)

View File

@ -65,7 +65,9 @@ pub struct Player {
}
impl Player {
pub fn new(account: Uuid, img: Option<Uuid>, name: &String, constructs: Vec<Construct>) -> Player {
pub fn new(account: Uuid, img: Option<Uuid>, name: &String, mut constructs: Vec<Construct>) -> Player {
constructs.sort_unstable_by_key(|c| c.id);
Player {
id: account,
img,