diff options
| author | Choupom <andycootlapin@hotmail.fr> | 2010-09-03 21:28:31 +0200 |
|---|---|---|
| committer | oy <Tom_Adams@web.de> | 2010-09-05 14:11:56 +0200 |
| commit | 885d695f9292a44280d34efe1f294b43b23b789f (patch) | |
| tree | b578082c82a985168dc6b5b180938b6951fec46c /src/engine | |
| parent | 18632b7f5f8fc1e03746f482a15741e94e559b58 (diff) | |
| download | zcatch-885d695f9292a44280d34efe1f294b43b23b789f.tar.gz zcatch-885d695f9292a44280d34efe1f294b43b23b789f.zip | |
show map name without his folder in server info
Diffstat (limited to 'src/engine')
| -rw-r--r-- | src/engine/server/server.cpp | 24 | ||||
| -rw-r--r-- | src/engine/server/server.h | 1 |
2 files changed, 15 insertions, 10 deletions
diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 710b54e1..b0038a5c 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -564,16 +564,8 @@ int CServer::DelClientCallback(int ClientId, const char *pReason, void *pUser) void CServer::SendMap(int ClientId) { - //get the name of the map without his path - char * pMapShortName = &g_Config.m_SvMap[0]; - for(int i = 0; i < str_length(g_Config.m_SvMap)-1; i++) - { - if(g_Config.m_SvMap[i] == '/' || g_Config.m_SvMap[i] == '\\') - pMapShortName = &g_Config.m_SvMap[i+1]; - } - CMsgPacker Msg(NETMSG_MAP_CHANGE); - Msg.AddString(pMapShortName, 0); + Msg.AddString(GetMapName(), 0); Msg.AddInt(m_CurrentMapCrc); SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientId, true); } @@ -874,7 +866,7 @@ void CServer::SendServerInfo(NETADDR *pAddr, int Token) p.AddString(GameServer()->Version(), 32); p.AddString(g_Config.m_SvName, 64); - p.AddString(g_Config.m_SvMap, 32); + p.AddString(GetMapName(), 32); // gametype p.AddString(m_aBrowseinfoGametype, 16); @@ -967,6 +959,18 @@ void CServer::PumpNetwork() } } +char *CServer::GetMapName() +{ + // get the name of the map without his path + char *pMapShortName = &g_Config.m_SvMap[0]; + for(int i = 0; i < str_length(g_Config.m_SvMap)-1; i++) + { + if(g_Config.m_SvMap[i] == '/' || g_Config.m_SvMap[i] == '\\') + pMapShortName = &g_Config.m_SvMap[i+1]; + } + return pMapShortName; +} + int CServer::LoadMap(const char *pMapName) { //DATAFILE *df; diff --git a/src/engine/server/server.h b/src/engine/server/server.h index 756c1054..12333898 100644 --- a/src/engine/server/server.h +++ b/src/engine/server/server.h @@ -169,6 +169,7 @@ public: void PumpNetwork(); + char *GetMapName(); int LoadMap(const char *pMapName); void InitEngine(const char *pAppname); |