本文整理汇总了C++中team类的典型用法代码示例。如果您正苦于以下问题:C++ team类的具体用法?C++ team怎么用?C++ team使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了team类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
开发者ID:blackberry,项目名称:Wesnoth,代码行数:26,代码来源:teleport.cpp
示例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;
}
开发者ID:Wedge009,项目名称:wesnoth,代码行数:8,代码来源:actions.cpp
示例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);
}
开发者ID:hyrio,项目名称:War-Of-Kingdom,代码行数:8,代码来源:dialogs.cpp
示例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;
}
开发者ID:Yossarian,项目名称:WesnothAddonServer,代码行数:9,代码来源:actions.cpp
示例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());
}
}
开发者ID:GregoryLundberg,项目名称:wesnoth,代码行数:14,代码来源:carryover.cpp
示例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;
}
开发者ID:Yossarian,项目名称:WesnothAddonServer,代码行数:8,代码来源:actions.cpp
示例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;
}
开发者ID:Wedge009,项目名称:wesnoth,代码行数:8,代码来源:actions.cpp
示例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);
}
开发者ID:Kanac,项目名称:wesnoth,代码行数:18,代码来源:stage_sf_with_rca.cpp
示例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;
}
开发者ID:hyrio,项目名称:War-Of-Kingdom,代码行数:10,代码来源:side_filter.cpp
示例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;
}
}
开发者ID:aquileia,项目名称:wesnoth,代码行数:20,代码来源:game_board.cpp
示例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();
}
开发者ID:vignesh2496,项目名称:CPP-Project,代码行数:40,代码来源:simulate.cpp
示例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;
}
开发者ID:oys0317,项目名称:opensanguo,代码行数:22,代码来源:pathfind.cpp
示例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;
}
开发者ID:fluffbeast,项目名称:wesnoth-old,代码行数:12,代码来源:display_context.cpp
示例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;
}
开发者ID:hyrio,项目名称:War-Of-Kingdom,代码行数:15,代码来源:playsingle_controller.cpp
示例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())
{}
开发者ID:Coffee--,项目名称:wesnoth-old,代码行数:10,代码来源:gamestatus.cpp
示例16: create_jamming_map
/**
* Sets @a jamming to the (newly calculated) "jamming" map for @a view_team.
*/
static void create_jamming_map(std::map<map_location, int> & jamming,
const team & view_team)
{
// Reset the map.
jamming.clear();
// Build the map.
for (const unit &u : resources::gameboard->units())
{
if ( u.jamming() < 1 || !view_team.is_enemy(u.side()) )
continue;
pathfind::jamming_path jam_path(u, u.get_location());
for (const pathfind::paths::step& st : jam_path.destinations) {
if ( jamming[st.curr] < st.move_left )
jamming[st.curr] = st.move_left;
}
}
}
开发者ID:GregoryLundberg,项目名称:wesnoth,代码行数:22,代码来源:vision.cpp
示例17:
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_()
, save_id_(t.save_id())
{
BOOST_FOREACH(const unit_const_ptr & u, t.recall_list()) {
recall_list_.push_back(config());
u->write(recall_list_.back());
}
}
开发者ID:8680-wesnoth,项目名称:wesnoth-fork-old,代码行数:15,代码来源:carryover.cpp
示例18: assert
void aspect_attacks::do_attack_analysis(
const map_location& loc,
const move_map& srcdst, const move_map& dstsrc,
const move_map& fullmove_srcdst, const move_map& fullmove_dstsrc,
const move_map& enemy_srcdst, const move_map& enemy_dstsrc,
const map_location* tiles, bool* used_locations,
std::vector<map_location>& units,
std::vector<attack_analysis>& result,
attack_analysis& cur_analysis,
const team ¤t_team
) const
{
// This function is called fairly frequently, so interact with the user here.
ai::manager::raise_user_interact();
const int default_attack_depth = 5;
if(cur_analysis.movements.size() >= size_t(default_attack_depth)) {
//std::cerr << "ANALYSIS " << cur_analysis.movements.size() << " >= " << get_attack_depth() << "\n";
return;
}
gamemap &map_ = *resources::game_map;
unit_map &units_ = *resources::units;
std::vector<team> &teams_ = *resources::teams;
const size_t max_positions = 1000;
if(result.size() > max_positions && !cur_analysis.movements.empty()) {
LOG_AI << "cut analysis short with number of positions\n";
return;
}
for(size_t i = 0; i != units.size(); ++i) {
const map_location current_unit = units[i];
unit_map::iterator unit_itor = units_.find(current_unit);
assert(unit_itor != units_.end());
// See if the unit has the backstab ability.
// Units with backstab will want to try to have a
// friendly unit opposite the position they move to.
//
// See if the unit has the slow ability -- units with slow only attack first.
bool backstab = false, slow = false;
std::vector<attack_type>& attacks = unit_itor->attacks();
for(std::vector<attack_type>::iterator a = attacks.begin(); a != attacks.end(); ++a) {
a->set_specials_context(map_location(), map_location(), units_, true, NULL);
if(a->get_special_bool("backstab")) {
backstab = true;
}
if(a->get_special_bool("slow")) {
slow = true;
}
}
if(slow && cur_analysis.movements.empty() == false) {
continue;
}
// Check if the friendly unit is surrounded,
// A unit is surrounded if it is flanked by enemy units
// and at least one other enemy unit is nearby
// or if the unit is totaly surrounded by enemies
// with max. one tile to escape.
bool is_surrounded = false;
bool is_flanked = false;
int enemy_units_around = 0;
int accessible_tiles = 0;
map_location adj[6];
get_adjacent_tiles(current_unit, adj);
size_t tile;
for(tile = 0; tile != 3; ++tile) {
const unit_map::const_iterator tmp_unit = units_.find(adj[tile]);
bool possible_flanked = false;
if(map_.on_board(adj[tile]))
{
accessible_tiles++;
if (tmp_unit != units_.end() && current_team.is_enemy(tmp_unit->side()))
{
enemy_units_around++;
possible_flanked = true;
}
}
const unit_map::const_iterator tmp_opposite_unit = units_.find(adj[tile + 3]);
if(map_.on_board(adj[tile + 3]))
{
accessible_tiles++;
if (tmp_opposite_unit != units_.end() && current_team.is_enemy(tmp_opposite_unit->side()))
{
enemy_units_around++;
if(possible_flanked)
{
is_flanked = true;
}
}
}
//.........这里部分代码省略.........
开发者ID:ehsan,项目名称:wesnoth,代码行数:101,代码来源:aspect_attacks.cpp
示例19: sim2
void sim2(team &T1,team &T2)
{
system("cls");
fstream f("team.dat",ios::in);
player p1;
int l,sum=0;
for(int i=0;i<5;i++)
{
f.read((char *)&p1,sizeof(player));
sum+=p1.rate;
}
f.close();
int res;
if((sum>380)&&(sum<410))
res=1;
else if((sum>410)&&(sum<430))
res=2;
else if((sum>430)&&(sum<450))
res=3;
else if((sum>450)&&(sum<470))
res=4;
else if((sum>470)&&(sum<500))
res=5;
int a,b,p = 0,q = 0,i,j = 9000;
float k =0;
srand(time(NULL));
gotoxy(58,6);
cout<<"___________________\n";
gotoxy(58,12);
cout<<"___________________\n";
gotoxy(58,7);
cout<<"|";
gotoxy(58,8);
cout<<"|";
gotoxy(58,9);
cout<<"|";
gotoxy(58,10);
cout<<"|";
gotoxy(58,11);
cout<<"|";
gotoxy(58,12);
cout<<"|";
gotoxy(76,7);
cout<<"|";
gotoxy(76,8);
cout<<"|";
gotoxy(76,9);
cout<<"|";
gotoxy(76,10);
cout<<"|";
gotoxy(76,11);
cout<<"|";
gotoxy(76,12);
cout<<"|";
gotoxy(60,8);
cout<<T1.retname();
gotoxy(70,8);
cout<<T2.retname();
while(j--)
{
k = k + 0.01;
gotoxy(63,4);
cout<<"TIME : "<<(int)k;
}
a = rand()%3+res;
b = rand()%5;
gotoxy(60,10);
cout<<" "<<a;
gotoxy(70,10);
cout<<" "<<b;
gotoxy(10,8);
if (a>b)
{
char ch;
T1.add();
T1.points+=3;
T1.w++;
T2.l++;
cout<<"\n\n\n\nBrilliant!!!!:D You are the new champions League Winner.";
final();
开发者ID:vignesh2496,项目名称:CPP-Project,代码行数:97,代码来源:simulate.cpp
示例20: sim
void sim(team &T1,team &T2)
{
system("cls");
fstream f("team.dat",ios::in);
player p1;
int l,sum=0;
for(int i=0;i<5;i++)
{
f.read((char *)&p1,sizeof(player));
sum+=p1.rate;
}
f.close();
int res;
if((sum>380)&&(sum<410))
res=1;
else if((sum>410)&&(sum<430))
res=2;
else if((sum>430)&&(sum<450))
res=3;
else if((sum>450)&&(sum<470))
res=4;
else if((sum>470)&&(sum<500))
res=5;
int a,b,p = 0,q = 0,i,j = 9000;
float k =0;
srand(time(NULL));
gotoxy(58,6);
cout<<"___________________\n";
gotoxy(58,12);
cout<<"___________________\n";
gotoxy(58,7);
cout<<"|";
gotoxy(58,8);
cout<<"|";
gotoxy(58,9);
cout<<"|";
gotoxy(58,10);
cout<<"|";
gotoxy(58,11);
cout<<"|";
gotoxy(58,12);
cout<<"|";
gotoxy(76,7);
cout<<"|";
gotoxy(76,8);
cout<<"|";
gotoxy(76,9);
cout<<"|";
gotoxy(76,10);
cout<<"|";
gotoxy(76,11);
cout<<"|";
gotoxy(76,12);
cout<<"|";
gotoxy(60,8);
cout<<T1.retname();
gotoxy(70,8);
cout<<T2.retname();
while(j--)
{
k = k + 0.01;
gotoxy(63,4);
cout<<"TIME : "<<(int)k;
}
a = rand()%3+res;//d
b = rand()%5;
gotoxy(60,10);
cout<<" "<<a;
gotoxy(70,10);
cout<<" "<<b;
gotoxy(10,8);
if (a>b)
{
win();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\nCONGRATULATIONS!!!! ";
cout<<T1.retname()<<" won\nYou have won 5000";
T1.add();
T1.points+=3;
T1.w++;
T2.l++;
}
else if(a==b)
{
draw();
cout<<"\n\n\n\n\n\n\n\n\n\n\n\n\nDraw match";
T1.points+=1;
//.........这里部分代码省略.........
开发者ID:vignesh2496,项目名称:CPP-Project,代码行数:101,代码来源:simulate.cpp
注:本文中的team类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论