本文整理汇总了C++中team类的典型用法代码示例。如果您正苦于以下问题:C++ team类的具体用法?C++ team怎么用?C++ team使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了team类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: teleport_map_
pathfind::teleport_map::teleport_map(
const std::vector<teleport_group>& groups
, const unit& u
, const team &viewing_team
, const bool see_all
, const bool ignore_units)
: teleport_map_()
, sources_()
, targets_()
{
foreach(const teleport_group& group, groups) {
teleport_pair locations;
group.get_teleport_pair(locations, u, ignore_units);
if (!see_all && !group.always_visible() && viewing_team.is_enemy(u.side())) {
teleport_pair filter_locs;
foreach(const map_location &loc, locations.first)
if(!viewing_team.fogged(loc))
filter_locs.first.insert(loc);
foreach(const map_location &loc, locations.second)
if(!viewing_team.fogged(loc))
filter_locs.second.insert(loc);
locations.first.swap(filter_locs.first);
locations.second.swap(filter_locs.second);
}
示例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: show_objectives
void show_objectives(const config &level, const team& t)
{
static const std::string no_objectives(_("No objectives available"));
const std::string& objectives = t.objectives();
gui2::show_transient_message(resources::screen->video(), level["name"],
t.form_results_of_battle_tip(objectives.empty() ? no_objectives : objectives), "", true);
}
示例4: test_available_for_recalling
bool recall_result::test_available_for_recalling(const team &my_team, bool)
{
const std::vector<unit>::const_iterator rec = std::find_if(my_team.recall_list().begin(), my_team.recall_list().end(), boost::bind(&unit::matches_id, _1, unit_id_));
if (rec == my_team.recall_list().end()) {
set_error(E_NOT_AVAILABLE_FOR_RECALLING);
return false;
}
return true;
}
示例5:
carryover::carryover(const team& t, const int gold, const bool add)
: add_ (add)
, current_player_(t.current_player())
, gold_(gold)
, previous_recruits_(t.recruits())
, recall_list_()
, save_id_(t.save_id())
, variables_(t.variables())
{
for(const unit_const_ptr & u : t.recall_list()) {
recall_list_.emplace_back();
u->write(recall_list_.back());
}
}
示例6: test_enough_gold
bool recall_result::test_enough_gold(const team &my_team, bool)
{
if (my_team.gold() < game_config::recall_cost ) {
set_error(E_NO_GOLD);
return false;
}
return true;
}
示例7: get_recall_unit
unit_const_ptr recall_result::get_recall_unit(const team &my_team)
{
unit_const_ptr rec = my_team.recall_list().find_if_matches_id(unit_id_);
if (!rec) {
set_error(E_NOT_AVAILABLE_FOR_RECALLING);
}
return rec;
}
示例8: on_create
void strategy_formulation_with_rca::on_create()
{
const std::vector<team> teams = *resources::teams;
const int own_side = this->get_side();
const team own_team = teams[own_side-1];
rca_->on_create();
for(size_t i = 0; i != teams.size(); ++i){
if(own_side+i <= teams.size()){
enemy_this_turn_.push_back(own_team.is_enemy(own_side+i));
} else {
enemy_this_turn_.push_back(own_team.is_enemy((own_side+i)%teams.size()));
}
}
enemy_this_turn_.push_back(false);
}
示例9: check_side_number
static bool check_side_number(const team &t, const std::string &str)
{
std::vector<std::string> list = utils::split(str);
std::string side_number = str_cast(t.side());
if (std::find(list.begin(),list.end(),side_number)==list.end())
{
return false;
}
return true;
}
示例10: switch
bool game_board::team_is_defeated(const team& t) const
{
switch(t.defeat_condition().v)
{
case team::DEFEAT_CONDITION::ALWAYS:
return true;
case team::DEFEAT_CONDITION::NO_LEADER:
return !units_.find_leader(t.side()).valid();
case team::DEFEAT_CONDITION::NO_UNITS:
for (const unit& u : units_)
{
if(u.side() == t.side())
return false;
}
return true;
case team::DEFEAT_CONDITION::NEVER:
default:
return false;
}
}
示例11: sim1
void sim1(team &T1,team &T2)
{
system("cls");
int a,b,p = 0,q = 0,i,j = 9000;
float k =0;
srand(time(NULL));
a = rand()%5;
b = rand()%5;
if (a>b)
{
T1.add();
T1.points+=3;
T1.w++;
T2.l++;
}
else if(a==b)
{
T1.points+=1;
T2.points+=1;
T1.rem+=2000;
T2.rem+=2000;
T1.d++;
T2.d++;
}
else
{
T2.points+=3;
T2.add();
T2.w++;
T1.l++;
}
T1.deduct();
}
示例12: get_teleport_locations
std::set<map_location> get_teleport_locations(const unit &u,
const unit_map &units, const team &viewing_team,
bool see_all, bool ignore_units)
{
std::set<map_location> res;
if (!u.get_ability_bool("teleport")) return res;
const team ¤t_team = (*resources::teams)[u.side() - 1];
const map_location &loc = u.get_location();
foreach (const map_location &l, current_team.villages())
{
// This must be a vacant village (or occupied by the unit)
// to be able to teleport.
if (!see_all && viewing_team.is_enemy(u.side()) && viewing_team.fogged(l))
continue;
if (!ignore_units && l != loc &&
get_visible_unit(units, l, viewing_team, see_all))
continue;
res.insert(l);
}
return res;
}
示例13: side_units
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;
}
示例14: revivaled_can_auto_end_turn
bool revivaled_can_auto_end_turn(const team& t)
{
if (tent::mode == mode_tag::TOWER || tent::mode == mode_tag::LAYOUT) {
return true;
}
const std::pair<unit**, size_t> p = t.field_troop();
for (size_t i = 0; i < p.second; i ++) {
unit& u = *p.first[i];
if (u.get_state(ustate_tag::REVIVALED) && u.attacks_left()) {
return false;
}
}
return true;
}
示例15:
carryover::carryover(const team& t, const int gold, const bool add)
: add_ (add)
, color_(t.color())
, current_player_(t.current_player())
, gold_(gold)
, name_(t.name())
, previous_recruits_(t.recruits())
, recall_list_(t.recall_list())
, save_id_(t.save_id())
{}