Skip to content

Commit

Permalink
Removed duplicate names in deck_ordering bug
Browse files Browse the repository at this point in the history
  • Loading branch information
TylerBloom committed Nov 27, 2022
1 parent de55411 commit 6123156
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions squire_lib/src/players/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,9 @@ impl Player {

/// Adds a deck to the player
pub fn add_deck(&mut self, name: String, deck: Deck) {
self.deck_ordering.push(name.clone());
self.decks.insert(name, deck);
if self.decks.insert(name.clone(), deck).is_none() {
self.deck_ordering.push(name);
}
}

/// Gets a specific deck from the player
Expand Down

0 comments on commit 6123156

Please sign in to comment.