本文整理汇总了C++中PlayerState::get_id方法的典型用法代码示例。如果您正苦于以下问题:C++ PlayerState::get_id方法的具体用法?C++ PlayerState::get_id怎么用?C++ PlayerState::get_id使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PlayerState
的用法示例。
在下文中一共展示了PlayerState::get_id方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: pay
GameRules::EGR_result GameRules::pay(int& amt)
{
PlayerState& plr = fState->get_player(fState->get_current_turn());
PlayerState* onr = NULL;
unsigned pay = 0;
// check to see if we are dealing with an ownable property
if (fState->get_property(fMoveTo).has_owner())
onr = &(fState->get_player(fState->get_property(fMoveTo).get_owner()));
// figure out how much the player owes
switch (fBase.type(fMoveTo))
{
case Game_Base::kITax: // percentage tax
pay = plr.get_money() * fBase.price(fMoveTo) / 100;
break;
case Game_Base::kLTax: // flat tax
pay = fBase.price(fMoveTo);
break;
case Game_Base::kUtil: // utility
pay = fRoll * count_mems(*onr, fMoveTo) * 4;
break;
case Game_Base::kRRoad: // rail road
pay = fBase.rent(fMoveTo, count_mems(*onr, fMoveTo) - 1);
break;
case Game_Base::kProp: // property
pay = fBase.rent(fMoveTo, fState->get_property(fMoveTo).get_level());
if (fState->get_property(fMoveTo).get_level() == 0 &&
owns_group((unsigned)onr->get_id(), fBase.group(fMoveTo)))
pay *= 2;
break;
}
// return the amount to be paid
amt = pay;
// check for insufficient assets
if (plr.get_money() < pay)
if (!free(plr.get_id(), pay)) // if still insufficient
{
if (Game_Base::kUtil <= fBase.type(fMoveTo))
onr->add_money(plr.get_money()); // tranfer whatever they have
return kConcede; // and send concede signal
}
// if they have enough, transfer funds to owner
plr.sub_money(pay);
if (Game_Base::kUtil <= fBase.type(fMoveTo)) onr->add_money(pay);
return kDone;
}