本文整理汇总了C++中cGold::afford方法的典型用法代码示例。如果您正苦于以下问题:C++ cGold::afford方法的具体用法?C++ cGold::afford怎么用?C++ cGold::afford使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cGold
的用法示例。
在下文中一共展示了cGold::afford方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: check_farm
void cScreenTown::check_farm(int FarmNum)
{ // player clicked on one of the brothels
if (g_Farm.GetNumBrothels() == FarmNum)
{ // player doesn't own this Studio... can he buy it?
static_brothel_data *bck = farm_data + FarmNum;
locale syslocale("");
stringstream ss;
ss.imbue(syslocale);
if (!g_Gold.afford(bck->price) || g_Gangs.GetNumBusinessExtorted() < bck->business)
{ // can't buy it
ss << gettext("This building costs ") << bck->price << gettext(" gold and you need to control at least ") << bck->business << gettext(" businesses.");
if (!g_Gold.afford(bck->price))
ss << "\n" << gettext("You need ") << (bck->price - g_Gold.ival()) << gettext(" more gold to afford it.");
if (g_Gangs.GetNumBusinessExtorted() < bck->business)
ss << "\n" << gettext("You need to control ") << (bck->business - g_Gangs.GetNumBusinessExtorted()) << gettext(" more businesses.");
g_MessageQue.AddToQue(ss.str(), 0);
}
else
{ // can buy it
ss << gettext("Do you wish to purchase this building for ") << bck->price << gettext(" gold? It has ") << bck->rooms << gettext(" rooms.");
g_MessageQue.AddToQue(ss.str(), 2);
g_ChoiceManager.CreateChoiceBox(224, 112, 352, 384, 0, 2, 32, 8);
g_ChoiceManager.AddChoice(0, gettext("Buy It"), 0);
g_ChoiceManager.AddChoice(0, gettext("Don't Buy It"), 1);
g_ChoiceManager.SetActive(0);
BuyFarm = FarmNum;
}
}
else
{ // player owns this brothel... go to it
g_Building = BUILDING_FARM;
g_CurrFarm = FarmNum;
g_WinManager.push("Farm Screen");
}
}