fix tutorial construct order bug
This commit is contained in:
parent
15bc05b3d4
commit
5871f3129b
@ -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)
|
||||
@ -1201,7 +1200,7 @@ mod tests {
|
||||
.player_add(y_player).unwrap();
|
||||
|
||||
game = game.start();
|
||||
|
||||
|
||||
assert!(game.players[0].constructs[0].skill_on_cd(Skill::Ruin).is_some());
|
||||
assert!(game.players[1].constructs[0].skill_on_cd(Skill::Ruin).is_none());
|
||||
}
|
||||
|
||||
@ -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,
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user