本文整理汇总了C++中IBattle::GetNumPlayers方法的典型用法代码示例。如果您正苦于以下问题:C++ IBattle::GetNumPlayers方法的具体用法?C++ IBattle::GetNumPlayers怎么用?C++ IBattle::GetNumPlayers使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBattle
的用法示例。
在下文中一共展示了IBattle::GetNumPlayers方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteScriptTxt
//.........这里部分代码省略.........
OptionsWrapper::wxStringTripleVec optlistMap = battle.CustomBattleOptions().getOptions( OptionsWrapper::MapOption );
for (OptionsWrapper::wxStringTripleVec::const_iterator it = optlistMap.begin(); it != optlistMap.end(); ++it)
{
tdf.Append(it->first,it->second.second);
}
tdf.LeaveSection();
tdf.EnterSection(_T("modoptions"));
OptionsWrapper::wxStringTripleVec optlistMod = battle.CustomBattleOptions().getOptions( OptionsWrapper::ModOption );
for (OptionsWrapper::wxStringTripleVec::const_iterator it = optlistMod.begin(); it != optlistMod.end(); ++it)
{
tdf.Append(it->first,it->second.second);
}
tdf.LeaveSection();
std::map<wxString,int> units = battle.RestrictedUnits();
tdf.Append( _T("NumRestrictions"), units.size());
tdf.EnterSection( _T("RESTRICT") );
int restrictcount = 0;
for ( std::map<wxString, int>::iterator itor = units.begin(); itor != units.end(); itor++ )
{
tdf.Append(_T("Unit") + TowxString( restrictcount ), itor->first );
tdf.Append(_T("Limit") + TowxString( restrictcount ), itor->second );
restrictcount++;
}
tdf.LeaveSection();
tdf.AppendLineBreak();
if ( battle.IsProxy() )
{
tdf.Append( _T("NumPlayers"), battle.GetNumPlayers() -1 );
tdf.Append( _T("NumUsers"), battle.GetNumUsers() -1 );
}
else
{
tdf.Append( _T("NumPlayers"), battle.GetNumPlayers() );
tdf.Append( _T("NumUsers"), battle.GetNumUsers() );
}
tdf.AppendLineBreak();
unsigned int NumUsers = battle.GetNumUsers();
typedef std::map<int, int> ProgressiveTeamsVec;
typedef ProgressiveTeamsVec::iterator ProgressiveTeamsVecIter;
ProgressiveTeamsVec teams_to_sorted_teams; // original team -> progressive team
int free_team = 0;
std::map<User*, int> player_to_number; // player -> ordernumber
srand ( time(NULL) );
for ( unsigned int i = 0; i < NumUsers; i++ )
{
User& user = battle.GetUser( i );
UserBattleStatus& status = user.BattleStatus();
if ( !status.spectator )
{
ProgressiveTeamsVecIter itor = teams_to_sorted_teams.find ( status.team );
if ( itor == teams_to_sorted_teams.end() )
{
teams_to_sorted_teams[status.team] = free_team;
free_team++;
}
}
if ( battle.IsProxy() && ( user.GetNick() == battle.GetFounder().GetNick() ) ) continue;
示例2: WriteScriptTxt
//.........这里部分代码省略.........
tdf.Append("startpostype", IBattle::ST_Pick );
} else tdf.Append("startpostype", startpostype );
} else tdf.Append("startpostype", startpostype );
tdf.EnterSection("mapoptions");
for (const auto& it : battle.CustomBattleOptions().getOptions( LSL::Enum::MapOption )) {
tdf.Append(it.first, it.second.second);
}
tdf.LeaveSection();
tdf.EnterSection("modoptions");
tdf.Append("relayhoststartpostype", startpostype ); // also save the original wanted setting
for (const auto& it : battle.CustomBattleOptions().getOptions( LSL::Enum::ModOption )) {
tdf.Append(it.first, it.second.second);
}
tdf.LeaveSection();
std::map<std::string,int> units = battle.RestrictedUnits();
tdf.Append("NumRestrictions", units.size());
tdf.EnterSection("RESTRICT");
int restrictcount = 0;
for ( std::map<std::string, int>::const_iterator itor = units.begin(); itor != units.end(); ++itor ) {
tdf.Append(stdprintf("Unit%d", restrictcount), itor->first );
tdf.Append(stdprintf("Limit%d", restrictcount), itor->second );
restrictcount++;
}
tdf.LeaveSection();
tdf.AppendLineBreak();
if ( battle.IsProxy() ) {
tdf.Append("NumPlayers", battle.GetNumPlayers() -1 );
tdf.Append("NumUsers", battle.GetNumUsers() -1 );
} else {
tdf.Append("NumPlayers", battle.GetNumPlayers() );
tdf.Append("NumUsers", battle.GetNumUsers() );
}
tdf.AppendLineBreak();
unsigned int NumUsers = battle.GetNumUsers();
typedef std::map<int, int> ProgressiveTeamsVec;
typedef ProgressiveTeamsVec::iterator ProgressiveTeamsVecIter;
ProgressiveTeamsVec teams_to_sorted_teams; // original team -> progressive team
int free_team = 0;
std::map<User*, int> player_to_number; // player -> ordernumber
srand ( time(NULL) );
for ( unsigned int i = 0; i < NumUsers; i++ ) {
User& user = battle.GetUser( i );
UserBattleStatus& status = user.BattleStatus();
if ( !status.spectator ) {
ProgressiveTeamsVecIter itor = teams_to_sorted_teams.find ( status.team );
if ( itor == teams_to_sorted_teams.end() ) {
teams_to_sorted_teams[status.team] = free_team;
free_team++;
}
}
if ( battle.IsProxy() && ( user.GetNick() == battle.GetFounder().GetNick() ) ) continue;
if ( status.IsBot() ) continue;
tdf.EnterSection(stdprintf("PLAYER%d", i));
tdf.Append("Name", user.GetNick() );
tdf.Append("CountryCode", STD_STRING(TowxString(user.GetCountry()).Lower()));
tdf.Append("Spectator", status.spectator );