本文整理汇总了C++中unit::recall_cost方法的典型用法代码示例。如果您正苦于以下问题:C++ unit::recall_cost方法的具体用法?C++ unit::recall_cost怎么用?C++ unit::recall_cost使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类unit
的用法示例。
在下文中一共展示了unit::recall_cost方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: internal_matches_filter
//.........这里部分代码省略.........
has_weapon = true;
break;
}
}
if(!has_weapon) {
return false;
}
} else if (!vcfg["has_weapon"].blank()) {
std::string weapon = vcfg["has_weapon"];
bool has_weapon = false;
for(const attack_type& a : u.attacks()) {
if(a.id() == weapon) {
has_weapon = true;
break;
}
}
if(!has_weapon) {
return false;
}
}
if (!vcfg["role"].blank() && vcfg["role"].str() != u.get_role()) {
return false;
}
if (!vcfg["ai_special"].blank() && ((vcfg["ai_special"].str() == "guardian") != u.get_state(unit::STATE_GUARDIAN))) {
return false;
}
if (!vcfg["canrecruit"].blank() && vcfg["canrecruit"].to_bool() != u.can_recruit()) {
return false;
}
if (!vcfg["recall_cost"].blank() && vcfg["recall_cost"].to_int(-1) != u.recall_cost()) {
return false;
}
if (!vcfg["level"].blank() && vcfg["level"].to_int(-1) != u.level()) {
return false;
}
if (!vcfg["defense"].blank() && vcfg["defense"].to_int(-1) != u.defense_modifier(fc_.get_disp_context().map().get_terrain(loc))) {
return false;
}
if (!vcfg["movement_cost"].blank() && vcfg["movement_cost"].to_int(-1) != u.movement_cost(fc_.get_disp_context().map().get_terrain(loc))) {
return false;
}
// Now start with the new WML based comparison.
// If a key is in the unit and in the filter, they should match
// filter only => not for us
// unit only => not filtered
config unit_cfg; // No point in serializing the unit once for each [filter_wml]!
for (const vconfig& wmlcfg : vcfg.get_children("filter_wml")) {
config fwml = wmlcfg.get_parsed_config();
/* Check if the filter only cares about variables.
If so, no need to serialize the whole unit. */
config::all_children_itors ci = fwml.all_children_range();
if (fwml.all_children_count() == 1 &&
fwml.attribute_count() == 1 &&
ci.front().key == "variables") {
if (!u.variables().matches(ci.front().cfg))
return false;
} else {
if (unit_cfg.empty())
示例2: un_recall_unit_cost
int un_recall_unit_cost(const unit& u) // this really belongs elsewhere, perhaps in undo.cpp
{ // but I'm too lazy to do it at the moment
stats& s = get_stats(u.side_id());
s.recalls[u.type_id()]--;
return u.recall_cost();
}