Exemplo n.º 1
0
int BattleroomListCtrl::CompareLobbyStatus(const DataType user1, const DataType user2)
{
	int u1 = 0, u2 = 0;

	if (user1->GetStatus().bot)
		u1 += 1000;
	if (user2->GetStatus().bot)
		u2 += 1000;
	if (user1->GetStatus().moderator)
		u1 += 100;
	if (user2->GetStatus().moderator)
		u2 += 100;
	if (user1->GetStatus().in_game)
		u1 += -10;
	if (user2->GetStatus().in_game)
		u2 += -10;
	if (user1->GetStatus().away)
		u1 += -5;
	if (user2->GetStatus().away)
		u2 += -5;

	// inverse the order
	if (u1 < u2)
		return -1;
	if (u1 > u2)
		return 1;

	return 0;
}
Exemplo n.º 2
0
int NickListCtrl::CompareOneCrit(DataType u1, DataType u2, int col, int dir) const
{
	if (!(u1 && u2))
		return 0;
	switch (col) {
		case 0:
			return dir * CompareUserStatus(u1, u2);
		case 1:
			return dir * TowxString(u2->GetCountry()).CmpNoCase(TowxString(u1->GetCountry()));
		case 2:
			return dir * compareSimple(TowxString(u2->GetStatus().rank), TowxString(u1->GetStatus().rank));
		case 3:
			return dir * TowxString(u2->GetNick()).CmpNoCase(TowxString(u1->GetNick()));
		default:
			return 0;
	}
}
Exemplo n.º 3
0
int NickListCtrl::CompareUserStatus(DataType user1, DataType user2)
{

	ASSERT_LOGIC(user1 != 0, "user1 = 0");
	ASSERT_LOGIC(user2 != 0, "user2 = 0");

	int u1 = 0, u2 = 0;

	if (user1->GetStatus().bot)
		u1 += 1000;
	if (user2->GetStatus().bot)
		u2 += 1000;
	if (user1->GetStatus().moderator)
		u1 += 100;
	if (user2->GetStatus().moderator)
		u2 += 100;
	if (user1->GetStatus().in_game)
		u1 += -10;
	if (user2->GetStatus().in_game)
		u2 += -10;

	// inverse the order
	if (u1 < u2)
		return -1;
	if (u1 > u2)
		return 1;

	return 0;
}