Exemplo n.º 1
0
void CItemDlg::OnLbnSelchangeItmItemList()
{
	// TODO: 在此添加控件通知处理程序代码
	GetPrice();
	SetPrice();
	SetDesc();
}
Exemplo n.º 2
0
 Trade( VERYLONG timestamp, std::string symbol, VERYLONG quantity, unsigned int price )
 {
    SetPrice( price );
    SetQuantity( quantity );
    SetSymbol( symbol );
    SetTimestamp( timestamp );
 }
Exemplo n.º 3
0
void CItemDlg::OnConfigChanged(BOOL bRomChanged, BOOL bUILangChanged)
{
	SetItemList();
	SetDesc();

	if(bRomChanged)
	{
		m_ctrlConfirm.EnableWindow(!rom.m_bIsFileReadOnly);

		SetPrice();
	}
}
Exemplo n.º 4
0
void CItemDlg::OnBnClickedRefresh()
{
	// TODO: 在此添加控件通知处理程序代码
	if(!rom.ReadItemList())
	{
		AfxMessageBox(IDS_ERR_ROM_READ);
	}
	else
	{
		SetPrice();
	}
}
Exemplo n.º 5
0
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();
}
Exemplo n.º 6
0
void CDBCard::Load(long msgid, BYTE* msgBuf, long& msgBufPos)
{
	// 解析消息
	CDBEntityManager::DBCardMapItr itr = GetGame()->GetDBEntityManager()->GetDBCardMap().find(GetExID());

	char szGuid[128];
	GetExID().tostring(szGuid);

	if(itr != GetGame()->GetDBEntityManager()->DBCardMapEnd())
	{
		WORD attrNum = _GetWordFromByteArray(msgBuf, msgBufPos);

		for(int i=0; i<(int)attrNum; i++)
		{
			// add one card data
			_GetWordFromByteArray(msgBuf, msgBufPos);
			DB_CARD_ATTR_TYPE attrType = (DB_CARD_ATTR_TYPE)_GetLongFromByteArray(msgBuf, msgBufPos);
			switch(attrType)
			{
			case DB_CARD_ATTR_SZ_CARDNUMBER:
				{
					char num[1024];
					_GetStringFromByteArray(msgBuf, msgBufPos, num);
					SetCardNumber(num, strlen(num));
				}
				break;
			case DB_CARD_ATTR_SZ_CARDTYPE:
				{
					char num[1024];
					_GetStringFromByteArray(msgBuf, msgBufPos, num);
					SetCardType(num, strlen(num));
				}
				break;
			case DB_CARD_ATTR_SZ_SELLERACCOUNT:
				{
					char num[1024];
					_GetStringFromByteArray(msgBuf, msgBufPos, num);
					SetSellerAccount(num, strlen(num));
				}
				break;
			case DB_CARD_ATTR_LONG_SELLERID:
				{
					CGUID value;
					_GetBufferFromByteArray(msgBuf, msgBufPos, value);
					SetSellerID(value);
				}
				break;
			case DB_CARD_ATTR_SZ_BUYERACCOUNT:
				{
					char num[1024];
					_GetStringFromByteArray(msgBuf, msgBufPos, num);
					SetCardNumber(num, strlen(num));
				}
				break;
			case DB_CARD_ATTR_LONG_BUYERID:
				{
					CGUID value;
					_GetBufferFromByteArray(msgBuf, msgBufPos, value);
					SetBuyerID(value);
				}
				break;
			case DB_CARD_ATTR_DWORD_PRICE:
				{
					DWORD value = _GetDwordFromByteArray(msgBuf, msgBufPos);
					SetPrice(value);
				}
				break;
			case DB_CARD_ATTR_DWORD_CHARGEPRICE:
				{
					DWORD value = _GetDwordFromByteArray(msgBuf, msgBufPos);
					SetChargePrice(value);
				}
				break;
			case DB_CARD_ATTR_DWORD_CARDSTATE:
				{
					DWORD value = _GetDwordFromByteArray(msgBuf, msgBufPos);
					SetCardState(value);
				}
				break;
			case DB_CARD_ATTR_DWORD_CARDTIME:
				{
					DWORD value = _GetDwordFromByteArray(msgBuf, msgBufPos);
					SetCardTime(value);
				}
				break;
			case DB_CARD_ATTR_DWORD_STARTTIME:
				{
					DWORD value = _GetDwordFromByteArray(msgBuf, msgBufPos);
					SetStartTime(value);
				}
				break;
			case DB_CARD_ATTR_DWORD_SERIALNUMBER:
				{
					DWORD value = _GetDwordFromByteArray(msgBuf, msgBufPos);
					SetSerialNumber(value);
				}
				break;
			}
		}

		CCard *pCard = new CCard;

		if( !pCard) 
		{
			return;
		}

		GetGame()->GetDBEntityManager()->CDBCardToCCard(this, pCard);

		// 返回0为真。
		if( CCardsHandler::getInstance()->InsertCard(pCard) )
		{
			return;
		}
		
		
		////AddLogText("DB2W[%d] : DB_OPER_LOAD_CARD, CardID[%s]...OK!", msgid, szGuid);

		return;
	}

//	//AddLogText("DB2W[%d] : DB_OPER_LOAD_CARD, CardID[%s]...FAILED!", msgid, szGuid);
}