about summary refs log tree commit diff
path: root/src/engine/server/server.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine/server/server.cpp')
-rw-r--r--src/engine/server/server.cpp17
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();