Skip to content

Commit

Permalink
feat: when adding new cards do not override the current hand
Browse files Browse the repository at this point in the history
  • Loading branch information
djpiper28 committed Jul 28, 2024
1 parent a64b282 commit 0e24c20
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions backend/gameLogic/game.go
Original file line number Diff line number Diff line change
Expand Up @@ -414,11 +414,9 @@ func (g *Game) newCards() error {
return errors.New(fmt.Sprintf("Cannot create game: %s", err))
}

cardIndexSlice := make(map[int]*WhiteCard)
for _, card := range cards {
cardIndexSlice[card.Id] = card
g.PlayersMap[pid].Hand[card.Id] = card
}
g.PlayersMap[pid].Hand = cardIndexSlice
}

return nil
Expand Down

0 comments on commit 0e24c20

Please sign in to comment.