void CSearchWayTwoDlg::OnBnClickedButtonSw2Del() { int nSel = m_listCriteria.GetCurSel(); if( nSel != -1 ) { CString sAddr; m_listCriteria.GetText(nSel, sAddr); int nItemData = m_listCriteria.GetItemData(nSel); int nProvIndex = (nItemData>>24)&0x000000ff; CString sProvince; m_listToProvince.GetText(nProvIndex, sProvince); int nAddrType = nItemData&0x0000ffff; if( nAddrType == eItemData_Province ) { RemoveEndAddr(sProvince, NO_LIMIT_STRING, NO_LIMIT_STRING); } else if( nAddrType == eItemData_City ) { RemoveEndAddr(sProvince, sAddr==sProvince?NO_LIMIT_STRING:sAddr, NO_LIMIT_STRING); } else if( nAddrType == eItemData_County ) { int nCityIndex = (nItemData>>16)&0x000000ff; CString sCity = GetCity(sProvince, nCityIndex).c_str(); RemoveEndAddr(sProvince, sCity, sAddr); }
UINT CGetAccountInfoRequest::ProcessResponse(CHttpFile& pHttpFile) { #ifdef ARTSTORE return 1; #else //Take the HttpFile and parse it. UINT nFileLength = pHttpFile.GetLength(); CString strBuffer; CString strSearch; CString strList; LPSTR b = strBuffer.GetBuffer(nFileLength); pHttpFile.Read(b, nFileLength); strBuffer.ReleaseBuffer(); CBasicRequestInfo::ProcessResponse(strBuffer); UINT nRet = atoi((LPCTSTR)GetStatusCode()); if(nRet == 0) //success { CString strSearch; strSearch = "Last="; ParseFileForValue(strBuffer, strSearch, GetCustLastName()); strSearch = "First="; ParseFileForValue(strBuffer, strSearch, GetCustFirstName()); strSearch = "Street1="; ParseFileForValue(strBuffer, strSearch, GetStreet1()); strSearch = "Street2="; ParseFileForValue(strBuffer, strSearch, GetStreet2()); strSearch = "City="; ParseFileForValue(strBuffer, strSearch, GetCity()); strSearch = "State="; ParseFileForValue(strBuffer, strSearch, GetState()); strSearch = "Country="; ParseFileForValue(strBuffer, strSearch, GetCountry()); strSearch = "ZipCode="; ParseFileForValue(strBuffer, strSearch, GetZipCode()); strSearch = "EMail="; ParseFileForValue(strBuffer, strSearch, GetEMail()); strSearch = "Phone="; ParseFileForValue(strBuffer, strSearch, GetPhone()); } return nRet; #endif }
void MathStudent::PrintAll() const { Student::PrintAll(); const int WIDTH = 17; cout << fixed << left; cout << setw(WIDTH) << "Street Address: " << GetAddress() << endl; cout << setw(WIDTH) << "City: " << GetCity() << endl; cout << setw(WIDTH) << "State: " << GetState() << endl; cout << setw(WIDTH) << "Zip code: " << GetZipCode() << endl; }
void Game::Step4BuyingCities2() { if (!pickedCity) { // Player skipped, go to next player currentPlayer = playerOrder[GetNextPlayerIndex()]; if (currentPlayer.get() == playerOrder[0].get()) { return Step4End(); } return Step4BuyingCities1(); } // Check if city is full if (pickedCity->GetNumberOfHouses() == phase) { SetErrorMessageTextBox("Buying City Error", "Cannot buy a house. <b>" + pickedCity->GetName() + "</b> is already saturated for this phase."); return Step4BuyingCities1(); } // Find the cost of connecting to that city int cost; if (currentPlayer->GetHouses().empty()) cost = pickedCity->GetHousePrice(); else cost = pickedCity->GetHousePrice() + map->GetShortestPath(currentPlayer, pickedCity->GetName()); // Check if you have enough money if (!currentPlayer->HasElektro(cost)) { SetErrorMessageTextBox("Not Enough Money", "Not enough money to buy <b>" + pickedCity->GetName() + "</b> for a total cost of <b>" + std::to_string(cost) + "</b> Elektro."); return Step4BuyingCities1(); } // Buy the city auto newHouse = std::make_shared<House>(pickedCity, currentPlayer->GetColor()); newHouse->SetPrice(cost); // Check for enough money if (!currentPlayer->HasElektro(newHouse->GetPrice())) { SetErrorMessageTextBox("House Error", "Not enough money to buy this house"); return Step4BuyingCities1(); } // Check if already bought in this city for (auto tmpHouse : currentPlayer->GetHouses()) { if (tmpHouse->GetCity() == newHouse->GetCity()) { SetErrorMessageTextBox("House Error", "Cannot buy in the same city twice"); return Step4BuyingCities1(); } } currentPlayer->BuyHouse(newHouse); SetInfoMessageTextBox("Buying City Success", "<b>" + currentPlayer->GetName() + "</b> has bought a house at <b>" + pickedCity->GetName() + "</b> for a total cost of <b>" + std::to_string(cost) + "</b> Elektro."); // Go back to buy another one return Step4BuyingCities1(); }