本文整理汇总了C++中DataType::BattleStatus方法的典型用法代码示例。如果您正苦于以下问题:C++ DataType::BattleStatus方法的具体用法?C++ DataType::BattleStatus怎么用?C++ DataType::BattleStatus使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataType
的用法示例。
在下文中一共展示了DataType::BattleStatus方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: CompareTeam
int BattleroomListCtrl::CompareTeam(const DataType user1, const DataType user2)
{
if ( !user1 && !user2 ) return 0;
else if ( !user1 ) return 1;
else if ( !user2 ) return -1;
int team1;
if ( user1->BattleStatus().spectator )
team1 = 1000;
else
team1 = user1->BattleStatus().team;
int team2;
if ( user2->BattleStatus().spectator )
team2 = 1000;
else
team2 = user2->BattleStatus().team;
if ( team1 < team2 )
return -1;
if ( team1 > team2 )
return 1;
return 0;
}
示例2: CompareAlly
int BattleroomListCtrl::CompareAlly(const DataType user1, const DataType user2)
{
if ( !user1 && !user2 ) return 0;
else if ( !user1 ) return 1;
else if ( !user2 ) return -1;
int ally1;
if ( user1->BattleStatus().spectator )
ally1 = 1000;
else
ally1 = user1->BattleStatus().ally;
int ally2;
if ( user2->BattleStatus().spectator )
ally2 = 1000;
else
ally2 = user2->BattleStatus().ally;
if ( ally1 < ally2 )
return -1;
if ( ally1 > ally2 )
return 1;
return 0;
}
示例3: CompareRank
int BattleroomListCtrl::CompareRank(const DataType user1, const DataType user2)
{
if ( !user1 && !user2 ) return 0;
else if ( !user1 ) return 1;
else if ( !user2 ) return -1;
int rank1;
if ( user1->BattleStatus().IsBot() )
rank1 = 1000;
else
rank1 = user1->GetStatus().rank;
int rank2;
if ( user2->BattleStatus().IsBot() )
rank2 = 1000;
else
rank2 = user2->GetStatus().rank;
if ( rank1 < rank2 )
return -1;
if ( rank1 > rank2 )
return 1;
return 0;
}
示例4: CompareSide
int BattleroomListCtrl::CompareSide(const DataType user1, const DataType user2)
{
if ( !user1 && !user2 ) return 0;
else if ( !user1 ) return 1;
else if ( !user2 ) return -1;
int side1;
if ( user1->BattleStatus().spectator )
side1 = 1000;
else
side1 = user1->BattleStatus().side;
int side2;
if ( user2->BattleStatus().spectator )
side2 = 1000;
else
side2 = user2->BattleStatus().side;
if ( side1 < side2 )
return -1;
if ( side1 > side2 )
return 1;
return 0;
}
示例5: CompareColor
int BattleroomListCtrl::CompareColor(const DataType user1, const DataType user2)
{
if ( !user1 && !user2 ) return 0;
else if ( !user1 ) return 1;
else if ( !user2 ) return -1;
int color1_r, color1_g, color1_b;
if ( user1->BattleStatus().spectator ) return -1;
color1_r = user1->BattleStatus().colour.Red();
color1_g = user1->BattleStatus().colour.Green();
color1_b = user1->BattleStatus().colour.Blue();
int color2_r, color2_g, color2_b;
if ( user2->BattleStatus().spectator ) return 1;
color2_r = user2->BattleStatus().colour.Red();
color2_g = user2->BattleStatus().colour.Green();
color2_b = user2->BattleStatus().colour.Blue();
if ( (color1_r + color1_g + color1_b)/3 < (color2_r + color2_g + color2_b)/3 )
return -1;
if ( (color1_r + color1_g + color1_b)/3 > (color2_r + color2_g + color2_b)/3 )
return 1;
return 0;
}
示例6: CompareHandicap
int BattleroomListCtrl::CompareHandicap(const DataType user1, const DataType user2)
{
int handicap1;
if ( user1->BattleStatus().spectator )
handicap1 = 1000;
else
handicap1 = user1->BattleStatus().handicap;
int handicap2;
if ( user2->BattleStatus().spectator )
handicap2 = 1000;
else
handicap2 = user2->BattleStatus().handicap;
if ( handicap1 < handicap2 )
return -1;
if ( handicap1 > handicap2 )
return 1;
return 0;
}
示例7: CompareStatus
int BattleroomListCtrl::CompareStatus(const DataType user1, const DataType user2, const IBattle* battle )
{
int status1 = 0;
if ( user1->BattleStatus().IsBot() )
{
status1 = 9;
}
else
{
try
{
if ( &battle->GetFounder() != user1 )
status1 = 1;
}catch(...){}
if ( user1->BattleStatus().ready )
status1 += 5;
if ( user1->BattleStatus().sync )
status1 += 7;
if ( user1->BattleStatus().spectator )
status1 += 10;
}
int status2 = 0;
if ( user1->BattleStatus().IsBot() )
{
status2 = 9;
}
else
{
try
{
if ( &battle->GetFounder() != user2 )
status2 = 1;
}catch(...){}
if ( user2->BattleStatus().ready )
status2 += 5;
if ( user2->BattleStatus().sync )
status2 += 7;
if ( user2->BattleStatus().spectator )
status2 += 10;
}
if ( status1 < status2 )
return -1;
if ( status1 > status2 )
return 1;
return 0;
}
示例8: CompareCpu
int BattleroomListCtrl::CompareCpu(const DataType user1, const DataType user2)
{
if ( !user1 && !user2 ) return 0;
else if ( !user1 ) return 1;
else if ( !user2 ) return -1;
if ( user1->BattleStatus().IsBot() )
{
wxString ailib1 = user1->BattleStatus().aishortname.Upper() + _T(" ") + user1->BattleStatus().aiversion.Upper();
if ( user2->BattleStatus().IsBot() )
{
wxString ailib2 = user2->BattleStatus().aishortname.Upper() + _T(" ") + user2->BattleStatus().aiversion.Upper();
if ( ailib1 < ailib2 )
return -1;
if ( ailib1 > ailib2 )
return 1;
return 0;
} else {
return 1;
}
}
else
{
int cpu1 = user1->GetCpu();
if ( user1->BattleStatus().IsBot() )
{
return -1;
} else {
int cpu2 = user2->GetCpu();
if ( cpu1 < cpu2 )
return -1;
if ( cpu1 > cpu2 )
return 1;
return 0;
}
}
}