Like this:

int GetCard(int index)
{
  for (int i = 0; i < StdDeck_N_CARDS; ++i)
    if (StdDeck_CardMask_CARD_IS_SET(cards, i))
      if (--index == 0)
        return i;
  throw std::exception();
}

Is there a shorter way?

-- 
Peter


Citeren Peter Billen <[EMAIL PROTECTED]>:

> Hello all,
>
> How can you iterate over the cards in a StdDeck_CardMask? Say you have a
> StdDeck_CardMask for "Ah Kh 8d 4d 9c", how can I get the first card (Ah), the
> second card (Kh), ... and the fifth card (9c)?
>
> Do I have to iterate over all the 52 available cards, and check for 
> each card if
> it is set in the mask (StdDeck_CardMask_CARD_IS_SET)?
>
> Thanks in advance. Kind regards,
>
> Peter
>
>
> _______________________________________________
> Pokersource-users mailing list
> [email protected]
> https://mail.gna.org/listinfo/pokersource-users
>




_______________________________________________
Pokersource-users mailing list
[email protected]
https://mail.gna.org/listinfo/pokersource-users

Reply via email to