本文整理汇总了C++中UnitPtr::recall_cost方法的典型用法代码示例。如果您正苦于以下问题:C++ UnitPtr::recall_cost方法的具体用法?C++ UnitPtr::recall_cost怎么用?C++ UnitPtr::recall_cost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类UnitPtr
的用法示例。
在下文中一共展示了UnitPtr::recall_cost方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: apply_temp_modifier
void recall::apply_temp_modifier(unit_map& unit_map)
{
assert(valid());
temp_unit_->set_location(recall_hex_);
DBG_WB << "Inserting future recall " << temp_unit_->name() << " [" << temp_unit_->id()
<< "] at position " << temp_unit_->get_location() << ".\n";
//temporarily remove unit from recall list
UnitPtr it = resources::teams->at(team_index()).recall_list().extract_if_matches_id(temp_unit_->id());
assert(it);
//Add cost to money spent on recruits.
int cost = resources::teams->at(team_index()).recall_cost();
if (it->recall_cost() > -1) {
cost = it->recall_cost();
}
// Temporarily insert unit into unit_map
//unit map takes ownership of temp_unit
unit_map.insert(temp_unit_);
resources::teams->at(team_index()).get_side_actions()->change_gold_spent_by(cost);
// Update gold in top bar
resources::screen->invalidate_game_status();
}