void hhBlackJack::Deal() { // Empty hands PlayerHand.Clear(); DealerHand.Clear(); Bet = PlayerBet; creditsWon = 0; // Deal initial hands PlayerHand.Append(GetCard(1)); DealerHand.Append(GetCard(0)); PlayerHand.Append(GetCard(1)); DealerHand.Append(GetCard(1)); RetallyScores(); bCanIncBet = false; bCanDecBet = false; bCanDeal = false; DeterminePlayCommands(); resultIndex = -1; if (PlayerScore == 21) { AssessScores(); EndGame(); } UpdateView(); }
BOOLEAN procesoConsultaSaldoImp(void){ int costServ = 0; BYTE kbdbuff[10]; BYTE tmpPan[20 + 1]; //BYTE aux[10]; memset(kbdbuff, 0x00, sizeof(kbdbuff)); memset(tmpPan, 0x00, sizeof(tmpPan)); //memset(aux, 0x00, sizeof(aux)); costServ = RSP_DATA.dd_amount; DispClrBelowMW(MW_LINE2); DispLineMW( "Costo Servicio:", MW_LINE3, MW_LEFT|MW_SPFONT ); //split(aux, gToken_80.costoServicio, 2); //costServ = atoi(aux); DispAmnt( costServ, MW_LINE3, MW_SPFONT ); if( SiNo() != 2 ) { // 2 = Press Enter return FALSE; } DispLineMW( "DESLICE LA TARJETA", MW_LINE4, MW_SMFONT|MW_CENTER|MW_CLRDISP ); if( GetCard( FALSE, FALSE ) == FALSE ){ LongBeep(); DispLineMW( "CONSULTA DE SALDO", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP ); DispLineMW( "TRANSACCION CANCELADA", MW_LINE3, MW_CENTER ); APM_WaitKey(200, 0); return FALSE; } do { DispLineMW( "CONSULTA DE SALDO", MW_LINE1, MW_CENTER|MW_REVERSE|MW_CLRDISP|MW_SMFONT ); DispLineMW( "INGRESE LOS ULTIMOS", MW_LINE3, MW_CENTER|MW_SPFONT ); DispLineMW( "CUATRO DIGITOS", MW_LINE4, MW_CENTER|MW_SPFONT ); DispLineMW( "DE LA TARJETA", MW_LINE5, MW_CENTER|MW_SPFONT ); memset(kbdbuff, 0x00, sizeof(kbdbuff)); APM_SetCol(7); // Set Columna for TextBox if (!APM_GetKbd(NUMERIC_INPUT + MW_SMFONT + MW_LINE7, IMIN(4) + IMAX(4), kbdbuff)){ return FALSE; } // Compara los ultimo 4 digitos del Pan memset( tmpPan, 0x00, sizeof(tmpPan) ); split( tmpPan, INPUT.sb_pan, 10 ); RTrim( tmpPan, 'F'); } while (memcmp(&kbdbuff[1], &tmpPan[strlen(tmpPan) - 4], 4) != 0); DispLineMW( "CONSULTA DE SALDO", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP ); DispLineMW( "Costo Servicio:", MW_LINE3, MW_LEFT|MW_SPFONT ); DispAmnt(costServ, MW_LINE3, MW_SPFONT); if( !getPinblock() ) return FALSE; INPUT.dd_amount = costServ; // El costo del servicio debe viajar en el campo 4 en la proxima transaccion sprintf(gAmount, "%012d", INPUT.dd_amount); return TRUE; }
void hhBlackJack::Double() { Bet *= 2; PlayerHand.Append(GetCard(1)); RetallyScores(); DeterminePlayCommands(); // Force player to stay FollowDealerRules(); AssessScores(); EndGame(); UpdateView(); }
void hhBlackJack::Hit() { PlayerHand.Append(GetCard(1)); RetallyScores(); DeterminePlayCommands(); if (PlayerScore >= 21 || PlayerHand.Num() == 5) { FollowDealerRules(); AssessScores(); EndGame(); } UpdateView(); }
int Group::Collide(Solid& moving) const { if (!GetBoundingSphere().Collide(moving.GetBoundingSphere())) return 0; if (!GetBoundingBox().Collide(moving.GetBoundingBox())) return 0; for (int i=0; i < GetCard() ; i++) { Solid* other=group[i]; if (other==&moving) continue; if (!other->GetBoundingSphere().Collide(moving.GetBoundingSphere())) continue; if (!other->GetBoundingBox().Collide(moving.GetBoundingBox())) continue; return 1; } return 0; }
void hhBlackJack::FollowDealerRules() { // Flip up cards for (int i=0; i<DealerHand.Num(); i++) DealerHand[i].Visible = 1; // Only take cards if player is NOT busted, not 5 carded, and non blackjacked if ( PlayerScore <= 21 && PlayerHand.Num() < 5 && (PlayerScore != 21 || PlayerHand.Num() != 2) ) { while (DealerScore <= 16 && DealerHand.Num() < 5) { DealerHand.Append(GetCard(1)); RetallyScores(); } } UpdateView(); }
BOOLEAN procesoConsultaSaldoCNB(void){ BYTE kbdbuff[10]; BYTE tmpPan[20 + 1]; //BYTE aux[10]; memset(kbdbuff, 0x00, sizeof(kbdbuff)); memset(tmpPan, 0x00, sizeof(tmpPan)); //memset(aux, 0x00, sizeof(aux)); DispClrBelowMW(MW_LINE2); DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_CLRDISP|MW_SMFONT ); DispLineMW( "DESLICE LA TARJETA", MW_LINE4, MW_SMFONT|MW_CENTER|MW_CLRDISP ); if( GetCard( FALSE, FALSE ) == FALSE ){ LongBeep(); DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP ); DispLineMW( "TRANSACCION CANCELADA", MW_LINE3, MW_CENTER ); APM_WaitKey(200, 0); return FALSE; } do { DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_CLRDISP|MW_SMFONT ); DispLineMW( "INGRESE LOS ULTIMOS", MW_LINE3, MW_CENTER|MW_SPFONT ); DispLineMW( "CUATRO DIGITOS", MW_LINE4, MW_CENTER|MW_SPFONT ); DispLineMW( "DE LA TARJETA", MW_LINE5, MW_CENTER|MW_SPFONT ); memset(kbdbuff, 0x00, sizeof(kbdbuff)); APM_SetCol(7); // Set Columna for TextBox if (!APM_GetKbd(NUMERIC_INPUT + MW_SMFONT + MW_LINE7, IMIN(4) + IMAX(4), kbdbuff)){ return FALSE; } // Compara los ultimo 4 digitos del Pan memset( tmpPan, 0x00, sizeof(tmpPan) ); split( tmpPan, INPUT.sb_pan, 10 ); RTrim( tmpPan, 'F'); } while (memcmp(&kbdbuff[1], &tmpPan[strlen(tmpPan) - 4], 4) != 0); DispLineMW( "CONSULTA SALDO CNB", MW_LINE1, MW_CENTER|MW_REVERSE|MW_SMFONT|MW_CLRDISP ); if( !getPinblock() ) return FALSE; return TRUE; }
// Display the computer's name and card backs void Computer::Show() const { Console::ForegroundColor(GetColor()); Console::SetCursorPosition(0, GetLine() - 1); cout << "\b\b" << Player::GetName(); Console::SetCursorPosition(30, Player::GetLine() - 1); cout << "Score: " << GetScore() << endl; bool temp = false; if (IsCheatActive(0)) { int intArr[50] = { 1, }; temp = intArr[rand() % 50]; } for (int i = 0; i < Player::GetNumCards(); i++) { Console::ForegroundColor(Black); Console::BackgroundColor(White); if (temp || IsCheatActive(4)) { Card temp; GetCard(i, temp); cout << temp; } else cout << "\xB2\xB2\xB2"; Console::BackgroundColor(Black); cout << " "; } cout << '\t'; Console::ResetColor(); }
CString CCards::ToString(int loc) { return GetCard(theDeck[loc].suite, theDeck[loc].value); }
bool AuthClientUser::OnUserFirstLogin(vector<String> *outputMsg) { //1. 取一张免费卡 vector<tagCardInfo> freeCardList; for(int i=0; i<GetAuthServerListener()->GetCardInfoCount(); i++) { tagCardInfo *info = GetAuthServerListener()->GetCardInfoByIndex(i); if(!info) continue; if(info->CardMoney != 0) continue; freeCardList.push_back(*info); } sort(freeCardList.begin(), freeCardList.end(),greater<tagCardInfo>()); String cardType, cardNo; for(DWORD i=0; i<freeCardList.size(); i++) { if(GetCard(m_ADOQuery, freeCardList[i].CardType, &cardNo, outputMsg)) { cardType = freeCardList[i].CardType; break; } } if(cardNo == "") { if(m_IsChargeProcess == 0) { //免费卡已经发放完毕 outputMsg->push_back(GBText("免费卡已经发放完毕, 请注册!")); SendRegMessage(); return false; } else { outputMsg->push_back(GBText("对不起, 免费卡已经发放完毕!")); } } //2. 创建用户 String nowStr = DateTimeToStr(Now()); m_ADOQuery->SQL->Text = FormatStr("INSERT wow_user (" "accid, last_login_time, login_count, start_time, end_time, " "total_time, money_total_time, money, login_ip, create_time, " "create_ip) VALUES(" "'%s', '%s', %d, '%s', '%s'," "%d, %d, %d, '%s', '%s'," "'%s'" ")", m_UserName, nowStr, 0, nowStr, nowStr, 0, 0, 0, m_ClientIP, nowStr, m_ClientIP ); if(!ExecSQL(m_ADOQuery)) { outputMsg->push_back(GBText("错误(9)")); return false; } m_ADOQuery->SQL->Text = FormatStr("SELECT * FROM wow_msg where msg_key = '%s'", L"first_login"); if(!OpenSQL(m_ADOQuery)) { outputMsg->push_back(GBText("错误(10)")); return false; } if(m_ADOQuery->RecordCount) { m_ADOQuery->First(); String text = m_ADOQuery->FieldByName("msg")->AsString; outputMsg->push_back(text); } //3. 充值 if(cardNo != "") { if(!Charge(m_ADOQuery, m_UserName, cardNo, outputMsg)) { return false; } } return true; }
//------------------------------------------------------- void Cards::GiveCard(std::vector <Card*>& _deckOfPlayer) { _deckOfPlayer.push_back(GetCard()); deck.erase(deck.begin() + random); sizeOfDeck = deck.size(); }