filter all "no-ddrace-flags server" when a flag is required or forbidden, strictly use the flag version, fixed flag version handling

This commit is contained in:
heinrich5991 2011-02-09 23:06:14 +01:00
parent 55c368b679
commit 88c0d6cfa8
4 changed files with 42 additions and 24 deletions

View file

@ -1085,10 +1085,16 @@ void CClient::ProcessPacket(CNetChunk *pPacket)
if(Info.m_NumPlayers < 0 || Info.m_NumPlayers > MAX_CLIENTS || Info.m_MaxPlayers < 0 || Info.m_MaxPlayers > MAX_CLIENTS)
return;
if((Info.m_Flags & SERVER_FLAG_VERSION) != SERVER_FLAG_VERSION || !str_find_nocase(Info.m_aGameType, "DDRace"))
if((Info.m_Flags & SERVER_FLAGS_VERSION) != SERVER_FLAG_VERSION || !str_find_nocase(Info.m_aGameType, "DDRace"))
{
Info.m_Flags &= SERVER_FLAGS_DEFAULT;
Info.m_FlagVersion = CServerInfo::FLAG_VERSION_VANILLA;
}
else
{
Info.m_Flags &= SERVER_FLAGS_ALL;
Info.m_FlagVersion = CServerInfo::FLAG_VERSION_DDRACE;
}
str_format(Info.m_aAddress, sizeof(Info.m_aAddress), "%d.%d.%d.%d:%d",
pPacket->m_Address.ip[0], pPacket->m_Address.ip[1], pPacket->m_Address.ip[2],

View file

@ -175,6 +175,11 @@ void CServerBrowser::Filter()
Filtered = 1;
else if(g_Config.m_BrFilterCompatversion && str_comp_num(m_ppServerlist[i]->m_Info.m_aVersion, m_aNetVersion, 3) != 0)
Filtered = 1;
else if((g_Config.m_BrFilterCheats || g_Config.m_BrFilterCheatTime || g_Config.m_BrFilterTeams || g_Config.m_BrFilterTeamsStrict ||
g_Config.m_BrFilterPause || g_Config.m_BrFilterPauseTime || g_Config.m_BrFilterPlayerCollision || g_Config.m_BrFilterPlayerHooking ||
g_Config.m_BrFilterPlayerHitting || g_Config.m_BrFilterEndlessHooking || g_Config.m_BrFilterTestMap || g_Config.m_BrFilterTestServer) &&
(m_ppServerlist[i]->m_Info.m_FlagVersion != CServerInfo::FLAG_VERSION_DDRACE))
Filtered = 1;
else if(g_Config.m_BrFilterCheats == 1 && m_ppServerlist[i]->m_Info.m_Flags&SERVER_FLAG_CHEATS)
Filtered = 1;
else if(g_Config.m_BrFilterCheats == 2 && !(m_ppServerlist[i]->m_Info.m_Flags&SERVER_FLAG_CHEATS))

View file

@ -21,6 +21,12 @@ public:
int m_Score;
} ;
enum
{
FLAG_VERSION_VANILLA=0,
FLAG_VERSION_DDRACE
};
int m_SortedIndex;
int m_ServerIndex;
@ -32,6 +38,7 @@ public:
int m_MaxPlayers;
int m_NumPlayers;
int m_Flags;
int m_FlagVersion;
int m_Favorite;
int m_Latency; // in ms
char m_aGameType[16];

View file

@ -73,33 +73,33 @@ enum
SERVER_TICK_SPEED=50,
//SERVER_FLAG_PASSWORD = 0x1,
SERVER_FLAG_PASSWORD = 0x1, // A
SERVER_FLAG_TEAMS1 = 0x10, // B
SERVER_FLAG_TEAMS2 = 0x20, // C
SERVER_FLAG_STRICTTEAMS = 0x40, // D
SERVER_FLAG_CHEATS = 0x100, // E
SERVER_FLAG_CHEATTIME = 0x200, // F
SERVER_FLAG_PAUSE = 0x400, // G
SERVER_FLAG_PAUSETIME = 0x800, // H
SERVER_FLAG_ENDLESSSUPERHOOKING = 0x1000, // I
SERVER_FLAG_TIMERCOMMANDS = 0x2000, // I
SERVER_FLAG_PLAYERCOLLISION = 0x10000, // K
SERVER_FLAG_PLAYERHOOKING = 0x20000, // L
SERVER_FLAG_ENDLESSHOOKING = 0x40000, // M
SERVER_FLAG_HIT = 0x80000, // N
SERVER_FLAG_MAPTEST = 0x100000, // O
SERVER_FLAG_SERVERTEST = 0x200000, // P
SERVER_FLAG_PASSWORD = 0x1, // A
SERVER_FLAG_TEAMS1 = 0x10, // B
SERVER_FLAG_TEAMS2 = 0x20, // C
SERVER_FLAG_STRICTTEAMS = 0x40, // D
SERVER_FLAG_CHEATS = 0x100, // E
SERVER_FLAG_CHEATTIME = 0x200, // F
SERVER_FLAG_PAUSE = 0x400, // G
SERVER_FLAG_PAUSETIME = 0x800, // H
SERVER_FLAG_ENDLESSSUPERHOOKING = 0x1000, // I
SERVER_FLAG_TIMERCOMMANDS = 0x2000, // I
SERVER_FLAG_PLAYERCOLLISION = 0x10000, // K
SERVER_FLAG_PLAYERHOOKING = 0x20000, // L
SERVER_FLAG_ENDLESSHOOKING = 0x40000, // M
SERVER_FLAG_HIT = 0x80000, // N
SERVER_FLAG_MAPTEST = 0x100000, // O
SERVER_FLAG_SERVERTEST = 0x200000, // P
SERVER_FLAG_VERSION = 0x10000000,
SERVER_FLAGS_DEFAULT = 0x1,
SERVER_FLAGS_TEAMS = 0x70,
SERVER_FLAGS_CHEATS = 0x3F00,
SERVER_FLAGS_GAMEPLAY = 0xF0000,
SERVER_FLAGS_TESTING = 0x300000,
SERVER_FLAGS_VERSION = 0xF000000,
SERVER_FLAGS_DEFAULT = 0x1,
SERVER_FLAGS_TEAMS = 0x70,
SERVER_FLAGS_CHEATS = 0x3F00,
SERVER_FLAGS_GAMEPLAY = 0xF0000,
SERVER_FLAGS_TESTING = 0x300000,
SERVER_FLAGS_VERSION = 0xF0000000,
SERVER_FLAGS_ALL = 0xF3F3F71,
SERVER_FLAGS_ALL = 0xF03F3F71,
MAX_CLIENTS=16,