Skip to content

Commit

Permalink
Don't always default to _Unknown_ player colour
Browse files Browse the repository at this point in the history
  • Loading branch information
Hesketh committed Feb 22, 2024
1 parent aede97d commit 2b2179a
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions Website/Components/Dialogs/EditPlayDialog.razor
Original file line number Diff line number Diff line change
Expand Up @@ -272,12 +272,16 @@

private void CreateNewPlayer()
{
_play.Players.Add(new PlayerModel
var newPlayer = new PlayerModel
{
Colour = Colours.FirstOrDefault(),
Faction = Factions.FirstOrDefault(),
Person = People.FirstOrDefault(x => _play.Players.All(y => x.Identifier != y.Person?.Identifier))
});
};
if (newPlayer.Colour == null)
{
newPlayer.Colour = Colours.FirstOrDefault();
}
_play.Players.Add(newPlayer);
StateHasChanged();
}

Expand Down

0 comments on commit 2b2179a

Please sign in to comment.