本文整理汇总了C++中IBattle::GetStartRect方法的典型用法代码示例。如果您正苦于以下问题:C++ IBattle::GetStartRect方法的具体用法?C++ IBattle::GetStartRect怎么用?C++ IBattle::GetStartRect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IBattle
的用法示例。
在下文中一共展示了IBattle::GetStartRect方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: WriteScriptTxt
//.........这里部分代码省略.........
if ( parsedteams.find( status.team ) != parsedteams.end() ) continue; // skip duplicates
parsedteams.insert( status.team );
tdf.EnterSection( _T("TEAM") + TowxString( teams_to_sorted_teams[status.team] ) );
if ( !usync().VersionSupports( IUnitSync::USYNC_GetSkirmishAI ) && status.IsBot() )
{
tdf.Append( _T("AIDLL"), status.aishortname );
tdf.Append( _T("TeamLeader"), player_to_number[&battle.GetUser( status.owner )] ); // bot owner is the team leader
}
else
{
if ( status.IsBot() )
{
tdf.Append( _T("TeamLeader"), player_to_number[&battle.GetUser( status.owner )] );
}
else
{
tdf.Append( _T("TeamLeader"), player_to_number[&usr] );
}
}
if ( battle.IsProxy() )
{
if ( startpostype == IBattle::ST_Pick )
{
tdf.Append(_T("StartPosX"), status.pos.x );
tdf.Append(_T("StartPosZ"), status.pos.y );
}
else if ( ( startpostype == IBattle::ST_Fixed ) || ( startpostype == IBattle::ST_Random ) )
{
int teamnumber = teams_to_sorted_teams[status.team];
if ( teamnumber < int(remap_positions.size()) ) // don't overflow
{
StartPos position = remap_positions[teamnumber];
tdf.Append(_T("StartPosX"), position.x );
tdf.Append(_T("StartPosZ"), position.y );
}
}
}
else
{
if ( startpostype == IBattle::ST_Pick )
{
tdf.Append(_T("StartPosX"), status.pos.x );
tdf.Append(_T("StartPosZ"), status.pos.y );
}
}
tdf.Append( _T("AllyTeam"),status.ally );
wxString colourstring =
TowxString( status.colour.Red()/255.0 ) + _T(' ') +
TowxString( status.colour.Green()/255.0 ) + _T(' ') +
TowxString( status.colour.Blue()/255.0 );
tdf.Append( _T("RGBColor"), colourstring);
unsigned int side = status.side;
if ( side < sides.GetCount() ) tdf.Append( _T("Side"), sides[side] );
tdf.Append( _T("Handicap"), status.handicap );
tdf.LeaveSection();
}
tdf.AppendLineBreak();
unsigned int maxiter = std::max( NumUsers, battle.GetLastRectIdx() + 1 );
std::set<int> parsedallys;
for ( unsigned int i = 0; i < maxiter; i++ )
{
User& usr = battle.GetUser( i );
UserBattleStatus& status = usr.BattleStatus();
BattleStartRect sr = battle.GetStartRect( i );
if ( status.spectator && !sr.IsOk() ) continue;
int ally = status.ally;
if ( status.spectator ) ally = i;
if ( parsedallys.find( ally ) != parsedallys.end() ) continue; // skip duplicates
sr = battle.GetStartRect( ally );
parsedallys.insert( ally );
tdf.EnterSection( _T("ALLYTEAM") + TowxString( ally ) );
tdf.Append( _T("NumAllies"), 0 );
if ( sr.IsOk() )
{
const char* old_locale = std::setlocale(LC_NUMERIC, "C");
tdf.Append( _T("StartRectLeft"), wxString::Format( _T("%.3f"), sr.left / 200.0 ) );
tdf.Append( _T("StartRectTop"), wxString::Format( _T("%.3f"), sr.top / 200.0 ) );
tdf.Append( _T("StartRectRight"), wxString::Format( _T("%.3f"), sr.right / 200.0 ) );
tdf.Append( _T("StartRectBottom"), wxString::Format( _T("%.3f"), sr.bottom / 200.0 ) );
std::setlocale(LC_NUMERIC, old_locale);
}
tdf.LeaveSection();
}
tdf.LeaveSection();
return ret;
}
示例2: WriteScriptTxt
//.........这里部分代码省略.........
int optionmapindex = battle.CustomBattleOptions().GetAIOptionIndex(user.GetNick());
if ( optionmapindex > 0 ) {
for (const auto& it : battle.CustomBattleOptions().getOptions((LSL::Enum::GameOption)optionmapindex )) {
tdf.Append(it.first, it.second.second);
}
}
tdf.LeaveSection();
tdf.LeaveSection();
player_to_number[&user] = i;
}
tdf.AppendLineBreak();
std::set<int> parsedteams;
const auto sides = LSL::usync().GetSides(battle.GetHostModName());
for ( unsigned int i = 0; i < NumUsers; i++ ) {
User& usr = battle.GetUser( i );
UserBattleStatus& status = usr.BattleStatus();
if ( status.spectator ) continue;
if ( parsedteams.find( status.team ) != parsedteams.end() ) continue; // skip duplicates
parsedteams.insert( status.team );
tdf.EnterSection(stdprintf("TEAM%d", teams_to_sorted_teams[status.team]));
if ( status.IsBot() ) {
tdf.Append("TeamLeader", player_to_number[&battle.GetUser( status.owner )] );
} else {
tdf.Append("TeamLeader", player_to_number[&usr] );
}
if ( battle.IsProxy() ) {
if ( startpostype == IBattle::ST_Pick ) {
tdf.Append("StartPosX", status.pos.x );
tdf.Append("StartPosZ", status.pos.y );
} else if ( ( startpostype == IBattle::ST_Fixed ) || ( startpostype == IBattle::ST_Random ) ) {
int teamnumber = teams_to_sorted_teams[status.team];
if ( teamnumber < int(remap_positions.size()) ) { // don't overflow
LSL::StartPos position = remap_positions[teamnumber];
tdf.Append("StartPosX", position.x );
tdf.Append("StartPosZ", position.y );
}
}
} else {
if ( startpostype == IBattle::ST_Pick ) {
tdf.Append("StartPosX", status.pos.x );
tdf.Append("StartPosZ", status.pos.y );
}
}
tdf.Append("AllyTeam",status.ally );
wxString colourstring =
TowxString( status.colour.Red()/255.0 ) + _T(' ') +
TowxString( status.colour.Green()/255.0 ) + _T(' ') +
TowxString( status.colour.Blue()/255.0 );
tdf.Append("RGBColor", STD_STRING(colourstring));
unsigned int side = status.side;
if ( side < sides.size() ) tdf.Append("Side", sides[side] );
tdf.Append("Handicap", status.handicap );
tdf.LeaveSection();
}
tdf.AppendLineBreak();
unsigned int maxiter = std::max( NumUsers, battle.GetLastRectIdx() + 1 );
std::set<int> parsedallys;
for ( unsigned int i = 0; i < maxiter; i++ ) {
User& usr = battle.GetUser( i );
UserBattleStatus& status = usr.BattleStatus();
BattleStartRect sr = battle.GetStartRect( i );
if ( status.spectator && !sr.IsOk() )
continue;
int ally = status.ally;
if ( status.spectator )
ally = i;
if ( parsedallys.find( ally ) != parsedallys.end() )
continue; // skip duplicates
sr = battle.GetStartRect( ally );
parsedallys.insert( ally );
tdf.EnterSection( stdprintf("ALLYTEAM%d", ally));
tdf.Append("NumAllies", 0 );
if ( startpostype == IBattle::ST_Choose ) {
if ( sr.IsOk() ) {
const char* old_locale = std::setlocale(LC_NUMERIC, "C");
tdf.Append("StartRectLeft", wxFormat( _T("%.3f") ) % ( sr.left / 200.0 ) );
tdf.Append("StartRectTop", wxFormat( _T("%.3f") ) % ( sr.top / 200.0 ) );
tdf.Append("StartRectRight", wxFormat( _T("%.3f") ) % ( sr.right / 200.0 ) );
tdf.Append("StartRectBottom", wxFormat( _T("%.3f") ) % ( sr.bottom / 200.0 ) );
std::setlocale(LC_NUMERIC, old_locale);
}
}
tdf.LeaveSection();
}
tdf.LeaveSection();
return TowxString(ret.str());
}