本文整理汇总了C++中team::gold方法的典型用法代码示例。如果您正苦于以下问题:C++ team::gold方法的具体用法?C++ team::gold怎么用?C++ team::gold使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类team
的用法示例。
在下文中一共展示了team::gold方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_enough_gold
bool recruit_result::test_enough_gold(const team &my_team, const unit_type &type, bool)
{
if (my_team.gold() < type.cost()) {
set_error(E_NO_GOLD);
return false;
}
return true;
}
示例2: test_enough_gold
bool recall_result::test_enough_gold(const team &my_team)
{
if (my_team.gold() < my_team.recall_cost() ) {
set_error(E_NO_GOLD);
return false;
}
return true;
}
示例3: calculate_team_data
team_data display_context::calculate_team_data(const team& tm) const
{
team_data res;
res.units = side_units(tm.side());
res.upkeep = side_upkeep(tm.side());
res.villages = tm.villages().size();
res.expenses = std::max<int>(0,res.upkeep - tm.support());
res.net_income = tm.total_income() - res.expenses;
res.gold = tm.gold();
res.teamname = tm.user_team_name();
return res;
}
示例4: generate_report
//.........这里部分代码省略.........
}
int b = tod.lawful_bonus;
int c = tod.liminal_bonus;
tooltip << tod.name << '\n'
<< _("Lawful units: ") << signed_percent(b) << "\n"
<< _("Neutral units: ") << signed_percent(0) << "\n"
<< _("Chaotic units: ") << signed_percent(-b);
if (tod.liminal_present)
tooltip << "\n" << _("Liminal units: ") << signed_percent(c);
std::string tod_image = tod.image;
if (tod.lawful_bonus_modified > 0) tod_image += "~BRIGHTEN()";
else if (tod.lawful_bonus_modified < 0) tod_image += "~DARKEN()";
if (preferences::flip_time()) tod_image += "~FL(horiz)";
if (game_config::tiny_gui) {
return report("", tod_image, "");
} else {
return report("", tod_image, tooltip.str(), "time_of_day");
}
}
case TURN: {
str << teams[playing_side-1].name() << "[" << resources::tod_manager->turn() << "]";
int nb = resources::tod_manager->number_of_turns();
if (nb != -1) str << '/' << nb;
break;
}
// For the following status reports, show them in gray text
// when it is not the active player's turn.
case GOLD: {
//Supposes the full/"pathfind" unit map is applied
int fake_gold = viewing_team.gold();
if (current_side != playing_side) {
str << font::GRAY_TEXT;
} else if (fake_gold < 0) {
str << font::RED_TEXT;
}
int cost_exponent = viewing_team.cost_exponent();
int hundred = cost_exponent / 100;
str << viewing_team.gold() << "(" << hundred << "." << (cost_exponent - hundred * 100) / 10 << ")";
break;
}
case VILLAGES: {
const team_data data = calculate_team_data(viewing_team,current_side);
if (current_side != playing_side)
str << font::GRAY_TEXT;
str << data.villages << '/';
if (viewing_team.uses_shroud()) {
int unshrouded_villages = 0;
std::vector<map_location>::const_iterator i = map.villages().begin();
for (; i != map.villages().end(); ++i) {
if (!viewing_team.shrouded(*i))
++unshrouded_villages;
}
str << unshrouded_villages;
} else {
str << map.villages().size();
}
break;
}
case UPKEEP: {
const team_data data = calculate_team_data(viewing_team,current_side);
示例5: report_victory
void campaign_controller::report_victory(
std::ostringstream &report, team& t,
int finishing_bonus_per_turn, int turns_left, int finishing_bonus)
{
report << "<small>" << _("Remaining gold: ") << utils::half_signed_value(t.gold()) << "</small>";
if(t.carryover_bonus() != 0) {
if (turns_left > -1) {
report << "\n\n<b>" << _("Turns finished early: ") << turns_left << "</b>\n"
<< "<small>" << _("Early finish bonus: ") << finishing_bonus_per_turn << _(" per turn") << "</small>\n"
<< "<small>" << _("Total bonus: ") << finishing_bonus << "</small>\n";
}
report << "<small>" << _("Total gold: ") << utils::half_signed_value(t.gold() + finishing_bonus) << "</small>";
}
if (t.gold() > 0) {
report << "\n<small>" << _("Carryover percentage: ") << t.carryover_percentage() << "</small>";
}
if(t.carryover_add()) {
report << "\n\n<big><b>" << _("Bonus gold: ") << utils::half_signed_value(t.carryover_gold()) << "</b></big>";
} else {
report << "\n\n<big><b>" << _("Retained gold: ") << utils::half_signed_value(t.carryover_gold()) << "</b></big>";
}
std::string goldmsg;
utils::string_map symbols;
symbols["gold"] = lexical_cast_default<std::string>(t.carryover_gold());
// Note that both strings are the same in English, but some languages will
// want to translate them differently.
if(t.carryover_add()) {
if(t.carryover_gold() > 0) {
goldmsg = vngettext(
"You will start the next scenario with $gold "
"on top of the defined minimum starting gold.",
"You will start the next scenario with $gold "
"on top of the defined minimum starting gold.",
t.carryover_gold(), symbols);
} else {
goldmsg = vngettext(
"You will start the next scenario with "
"the defined minimum starting gold.",
"You will start the next scenario with "
"the defined minimum starting gold.",
t.carryover_gold(), symbols);
}
} else {
goldmsg = vngettext(
"You will start the next scenario with $gold "
"or its defined minimum starting gold, "
"whichever is higher.",
"You will start the next scenario with $gold "
"or its defined minimum starting gold, "
"whichever is higher.",
t.carryover_gold(), symbols);
}
// xgettext:no-c-format
report << "\n" << goldmsg;
}
示例6: generate_report
//.........这里部分代码省略.........
case UNIT_PROFILE:
return report("", u->profile(), "");
case TIME_OF_DAY: {
time_of_day tod = resources::tod_manager->time_of_day_at(units, mouseover, *resources::game_map);
const std::string tod_image = tod.image + (preferences::flip_time() ? "~FL(horiz)" : "");
// Don't show illuminated time on fogged/shrouded tiles
if (current_team.fogged(mouseover) || current_team.shrouded(mouseover)) {
tod = resources::tod_manager->get_time_of_day(false, mouseover);
}
std::stringstream tooltip;
tooltip << tod.name << "\n"
<< _("Lawful units: ")
<< (tod.lawful_bonus > 0 ? "+" : "") << tod.lawful_bonus << "%\n"
<< _("Neutral units: ") << "0%\n"
<< _("Chaotic units: ")
<< (tod.lawful_bonus < 0 ? "+" : "") << (tod.lawful_bonus*-1) << "%";
return report("",tod_image,tooltip.str());
}
case TURN: {
str << resources::tod_manager->turn();
int nb = resources::tod_manager->number_of_turns();
if (nb != -1) str << '/' << nb;
break;
}
// For the following status reports, show them in gray text
// when it is not the active player's turn.
case GOLD: {
char const *end = naps;
if (current_side != playing_side)
str << span_color(font::GRAY_COLOUR);
else if (current_team.gold() < 0)
str << span_color(font::BAD_COLOUR);
else
end = "";
str << current_team.gold() << end;
break;
}
case VILLAGES: {
const team_data data = calculate_team_data(current_team,current_side,units);
if (current_side != playing_side)
str << span_color(font::GRAY_COLOUR);
str << data.villages << '/';
if (current_team.uses_shroud()) {
int unshrouded_villages = 0;
std::vector<map_location>::const_iterator i = map.villages().begin();
for (; i != map.villages().end(); i++) {
if (!current_team.shrouded(*i))
unshrouded_villages++;
}
str << unshrouded_villages;
} else {
str << map.villages().size();
}
if (current_side != playing_side)
str << naps;
break;
}
case NUM_UNITS: {
if (current_side != playing_side)
str << span_color(font::GRAY_COLOUR);
str << side_units(units, current_side);
if (current_side != playing_side)
str << naps;