I have a TArray of cards that get sorted in a function called OrganizeHand()
. This function is called from a NetMulticast function. The problem is only 2 cards are sorted if you’re playing as a client. As the server, all cards get sorted. I also change the color of every card in the hand and that works as expected. Here is the function:
void ASPawn::OrganizeHand()
{
// sort hand - only sorts 2 cards if client
ClientHand.Sort(AClientCard::SortHand);
// disable hand - works as expected on both server and client
for (int32 i = 0; i < ClientHand.Num(); i++)
{
ClientHand[i]->SetDisabled();
}
}
And here is the sort:
inline static bool SortHand(const ASCard& c1, const ASCard& c2)
{
return ((c1.suit < c2.suit) || (c1.suit == c2.suit && c1.cardValue < c2.cardValue));
}