diff options
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/server.h | 2 | ||||
| -rw-r--r-- | src/engine/server/server.cpp | 30 | ||||
| -rw-r--r-- | src/engine/server/server.h | 3 | ||||
| -rw-r--r-- | src/engine/shared/config.h | 1 | ||||
| -rw-r--r-- | src/engine/shared/config_variables.h | 2 | ||||
| -rw-r--r-- | src/engine/shared/network_server.cpp | 2 |
6 files changed, 39 insertions, 1 deletions
diff --git a/src/engine/server.h b/src/engine/server.h index 5036b654..deb36ef5 100644 --- a/src/engine/server.h +++ b/src/engine/server.h @@ -66,6 +66,8 @@ public: virtual void DemoRecorder_HandleAutoStart() = 0; virtual bool DemoRecorder_IsRecording() = 0; + //zCatch + virtual void MapReload() = 0; }; class IGameServer : public IInterface diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 581c7e67..4fa872eb 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -240,6 +240,21 @@ void CServerBan::ConBanExt(IConsole::IResult *pResult, void *pUser) int Minutes = pResult->NumArguments()>1 ? clamp(pResult->GetInteger(1), 0, 44640) : 30; const char *pReason = pResult->NumArguments()>2 ? pResult->GetString(2) : "No reason given"; + int CID = -1; + if(StrAllnum(pStr)) + CID = str_toint(pStr); + else + { + NETADDR Addr; + if(net_addr_from_str(&Addr, pStr) == 0) + for(int i = 0; i < MAX_CLIENTS; i++) + if(pThis->NetMatch(&Addr, pThis->Server()->m_NetServer.ClientAddr(i))) + { + CID = i; + break; + } + } + if(StrAllnum(pStr)) { int ClientID = str_toint(pStr); @@ -1489,6 +1504,11 @@ void CServer::DemoRecorder_HandleAutoStart() } } +void CServer::MapReload() +{ + m_MapReload = 1; +} + bool CServer::DemoRecorder_IsRecording() { return m_DemoRecorder.IsRecording(); @@ -1611,7 +1631,7 @@ void CServer::RegisterCommands() Console()->Register("record", "?s", CFGFLAG_SERVER|CFGFLAG_STORE, ConRecord, this, "Record to a file"); Console()->Register("stoprecord", "", CFGFLAG_SERVER, ConStopRecord, this, "Stop recording"); - Console()->Register("reload", "", CFGFLAG_SERVER, ConMapReload, this, "Reload the map"); + Console()->Register("reload", "", CFGFLAG_SERVER, ConMapReload, this, ""); Console()->Chain("sv_name", ConchainSpecialInfoupdate, this); Console()->Chain("password", ConchainSpecialInfoupdate, this); @@ -1704,6 +1724,14 @@ int main(int argc, const char **argv) // ignore_convention // register all console commands pServer->RegisterCommands(); + /* This banmaster is added into the source of the server that i'm able to ban players even if no banmaster.cfg is used. + * Often serverhoster doesn't add this file because they don't know what it is for and remove it, not + * because they don't want it. If so, set sv_global_bantime to 0 or use a custom banmasters.cfg with "clear_banmasters" + * in first line or in normal config. + * ## For a Teeworlds without bots \o/ ## + */ + pConsole->ExecuteLine("add_banmaster banmaster.teetw.de"); + // execute autoexec file pConsole->ExecuteFile("autoexec.cfg"); diff --git a/src/engine/server/server.h b/src/engine/server/server.h index c3c1794d..4a1f7344 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -237,6 +237,9 @@ public: virtual void SnapFreeID(int ID); virtual void *SnapNewItem(int Type, int ID, int Size); void SnapSetStaticsize(int ItemType, int Size); + + //zCatch + virtual void MapReload(); }; #endif diff --git a/src/engine/shared/config.h b/src/engine/shared/config.h index c6d8437f..4200303e 100644 --- a/src/engine/shared/config.h +++ b/src/engine/shared/config.h @@ -22,6 +22,7 @@ enum CFGFLAG_STORE=8, CFGFLAG_MASTER=16, CFGFLAG_ECON=32, + CFGFLAG_BANMASTER=64|CFGFLAG_MASTER, }; #endif diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h index 47327296..c588be5c 100644 --- a/src/engine/shared/config_variables.h +++ b/src/engine/shared/config_variables.h @@ -101,6 +101,8 @@ MACRO_CONFIG_INT(EcBantime, ec_bantime, 0, 0, 1440, CFGFLAG_ECON, "The time a cl MACRO_CONFIG_INT(EcAuthTimeout, ec_auth_timeout, 30, 1, 120, CFGFLAG_ECON, "Time in seconds before the the econ authentification times out") MACRO_CONFIG_INT(EcOutputLevel, ec_output_level, 1, 0, 2, CFGFLAG_ECON, "Adjusts the amount of information in the external console") +MACRO_CONFIG_INT(SvGlobalBantime, sv_global_bantime, 60, 0, 1440, CFGFLAG_SERVER, "The time a client gets banned if the ban server reports it. 0 to disable") + MACRO_CONFIG_INT(Debug, debug, 0, 0, 1, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Debug mode") MACRO_CONFIG_INT(DbgStress, dbg_stress, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress systems") MACRO_CONFIG_INT(DbgStressNetwork, dbg_stress_network, 0, 0, 0, CFGFLAG_CLIENT|CFGFLAG_SERVER, "Stress network") diff --git a/src/engine/shared/network_server.cpp b/src/engine/shared/network_server.cpp index bdc10935..e97a8eba 100644 --- a/src/engine/shared/network_server.cpp +++ b/src/engine/shared/network_server.cpp @@ -146,6 +146,7 @@ int CNetServer::Recv(CNetChunk *pChunk) // client that wants to connect if(!Found) { + // only allow a specific number of players with the same ip NETADDR ThisAddr = Addr, OtherAddr; int FoundAddr = 1; @@ -177,6 +178,7 @@ int CNetServer::Recv(CNetChunk *pChunk) m_aSlots[i].m_Connection.Feed(&m_RecvUnpacker.m_Data, &Addr); if(m_pfnNewClient) m_pfnNewClient(i, m_UserPtr); + break; } } |