// // RemoveFromSource() // // - this is called when a card is pulled form the combined hand for a play // void CCombinedSuitHoldings::RemoveFromSource(CCard* pCard, const BOOL bPlayerCard) { CSuitHoldings::Remove(pCard); if (bPlayerCard) { m_declarerCards.Remove(pCard); m_nDeclarerLength = m_declarerCards.GetLength(); } else { m_dummyCards.Remove(pCard); m_nDummyLength = m_dummyCards.GetLength(); } // CompareHands(); FormatHoldingsString(); }
// Sort players' rankings from lowest to highest using insertion sort void SortPlayers(Player player[PLAYERS]) { int i, j, points; Player temp; for (i = 1; i < PLAYERS; i++) { points = player[i].GetPoints(); temp = player[i]; for (j = i - 1; j >=0 && points <= player[j].GetPoints(); j--) { if (points == player[j].GetPoints()) { if (CompareHands(player[j].GetHand(), temp.GetHand(), points)) { player[j+1] = player[j]; } else { break; } } else { player[j+1] = player[j]; } } player[j+1] = temp; } }
CCard* CCombinedSuitHoldings::RemoveByIndex(int nIndex) { // call base class operation CCard* pCard = CSuitHoldings::RemoveByIndex(nIndex); // perform additional processing if (m_declarerCards.HasCard(pCard)) { m_declarerCards.Remove(pCard); m_nDeclarerLength = m_declarerCards.GetLength(); } else { m_dummyCards.Remove(pCard); m_nDummyLength = m_dummyCards.GetLength(); } // CompareHands(); FormatHoldingsString(); // return pCard; }