diff options
| author | Magnus Auvinen <magnus.auvinen@gmail.com> | 2010-07-05 20:46:32 +0200 |
|---|---|---|
| committer | Magnus Auvinen <magnus.auvinen@gmail.com> | 2010-07-05 20:46:32 +0200 |
| commit | d302ba921e61177da9af1f85df58fe6f47ca5e95 (patch) | |
| tree | 4ac19b9caab0a7142b6dfbc05d234af152bd5407 /src/engine/server/server.cpp | |
| parent | 143af11a25bc4a944c3605b9a165ffd2f1970641 (diff) | |
| parent | bd02c2043e9f76ec47ee9ac35caf23ae294b1dfa (diff) | |
| download | zcatch-d302ba921e61177da9af1f85df58fe6f47ca5e95.tar.gz zcatch-d302ba921e61177da9af1f85df58fe6f47ca5e95.zip | |
Merge branch 'master' of github.com:matricks/teeworlds
Diffstat (limited to 'src/engine/server/server.cpp')
| -rw-r--r-- | src/engine/server/server.cpp | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp index 620599c8..c45b2dd4 100644 --- a/src/engine/server/server.cpp +++ b/src/engine/server/server.cpp @@ -427,6 +427,7 @@ void CServer::DoSnapshot() { char aData[CSnapshot::MAX_SIZE]; + CSnapshot *pData = (CSnapshot*)aData; // Fix compiler warning for strict-aliasing char aDeltaData[CSnapshot::MAX_SIZE]; char aCompData[CSnapshot::MAX_SIZE]; int SnapshotSize; @@ -442,15 +443,15 @@ void CServer::DoSnapshot() GameServer()->OnSnap(i); // finish snapshot - SnapshotSize = m_SnapshotBuilder.Finish(aData); - Crc = ((CSnapshot*)aData)->Crc(); + SnapshotSize = m_SnapshotBuilder.Finish(pData); + Crc = pData->Crc(); // remove old snapshos // keep 3 seconds worth of snapshots m_aClients[i].m_Snapshots.PurgeUntil(m_CurrentGameTick-SERVER_TICK_SPEED*3); // save it the snapshot - m_aClients[i].m_Snapshots.Add(m_CurrentGameTick, time_get(), SnapshotSize, aData, 0); + m_aClients[i].m_Snapshots.Add(m_CurrentGameTick, time_get(), SnapshotSize, pData, 0); // find snapshot that we can preform delta against EmptySnap.Clear(); @@ -468,7 +469,7 @@ void CServer::DoSnapshot() } // create delta - DeltaSize = m_SnapshotDelta.CreateDelta(pDeltashot, (CSnapshot*)aData, aDeltaData); + DeltaSize = m_SnapshotDelta.CreateDelta(pDeltashot, pData, aDeltaData); if(DeltaSize) { @@ -554,9 +555,9 @@ 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 < 128; i++) + for(int i = 0; i < str_length(g_Config.m_SvMap)-1; i++) { - if(g_Config.m_SvMap[i] == '/' || g_Config.m_SvMap[i] == '\\' && i+1 < 128) + if(g_Config.m_SvMap[i] == '/' || g_Config.m_SvMap[i] == '\\') pMapShortName = &g_Config.m_SvMap[i+1]; } @@ -1066,7 +1067,7 @@ int CServer::Run() for(int c = 0; c < MAX_CLIENTS; c++) { - if(m_aClients[c].m_State == CClient::STATE_EMPTY) + if(m_aClients[c].m_State <= CClient::STATE_AUTH) continue; SendMap(c); @@ -1390,7 +1391,7 @@ int main(int argc, const char **argv) // ignore_convention // create the components IEngineMap *pEngineMap = CreateEngineMap(); IGameServer *pGameServer = CreateGameServer(); - IConsole *pConsole = CreateConsole(); + IConsole *pConsole = CreateConsole(CFGFLAG_SERVER); IEngineMasterServer *pEngineMasterServer = CreateEngineMasterServer(); IStorage *pStorage = CreateStorage("Teeworlds", argv[0]); // ignore_convention IConfig *pConfig = CreateConfig(); |