This commit is contained in:
GreYFoXGTi 2010-12-19 15:22:31 +02:00
commit 5e841fcfae
7 changed files with 96 additions and 2 deletions

View file

@ -1084,6 +1084,11 @@ void CClient::ProcessPacket(CNetChunk *pPacket)
if(Info.m_NumPlayers < 0 || Info.m_NumPlayers > MAX_CLIENTS || Info.m_MaxPlayers < 0 || Info.m_MaxPlayers > MAX_CLIENTS) if(Info.m_NumPlayers < 0 || Info.m_NumPlayers > MAX_CLIENTS || Info.m_MaxPlayers < 0 || Info.m_MaxPlayers > MAX_CLIENTS)
return; return;
if((Info.m_Flags | SERVER_FLAGS_VERSION) != SERVER_FLAG_VERSION || !str_find_nocase(Info.m_aGameType, "ddrace"))
Info.m_Flags &= SERVER_FLAGS_DEFAULT;
else
Info.m_Flags &= SERVER_FLAGS_ALL;
str_format(Info.m_aAddress, sizeof(Info.m_aAddress), "%d.%d.%d.%d:%d", 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], pPacket->m_Address.ip[0], pPacket->m_Address.ip[1], pPacket->m_Address.ip[2],
pPacket->m_Address.ip[3], pPacket->m_Address.port); pPacket->m_Address.ip[3], pPacket->m_Address.port);

View file

@ -83,6 +83,9 @@ public:
virtual void OnSetAuthed(int ClientId,int Level) = 0; virtual void OnSetAuthed(int ClientId,int Level) = 0;
virtual bool PlayerCollision() = 0;
virtual bool PlayerHooking() = 0;
virtual const char *Version() = 0; virtual const char *Version() = 0;
virtual const char *NetVersion() = 0; virtual const char *NetVersion() = 0;
}; };

View file

@ -967,10 +967,41 @@ void CServer::SendServerInfo(NETADDR *pAddr, int Token)
// flags // flags
int i = 0; int i = 0;
i |= SERVER_FLAG_VERSION;
if(g_Config.m_Password[0]) // password set if(g_Config.m_Password[0]) // password set
i |= SERVER_FLAG_PASSWORD; i |= SERVER_FLAG_PASSWORD;
if(g_Config.m_SvTeam)
i |= SERVER_FLAG_TEAMS;
if(g_Config.m_SvTeamStrict)
i |= SERVER_FLAG_STRICTTEAMS;
if(g_Config.m_SvCheats)
i |= SERVER_FLAG_CHEATS;
if(g_Config.m_SvPauseable)
i |= SERVER_FLAG_PAUSE;
if(g_Config.m_SvEndlessSuperHook)
i |= SERVER_FLAG_ENDLESSSUPERHOOKING;
if(g_Config.m_SvTimer)
i |= SERVER_FLAG_TIMERCOMMANDS;
if(g_Config.m_SvCheatTime)
i |= SERVER_FLAG_TIMECHEAT;
if(g_Config.m_SvPauseTime)
i |= SERVER_FLAG_PAUSETIME;
if(GameServer()->PlayerCollision())
i |= SERVER_FLAG_PLAYERCOLLISION;
if(GameServer()->PlayerHooking())
i |= SERVER_FLAG_PLAYERHOOKING;
if(g_Config.m_SvEndlessDrag)
i |= SERVER_FLAG_ENDLESSHOOKING;
if(g_Config.m_SvHit)
i |= SERVER_FLAG_HIT;
if(g_Config.m_SvMapTest)
i |= SERVER_FLAG_MAPTEST;
if(g_Config.m_SvServerTest)
i |= SERVER_FLAG_SERVERTEST;
str_format(aBuf, sizeof(aBuf), "%d", i); str_format(aBuf, sizeof(aBuf), "%d", i);
p.AddString(aBuf, 2); p.AddString(aBuf, 11);
// progression // progression
str_format(aBuf, sizeof(aBuf), "%d", m_BrowseinfoProgression); str_format(aBuf, sizeof(aBuf), "%d", m_BrowseinfoProgression);

View file

