本文整理汇总了C++中IBattle::RestrictedUnits方法的典型用法代码示例。如果您正苦于以下问题:C++ IBattle::RestrictedUnits方法的具体用法?C++ IBattle::RestrictedUnits怎么用?C++ IBattle::RestrictedUnits使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBattle
的用法示例。
在下文中一共展示了IBattle::RestrictedUnits方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteScriptTxt
//.........这里部分代码省略.........
if ( startpostype == IBattle::ST_Random )
{
random_shuffle( remap_positions.begin(), remap_positions.end() ); // shuffle the positions
}
}
if ( battle.IsProxy() )
{
if ( ( startpostype == IBattle::ST_Random ) || ( startpostype == IBattle::ST_Fixed ) )
{
tdf.Append( _T("startpostype"), IBattle::ST_Pick );
}
else tdf.Append( _T("startpostype"), startpostype );
}
else tdf.Append( _T("startpostype"), startpostype );
tdf.EnterSection( _T("mapoptions") );
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
示例2: WriteScriptTxt
//.........这里部分代码省略.........
NumTeams++;
}
LSL::MapInfo infos = battle.LoadMap().info;
unsigned int nummapstartpositions = infos.positions.size();
unsigned int copysize = std::min( nummapstartpositions, NumTeams );
remap_positions = std::vector<LSL::StartPos> ( infos.positions.begin(), infos.positions.begin() + copysize ); // only add the first x positions
if ( startpostype == IBattle::ST_Random ) {
std::random_shuffle( remap_positions.begin(), remap_positions.end() ); // shuffle the positions
}
}
if ( battle.IsProxy() ) {
if ( ( startpostype == IBattle::ST_Random ) || ( startpostype == IBattle::ST_Fixed ) ) {
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++ ) {