@ -102,6 +102,14 @@ MACRO_CONFIG_STR(SvRconPasswordHelper, sv_helper_pass, 32, "", CFGFLAG_SERVER, "
MACRO_CONFIG_INT(SvHit, sv_hit, 1, 0, 1, CFGFLAG_SERVER, "Whether players can hammer/grenade/laser eachother or not", 4) MACRO_CONFIG_INT(SvHit, sv_hit, 1, 0, 1, CFGFLAG_SERVER, "Whether players can hammer/grenade/laser eachother or not", 4)
MACRO_CONFIG_INT(SvEndlessDrag, sv_endless_drag, 0, 0, 1, CFGFLAG_SERVER, "Turns endless hooking on/off", 4) MACRO_CONFIG_INT(SvEndlessDrag, sv_endless_drag, 0, 0, 1, CFGFLAG_SERVER, "Turns endless hooking on/off", 4)
MACRO_CONFIG_INT(SvMapTest, sv_map_test, 0, 0, 1, CFGFLAG_SERVER, "Whether this server is just for map testing", 3)
#ifndef CONF_DEBUG
MACRO_CONFIG_INT(SvServerTest, sv_server_test, 0, 0, 0, CFGFLAG_SERVER, "Whether this server is for testing the mod (only available for debug compilation)", 4)
#else
MACRO_CONFIG_INT(SvServerTest, sv_server_test, 1, 0, 1, CFGFLAG_SERVER, "Whether this server is for testing the mod (only available for debug compilation)", 4)
#endif
MACRO_CONFIG_INT(SvCheats, sv_cheats, 0, 0, 1, CFGFLAG_SERVER, "Turns cheats on/off", 4) MACRO_CONFIG_INT(SvCheats, sv_cheats, 0, 0, 1, CFGFLAG_SERVER, "Turns cheats on/off", 4)
MACRO_CONFIG_INT(SvCheatTime, sv_cheattime, 0, 0, 1, CFGFLAG_SERVER, "Whether the time of players will be stopped on cheating or not", 4) MACRO_CONFIG_INT(SvCheatTime, sv_cheattime, 0, 0, 1, CFGFLAG_SERVER, "Whether the time of players will be stopped on cheating or not", 4)
MACRO_CONFIG_INT(SvEndlessSuperHook, sv_endless_super_hook, 0, 0, 1, CFGFLAG_SERVER, "Endless hook for super players on/off", 4) MACRO_CONFIG_INT(SvEndlessSuperHook, sv_endless_super_hook, 0, 0, 1, CFGFLAG_SERVER, "Endless hook for super players on/off", 4)

View file

@ -71,7 +71,37 @@ enum
enum enum
{ {
SERVER_TICK_SPEED=50, SERVER_TICK_SPEED=50,
SERVER_FLAG_PASSWORD = 0x1,
SERVER_FLAG_PASSWORD = 0x1, // A
SERVER_FLAG_TEAMS = 0x100, // B
SERVER_FLAG_STRICTTEAMS = 0x200, // C
SERVER_FLAG_CHEATS = 0x1000, // D
SERVER_FLAG_PAUSE = 0x2000, // E
SERVER_FLAG_ENDLESSSUPERHOOKING = 0x4000, // F
SERVER_FLAG_TIMERCOMMANDS = 0x10000, // G
SERVER_FLAG_TIMECHEAT = 0x20000, // H
SERVER_FLAG_PAUSETIME = 0x40000, // I
SERVER_FLAG_PLAYERCOLLISION = 0x100000, // K
SERVER_FLAG_PLAYERHOOKING = 0x200000, // L
SERVER_FLAG_ENDLESSHOOKING = 0x400000, // M
SERVER_FLAG_HIT = 0x800000, // N
SERVER_FLAG_MAPTEST = 0x1000000, // O
SERVER_FLAG_SERVERTEST = 0x2000000, // P
SERVER_FLAG_VERSION = 0x10000000,
SERVER_FLAGS_DEFAULT = 0x1,
SERVER_FLAGS_TEAMS = 0x30,
SERVER_FLAGS_CHEATS = 0x700,
SERVER_FLAGS_TIME = 0x7000,
SERVER_FLAGS_GAMEPLAY = 0xF0000,
SERVER_FLAGS_TESTING = 0x300000,
SERVER_FLAGS_VERSION = 0xF000000,
SERVER_FLAGS_ALL = 0xF3F7731,
// version | testing | gameplay | time | cheats | teams | unused | default
// 0001 | 00PO | NMLK | 0IHG | 0FED | 00CB | 0000 | 000A - 0 means unused, letter means used
MAX_CLIENTS=16, MAX_CLIENTS=16,

View file

@ -674,6 +674,20 @@ bool ComparePlayers(CPlayer *pl1, CPlayer *pl2)
return false; return false;
} }
bool CGameContext::PlayerCollision()
{
float Temp;
m_Tuning.Get("player_collision", &Temp);
return Temp != 0.0;
}
bool CGameContext::PlayerHooking()
{
float Temp;
m_Tuning.Get("player_hooking", &Temp);
return Temp != 0.0;
}
void CGameContext::OnSetAuthed(int client_id, int Level) void CGameContext::OnSetAuthed(int client_id, int Level)
{ {
if(m_apPlayers[client_id]) if(m_apPlayers[client_id])

View file

@ -276,6 +276,9 @@ public:
virtual void OnSetAuthed(int ClientId,int Level); virtual void OnSetAuthed(int ClientId,int Level);
virtual bool PlayerCollision();
virtual bool PlayerHooking();
virtual const char *Version(); virtual const char *Version();
virtual const char *NetVersion(); virtual const char *NetVersion();
}; };