about summary refs log tree commit diff
path: root/src/engine
diff options
context:
space:
mode:
Diffstat (limited to 'src/engine')
-rw-r--r--src/engine/client.h30
-rw-r--r--src/engine/client/client.cpp14
-rw-r--r--src/engine/client/friends.h8
-rw-r--r--src/engine/client/graphics.cpp140
-rw-r--r--src/engine/client/graphics.h26
-rw-r--r--src/engine/client/input.cpp2
-rw-r--r--src/engine/client/serverbrowser.cpp8
-rw-r--r--src/engine/client/serverbrowser.h2
-rw-r--r--src/engine/client/text.cpp160
-rw-r--r--src/engine/config.h4
-rw-r--r--src/engine/console.h12
-rw-r--r--src/engine/friends.h6
-rw-r--r--src/engine/graphics.h32
-rw-r--r--src/engine/input.h10
-rw-r--r--src/engine/kernel.h6
-rw-r--r--src/engine/server.h16
-rw-r--r--src/engine/server/register.cpp26
-rw-r--r--src/engine/server/server.cpp258
-rw-r--r--src/engine/server/server.h46
-rw-r--r--src/engine/serverbrowser.h16
-rw-r--r--src/engine/shared/compression.cpp24
-rw-r--r--src/engine/shared/config.cpp40
-rw-r--r--src/engine/shared/config.h12
-rw-r--r--src/engine/shared/config_variables.h2
-rw-r--r--src/engine/shared/console.cpp102
-rw-r--r--src/engine/shared/console.h22
-rw-r--r--src/engine/shared/datafile.cpp114
-rw-r--r--src/engine/shared/datafile.h14
-rw-r--r--src/engine/shared/demo.cpp156
-rw-r--r--src/engine/shared/demo.h30
-rw-r--r--src/engine/shared/engine.cpp6
-rw-r--r--src/engine/shared/huffman.cpp14
-rw-r--r--src/engine/shared/huffman.h8
-rw-r--r--src/engine/shared/jobs.cpp14
-rw-r--r--src/engine/shared/jobs.h16
-rw-r--r--src/engine/shared/kernel.cpp20
-rw-r--r--src/engine/shared/map.cpp8
-rw-r--r--src/engine/shared/mapchecker.cpp2
-rw-r--r--src/engine/shared/mapchecker.h2
-rw-r--r--src/engine/shared/masterserver.cpp30
-rw-r--r--src/engine/shared/memheap.cpp14
-rw-r--r--src/engine/shared/memheap.h10
-rw-r--r--src/engine/shared/network.cpp26
-rw-r--r--src/engine/shared/network.h78
-rw-r--r--src/engine/shared/network_client.cpp8
-rw-r--r--src/engine/shared/network_conn.cpp50
-rw-r--r--src/engine/shared/network_server.cpp82
-rw-r--r--src/engine/shared/packer.cpp20
-rw-r--r--src/engine/shared/packer.h2
-rw-r--r--src/engine/shared/protocol.h18
-rw-r--r--src/engine/shared/ringbuffer.cpp44
-rw-r--r--src/engine/shared/ringbuffer.h16
-rw-r--r--src/engine/shared/snapshot.cpp124
-rw-r--r--src/engine/shared/snapshot.h14
-rw-r--r--src/engine/shared/storage.cpp34
-rw-r--r--src/engine/storage.h2
-rw-r--r--src/engine/textrender.h10
57 files changed, 1005 insertions, 1005 deletions
diff --git a/src/engine/client.h b/src/engine/client.h
index 870c355d..78741018 100644
--- a/src/engine/client.h
+++ b/src/engine/client.h
@@ -18,13 +18,13 @@ protected:
 	int m_CurGameTick;
 	float m_GameIntraTick;
 	float m_GameTickTime;
-	
+
 	int m_PredTick;
 	float m_PredIntraTick;
-	
+
 	float m_LocalTime;
 	float m_FrameTime;
-	
+
 	int m_GameTickSpeed;
 public:
 
@@ -66,11 +66,11 @@ public:
 	inline float PredIntraGameTick() const { return m_PredIntraTick; }
 	inline float GameTickTime() const { return m_GameTickTime; }
 	inline int GameTickSpeed() const { return m_GameTickSpeed; }
-	
+
 	// other time access
 	inline float FrameTime() const { return m_FrameTime; }
 	inline float LocalTime() const { return m_LocalTime; }
-	
+
 	// actions
 	virtual void Connect(const char *pAddress) = 0;
 	virtual void Disconnect() = 0;
@@ -88,26 +88,26 @@ public:
 	//
 	virtual int MapDownloadAmount() = 0;
 	virtual int MapDownloadTotalsize() = 0;
-	
+
 	// input
 	virtual int *GetInput(int Tick) = 0;
-	
+
 	// remote console
 	virtual void RconAuth(const char *pUsername, const char *pPassword) = 0;
 	virtual bool RconAuthed() = 0;
 	virtual void Rcon(const char *pLine) = 0;
-	
+
 	// server info
 	virtual void GetServerInfo(class CServerInfo *pServerInfo) = 0;
-	
+
 	// snapshot interface
-	
+
 	enum
 	{
 		SNAP_CURRENT=0,
 		SNAP_PREV=1
 	};
-		
+
 	// TODO: Refactor: should redo this a bit i think, too many virtual calls
 	virtual int SnapNumItems(int SnapID) = 0;
 	virtual void *SnapFindItem(int SnapID, int Type, int ID) = 0;
@@ -126,8 +126,8 @@ public:
 			return -1;
 		return SendMsg(&Packer, Flags);
 	}
-	
-	// 
+
+	//
 	virtual const char *ErrorString() = 0;
 	virtual const char *LatestVersion() = 0;
 	virtual bool ConnectionProblems() = 0;
@@ -155,9 +155,9 @@ public:
 	virtual void OnMessage(int MsgID, CUnpacker *pUnpacker) = 0;
 	virtual void OnPredict() = 0;
 	virtual void OnActivateEditor() = 0;
-	
+
 	virtual int OnSnapInput(int *pData) = 0;
-	
+
 	virtual const char *GetItemName(int Type) = 0;
 	virtual int GetCountryIndex(int Code) = 0;
 	virtual const char *Version() = 0;
diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp
index 5cce547e..61a96eee 100644
--- a/src/engine/client/client.cpp
+++ b/src/engine/client/client.cpp
@@ -545,7 +545,7 @@ void CClient::RconAuth(const char *pName, const char *pPassword)
 {
 	if(RconAuthed())
 		return;
-        
+
 	CMsgPacker Msg(NETMSG_RCON_AUTH);
 	Msg.AddString(pName, 32);
 	Msg.AddString(pPassword, 32);
@@ -860,7 +860,7 @@ void CClient::DebugRender()
 		total = 42
 	*/
 	FrameTimeAvg = FrameTimeAvg*0.9f + m_FrameTime*0.1f;
-	str_format(aBuffer, sizeof(aBuffer), "ticks: %8d %8d mem %dk %d  gfxmem: %dk  fps: %3d",
+	str_format(aBuffer, sizeof(aBuffer), "ticks: %8d %8d mem %dk %d gfxmem: %dk fps: %3d",
 		m_CurGameTick, m_PredTick,
 		mem_stats()->allocated/1024,
 		mem_stats()->total_allocations,
@@ -1030,7 +1030,7 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket)
 		// version info
 		if(pPacket->m_DataSize == (int)(sizeof(VERSIONSRV_VERSION) + sizeof(VERSION_DATA)) &&
 			mem_comp(pPacket->m_pData, VERSIONSRV_VERSION, sizeof(VERSIONSRV_VERSION)) == 0)
-		
+
 		{
 			unsigned char *pVersionData = (unsigned char*)pPacket->m_pData + sizeof(VERSIONSRV_VERSION);
 			int VersionMatch = !mem_comp(pVersionData, VERSION_DATA, sizeof(VERSION_DATA));
@@ -1060,7 +1060,7 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket)
 
 		// map version list
 		if(pPacket->m_DataSize >= (int)sizeof(VERSIONSRV_MAPLIST) &&
-			mem_comp(pPacket->m_pData, VERSIONSRV_MAPLIST, sizeof(VERSIONSRV_MAPLIST)) == 0)		
+			mem_comp(pPacket->m_pData, VERSIONSRV_MAPLIST, sizeof(VERSIONSRV_MAPLIST)) == 0)
 		{
 			int Size = pPacket->m_DataSize-sizeof(VERSIONSRV_MAPLIST);
 			int Num = Size/sizeof(CMapVersion);
@@ -1114,7 +1114,7 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket)
 				mem_copy(Addr.ip, pAddrs[i].m_aIp, sizeof(Addr.ip));
 			}
 			Addr.port = (pAddrs[i].m_aPort[0]<<8) | pAddrs[i].m_aPort[1];
-			
+
 			m_ServerBrowser.Set(Addr, IServerBrowser::SET_MASTER_ADD, -1, 0x0);
 		}
 	}
@@ -1125,7 +1125,7 @@ void CClient::ProcessConnlessPacket(CNetChunk *pPacket)
 		// we got ze info
 		CUnpacker Up;
 		CServerInfo Info = {0};
-				
+
 		Up.Reset((unsigned char*)pPacket->m_pData+sizeof(SERVERBROWSE_INFO), pPacket->m_DataSize-sizeof(SERVERBROWSE_INFO));
 		int Token = str_toint(Up.GetString());
 		str_copy(Info.m_aVersion, Up.GetString(CUnpacker::SANITIZE_CC|CUnpacker::SKIP_START_WHITESPACES), sizeof(Info.m_aVersion));
@@ -1282,7 +1282,7 @@ void CClient::ProcessServerPacket(CNetChunk *pPacket)
 				if(!pError)
 				{
 					m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "client/network", "loading done");
-					SendReady();						
+					SendReady();
 				}
 				else
 					DisconnectWithReason(pError);
diff --git a/src/engine/client/friends.h b/src/engine/client/friends.h
index e3258ec2..be0cfa49 100644
--- a/src/engine/client/friends.h
+++ b/src/engine/client/friends.h
@@ -14,14 +14,14 @@ class CFriends : public IFriends
 	static void ConRemoveFriend(IConsole::IResult *pResult, void *pUserData);
 
 	static void ConfigSaveCallback(IConfig *pConfig, void *pUserData);
-	
+
 public:
 	CFriends();
-	
+
 	void Init();
-	
+
 	int NumFriends() const { return m_NumFriends; }
-	const CFriendInfo *GetFriend(int Index) const; 
+	const CFriendInfo *GetFriend(int Index) const;
 	bool IsFriend(const char *pName, const char *pClan, bool PlayersOnly) const;
 
 	void AddFriend(const char *pName, const char *pClan);
diff --git a/src/engine/client/graphics.cpp b/src/engine/client/graphics.cpp
index 99f5e095..641f9dfb 100644
--- a/src/engine/client/graphics.cpp
+++ b/src/engine/client/graphics.cpp
@@ -50,7 +50,7 @@ static CVideoMode g_aFakeModes[] = {
 	{1800,1440,8,8,8}, {1856,1392,8,8,8}, {1920,1080,8,8,8},
 	{1920,1200,8,8,8}, {1920,1440,8,8,8}, {1920,2400,8,8,8},
 	{2048,1536,8,8,8},
-		
+
 	{320,240,5,6,5}, {400,300,5,6,5}, {640,480,5,6,5},
 	{720,400,5,6,5}, {768,576,5,6,5}, {800,600,5,6,5},
 	{1024,600,5,6,5}, {1024,768,5,6,5}, {1152,864,5,6,5},
@@ -67,7 +67,7 @@ void CGraphics_OpenGL::Flush()
 {
 	if(m_NumVertices == 0)
 		return;
-		
+
 	//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
 	//glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 
@@ -83,7 +83,7 @@ void CGraphics_OpenGL::Flush()
 	glEnableClientState(GL_VERTEX_ARRAY);
 	glEnableClientState(GL_TEXTURE_COORD_ARRAY);
 	glEnableClientState(GL_COLOR_ARRAY);
-	
+
 	if(m_RenderEnable)
 	{
 		if(m_Drawing == DRAWING_QUADS)
@@ -91,7 +91,7 @@ void CGraphics_OpenGL::Flush()
 		else if(m_Drawing == DRAWING_LINES)
 			glDrawArrays(GL_LINES, 0, m_NumVertices);
 	}
-	
+
 	// Reset pointer
 	m_NumVertices = 0;
 }
@@ -125,26 +125,26 @@ unsigned char CGraphics_OpenGL::Sample(int w, int h, const unsigned char *pData,
 	pData[(v*w+u+1)*4+Offset]+
 	pData[((v+1)*w+u)*4+Offset]+
 	pData[((v+1)*w+u+1)*4+Offset])/4;
-}	
+}
 
 CGraphics_OpenGL::CGraphics_OpenGL()
 {
 	m_NumVertices = 0;
-	
+
 	m_ScreenX0 = 0;
 	m_ScreenY0 = 0;
 	m_ScreenX1 = 0;
 	m_ScreenY1 = 0;
-	
+
 	m_ScreenWidth = -1;
 	m_ScreenHeight = -1;
-	
+
 	m_Rotation = 0;
 	m_Drawing = 0;
 	m_InvalidTexture = 0;
-	
+
 	m_TextureMemoryUsage = 0;
-	
+
 	m_RenderEnable = true;
 	m_DoScreenshot = false;
 }
@@ -161,7 +161,7 @@ void CGraphics_OpenGL::ClipDisable()
 	//if(no_gfx) return;
 	glDisable(GL_SCISSOR_TEST);
 }
-	
+
 void CGraphics_OpenGL::BlendNone()
 {
 	glDisable(GL_BLEND);
@@ -180,10 +180,10 @@ void CGraphics_OpenGL::BlendAdditive()
 }
 
 int CGraphics_OpenGL::MemoryUsage() const
-{ 
+{
 	return m_TextureMemoryUsage;
-}	
-	
+}
+
 void CGraphics_OpenGL::MapScreen(float TopLeftX, float TopLeftY, float BottomRightX, float BottomRightY)
 {
 	m_ScreenX0 = TopLeftX;
@@ -220,7 +220,7 @@ void CGraphics_OpenGL::LinesEnd()
 void CGraphics_OpenGL::LinesDraw(const CLineItem *pArray, int Num)
 {
 	dbg_assert(m_Drawing == DRAWING_LINES, "called draw without begin");
-	
+
 	for(int i = 0; i < Num; ++i)
 	{
 		m_aVertices[m_NumVertices + 2*i].m_Pos.x = pArray[i].m_X0;
@@ -241,10 +241,10 @@ int CGraphics_OpenGL::UnloadTexture(int Index)
 {
 	if(Index == m_InvalidTexture)
 		return 0;
-		
+
 	if(Index < 0)
 		return 0;
-		
+
 	glDeleteTextures(1, &m_aTextures[Index].m_Tex);
 	m_aTextures[Index].m_Next = m_FirstFreeTexture;
 	m_TextureMemoryUsage -= m_aTextures[Index].m_MemSize;
@@ -261,16 +261,16 @@ int CGraphics_OpenGL::LoadTextureRaw(int Width, int Height, int Format, const vo
 	int Oglformat = 0;
 	int StoreOglformat = 0;
 	int Tex = 0;
-	
+
 	// don't waste memory on texture if we are stress testing
 	if(g_Config.m_DbgStress)
 		return 	m_InvalidTexture;
-	
+
 	// grab texture
 	Tex = m_FirstFreeTexture;
 	m_FirstFreeTexture = m_aTextures[Tex].m_Next;
 	m_aTextures[Tex].m_Next = -1;
-	
+
 	// resample if needed
 	if(!(Flags&TEXLOAD_NORESAMPLE) && g_Config.m_GfxTextureQuality==0)
 	{
@@ -296,13 +296,13 @@ int CGraphics_OpenGL::LoadTextureRaw(int Width, int Height, int Format, const vo
 			pTexData = pTmpData;
 		}
 	}
-	
+
 	Oglformat = GL_RGBA;
 	if(Format == CImageInfo::FORMAT_RGB)
 		Oglformat = GL_RGB;
 	else if(Format == CImageInfo::FORMAT_ALPHA)
 		Oglformat = GL_ALPHA;
-	
+
 	// upload texture
 	if(g_Config.m_GfxTextureCompression)
 	{
@@ -320,13 +320,13 @@ int CGraphics_OpenGL::LoadTextureRaw(int Width, int Height, int Format, const vo
 		else if(StoreFormat == CImageInfo::FORMAT_ALPHA)
 			StoreOglformat = GL_ALPHA;
 	}
-		
+
 	glGenTextures(1, &m_aTextures[Tex].m_Tex);
 	glBindTexture(GL_TEXTURE_2D, m_aTextures[Tex].m_Tex);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_NEAREST);
 	gluBuild2DMipmaps(GL_TEXTURE_2D, StoreOglformat, Width, Height, Oglformat, GL_UNSIGNED_BYTE, pTexData);
-	
+
 	// calculate memory usage
 	{
 		int PixelSize = 4;
@@ -346,7 +346,7 @@ int CGraphics_OpenGL::LoadTextureRaw(int Width, int Height, int Format, const vo
 			}
 		}
 	}
-	
+
 	m_TextureMemoryUsage += m_aTextures[Tex].m_MemSize;
 	mem_free(pTmpData);
 	return Tex;
@@ -358,7 +358,7 @@ int CGraphics_OpenGL::LoadTexture(const char *pFilename, int StorageType, int St
 	int l = str_length(pFilename);
 	int ID;
 	CImageInfo Img;
-	
+
 	if(l < 3)
 		return -1;
 	if(LoadPNG(&Img, pFilename, StorageType))
@@ -370,7 +370,7 @@ int CGraphics_OpenGL::LoadTexture(const char *pFilename, int StorageType, int St
 		mem_free(Img.m_pData);
 		return ID;
 	}
-	
+
 	return m_InvalidTexture;
 }
 
@@ -379,7 +379,7 @@ int CGraphics_OpenGL::LoadPNG(CImageInfo *pImg, const char *pFilename, int Stora
 	char aCompleteFilename[512];
 	unsigned char *pBuffer;
 	png_t Png; // ignore_convention
-	
+
 	// open file for reading
 	png_init(0,0); // ignore_convention
 
@@ -391,7 +391,7 @@ int CGraphics_OpenGL::LoadPNG(CImageInfo *pImg, const char *pFilename, int Stora
 		dbg_msg("game/png", "failed to open file. filename='%s'", pFilename);
 		return 0;
 	}
-	
+
 	int Error = png_open_file(&Png, aCompleteFilename); // ignore_convention
 	if(Error != PNG_NO_ERROR)
 	{
@@ -400,18 +400,18 @@ int CGraphics_OpenGL::LoadPNG(CImageInfo *pImg, const char *pFilename, int Stora
 			png_close_file(&Png); // ignore_convention
 		return 0;
 	}
-	
+
 	if(Png.depth != 8 || (Png.color_type != PNG_TRUECOLOR && Png.color_type != PNG_TRUECOLOR_ALPHA)) // ignore_convention
 	{
 		dbg_msg("game/png", "invalid format. filename='%s'", aCompleteFilename);
 		png_close_file(&Png); // ignore_convention
 		return 0;
 	}
-		
+
 	pBuffer = (unsigned char *)mem_alloc(Png.width * Png.height * Png.bpp, 1); // ignore_convention
 	png_get_data(&Png, pBuffer); // ignore_convention
 	png_close_file(&Png); // ignore_convention
-	
+
 	pImg->m_Width = Png.width; // ignore_convention
 	pImg->m_Height = Png.height; // ignore_convention
 	if(Png.color_type == PNG_TRUECOLOR) // ignore_convention
@@ -435,7 +435,7 @@ void CGraphics_OpenGL::ScreenshotDirect(const char *pFilename)
 	glPixelStorei(GL_PACK_ALIGNMENT, 1);
 	glReadPixels(0,0, w, h, GL_RGB, GL_UNSIGNED_BYTE, pPixelData);
 	glPixelStorei(GL_PACK_ALIGNMENT, Alignment);
-	
+
 	// flip the pixel because opengl works from bottom left corner
 	for(y = 0; y < h/2; y++)
 	{
@@ -443,16 +443,16 @@ void CGraphics_OpenGL::ScreenshotDirect(const char *pFilename)
 		mem_copy(pPixelData+y*w*3, pPixelData+(h-y-1)*w*3, w*3);
 		mem_copy(pPixelData+(h-y-1)*w*3, pTempRow,w*3);
 	}
-	
+
 	// find filename
 	{
 		char aWholePath[1024];
 		png_t Png; // ignore_convention
 
-		IOHANDLE File  = m_pStorage->OpenFile(pFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE, aWholePath, sizeof(aWholePath));
+		IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE, aWholePath, sizeof(aWholePath));
 		if(File)
 			io_close(File);
-	
+
 		// save png
 		char aBuf[256];
 		str_format(aBuf, sizeof(aBuf), "saved screenshot to '%s'", aWholePath);
@@ -490,7 +490,7 @@ void CGraphics_OpenGL::QuadsBegin()
 {
 	dbg_assert(m_Drawing == 0, "called quads_begin twice");
 	m_Drawing = DRAWING_QUADS;
-	
+
 	QuadsSetSubset(0,0,1,1);
 	QuadsSetRotation(0);
 	SetColor(1,1,1,1);
@@ -609,7 +609,7 @@ void CGraphics_OpenGL::QuadsDrawTL(const CQuadItem *pArray, int Num)
 void CGraphics_OpenGL::QuadsDrawFreeform(const CFreeformItem *pArray, int Num)
 {
 	dbg_assert(m_Drawing == DRAWING_QUADS, "called quads_draw_freeform without begin");
-	
+
 	for(int i = 0; i < Num; ++i)
 	{
 		m_aVertices[m_NumVertices + 4*i].m_Pos.x = pArray[i].m_X0;
@@ -632,7 +632,7 @@ void CGraphics_OpenGL::QuadsDrawFreeform(const CFreeformItem *pArray, int Num)
 		m_aVertices[m_NumVertices + 4*i + 3].m_Tex = m_aTexture[2];
 		m_aVertices[m_NumVertices + 4*i + 3].m_Color = m_aColor[2];
 	}
-	
+
 	AddVertices(4*Num);
 }
 
@@ -647,7 +647,7 @@ void CGraphics_OpenGL::QuadsText(float x, float y, float Size, float r, float g,
 	{
 		char c = *pText;
 		pText++;
-		
+
 		if(c == '\n')
 		{
 			x = StartX;
@@ -660,13 +660,13 @@ void CGraphics_OpenGL::QuadsText(float x, float y, float Size, float r, float g,
 				(c/16)/16.0f,
 				(c%16)/16.0f+1.0f/16.0f,
 				(c/16)/16.0f+1.0f/16.0f);
-			
+
 			CQuadItem QuadItem(x, y, Size, Size);
 			QuadsDrawTL(&QuadItem, 1);
 			x += Size/2;
 		}
 	}
-	
+
 	QuadsEnd();
 }
 
@@ -674,7 +674,7 @@ bool CGraphics_OpenGL::Init()
 {
 	m_pStorage = Kernel()->RequestInterface<IStorage>();
 	m_pConsole = Kernel()->RequestInterface<IConsole>();
-	
+
 	// Set all z to -5.0f
 	for(int i = 0; i < MAX_VERTICES; i++)
 		m_aVertices[i].m_Pos.z = -5.0f;
@@ -691,21 +691,21 @@ bool CGraphics_OpenGL::Init()
 	glDisable(GL_DEPTH_TEST);
 	glMatrixMode(GL_MODELVIEW);
 	glLoadIdentity();
-	
+
 	glAlphaFunc(GL_GREATER, 0);
 	glEnable(GL_ALPHA_TEST);
 	glDepthMask(0);
 
 	// create null texture, will get id=0
 	static const unsigned char aNullTextureData[] = {
-		0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff, 
-		0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff, 
-		0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff, 
-		0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff, 
+		0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff,
+		0xff,0x00,0x00,0xff, 0xff,0x00,0x00,0xff, 0x00,0xff,0x00,0xff, 0x00,0xff,0x00,0xff,
+		0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff,
+		0x00,0x00,0xff,0xff, 0x00,0x00,0xff,0xff, 0xff,0xff,0x00,0xff, 0xff,0xff,0x00,0xff,
 	};
-	
+
 	m_InvalidTexture = LoadTextureRaw(4,4,CImageInfo::FORMAT_RGBA,aNullTextureData,CImageInfo::FORMAT_RGBA,TEXLOAD_NORESAMPLE);
-	
+
 	return true;
 }
 
@@ -713,7 +713,7 @@ int CGraphics_SDL::TryInit()
 {
 	const SDL_VideoInfo *pInfo;
 	int Flags = SDL_OPENGL;
-	
+
 	m_ScreenWidth = g_Config.m_GfxScreenWidth;
 	m_ScreenHeight = g_Config.m_GfxScreenHeight;
 
@@ -721,7 +721,7 @@ int CGraphics_SDL::TryInit()
 	SDL_EventState(SDL_MOUSEMOTION, SDL_IGNORE);
 
 	// set flags
-	Flags  = SDL_OPENGL;
+	Flags = SDL_OPENGL;
 	Flags |= SDL_GL_DOUBLEBUFFER;
 	Flags |= SDL_HWPALETTE;
 	if(g_Config.m_DbgResizable)
@@ -755,7 +755,7 @@ int CGraphics_SDL::TryInit()
 
 	// set caption
 	SDL_WM_SetCaption("Teeworlds", "Teeworlds");
-	
+
 	// create window
 	m_pScreenSurface = SDL_SetVideoMode(m_ScreenWidth, m_ScreenHeight, 0, Flags);
 	if(m_pScreenSurface == NULL)
@@ -763,7 +763,7 @@ int CGraphics_SDL::TryInit()
 		dbg_msg("gfx", "unable to set video mode: %s", SDL_GetError());
 		return -1;
 	}
-	
+
 	return 0;
 }
 
@@ -772,12 +772,12 @@ int CGraphics_SDL::InitWindow()
 {
 	if(TryInit() == 0)
 		return 0;
-	
+
 	// try disabling fsaa
 	while(g_Config.m_GfxFsaaSamples)
 	{
 		g_Config.m_GfxFsaaSamples--;
-		
+
 		if(g_Config.m_GfxFsaaSamples)
 			dbg_msg("gfx", "lowering FSAA to %d and trying again", g_Config.m_GfxFsaaSamples);
 		else
@@ -799,8 +799,8 @@ int CGraphics_SDL::InitWindow()
 	}
 
 	dbg_msg("gfx", "out of ideas. failed to init graphics");
-					
-	return -1;		
+
+	return -1;
 }
 
 
@@ -813,34 +813,34 @@ bool CGraphics_SDL::Init()
 {
 	{
 		int Systems = SDL_INIT_VIDEO;
-		
+
 		if(g_Config.m_SndEnable)
 			Systems |= SDL_INIT_AUDIO;
 
 		if(g_Config.m_ClEventthread)
 			Systems |= SDL_INIT_EVENTTHREAD;
-		
+
 		if(SDL_Init(Systems) < 0)
 		{
 			dbg_msg("gfx", "unable to init SDL: %s", SDL_GetError());
 			return true;
 		}
 	}
-	
+
 	atexit(SDL_Quit); // ignore_convention
 
 	#ifdef CONF_FAMILY_WINDOWS
 		if(!getenv("SDL_VIDEO_WINDOW_POS") && !getenv("SDL_VIDEO_CENTERED")) // ignore_convention
 			putenv("SDL_VIDEO_WINDOW_POS=8,27"); // ignore_convention
 	#endif
-	
+
 	if(InitWindow() != 0)
 		return true;
 
 	SDL_ShowCursor(0);
-		
+
 	CGraphics_OpenGL::Init();
-	
+
 	MapScreen(0,0,g_Config.m_GfxScreenWidth, g_Config.m_GfxScreenHeight);
 	return false;
 }
@@ -887,11 +887,11 @@ void CGraphics_SDL::Swap()
 		ScreenshotDirect(m_aScreenshotName);
 		m_DoScreenshot = false;
 	}
-	
+
 	SDL_GL_SwapBuffers();
-	
+
 	if(g_Config.m_GfxFinish)
-		glFinish();		
+		glFinish();
 }
 
 
@@ -908,9 +908,9 @@ int CGraphics_SDL::GetVideoModes(CVideoMode *pModes, int MaxModes)
 			Count = MaxModes;
 		return Count;
 	}
-	
+
 	// TODO: fix this code on osx or windows
-		
+
 	ppModes = SDL_ListModes(NULL, SDL_OPENGL|SDL_GL_DOUBLEBUFFER|SDL_FULLSCREEN);
 	if(ppModes == NULL)
 	{
@@ -936,7 +936,7 @@ int CGraphics_SDL::GetVideoModes(CVideoMode *pModes, int MaxModes)
 			NumModes++;
 		}
 	}
-	
+
 	return NumModes;
 }
 
diff --git a/src/engine/client/graphics.h b/src/engine/client/graphics.h
index 20be3504..4367ccfc 100644
--- a/src/engine/client/graphics.h
+++ b/src/engine/client/graphics.h
@@ -8,7 +8,7 @@ class CGraphics_OpenGL : public IEngineGraphics
 protected:
 	class IStorage *m_pStorage;
 	class IConsole *m_pConsole;
-	
+
 	//
 	typedef struct { float x, y, z; } CPoint;
 	typedef struct { float u, v; } CTexCoord;
@@ -20,14 +20,14 @@ protected:
 		CTexCoord m_Tex;
 		CColor m_Color;
 	} CVertex;
-	
+
 	enum
 	{
 		MAX_VERTICES = 32*1024,
 		MAX_TEXTURES = 1024*4,
-		
+
 		DRAWING_QUADS=1,
-		DRAWING_LINES=2		
+		DRAWING_LINES=2
 	};
 
 	CVertex m_aVertices[MAX_VERTICES];
@@ -65,27 +65,27 @@ protected:
 	void Flush();
 	void AddVertices(int Count);
 	void Rotate4(const CPoint &rCenter, CVertex *pPoints);
-	
+
 	static unsigned char Sample(int w, int h, const unsigned char *pData, int u, int v, int Offset);
 public:
 	CGraphics_OpenGL();
-	
+
 	virtual void ClipEnable(int x, int y, int w, int h);
 	virtual void ClipDisable();
-		
+
 	virtual void BlendNone();
 	virtual void BlendNormal();
 	virtual void BlendAdditive();
 
 	virtual int MemoryUsage() const;
-		
+
 	virtual void MapScreen(float TopLeftX, float TopLeftY, float BottomRightX, float BottomRightY);
 	virtual void GetScreen(float *pTopLeftX, float *pTopLeftY, float *pBottomRightX, float *pBottomRightY);
 
 	virtual void LinesBegin();
 	virtual void LinesEnd();
 	virtual void LinesDraw(const CLineItem *pArray, int Num);
-	
+
 	virtual int UnloadTexture(int Index);
 	virtual int LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags);
 
@@ -115,14 +115,14 @@ public:
 	virtual void QuadsDrawTL(const CQuadItem *pArray, int Num);
 	virtual void QuadsDrawFreeform(const CFreeformItem *pArray, int Num);
 	virtual void QuadsText(float x, float y, float Size, float r, float g, float b, float a, const char *pText);
-	
+
 	virtual bool Init();
 };
 
 class CGraphics_SDL : public CGraphics_OpenGL
 {
-	SDL_Surface *m_pScreenSurface;	
-	
+	SDL_Surface *m_pScreenSurface;
+
 	int TryInit();
 	int InitWindow();
 public:
@@ -141,7 +141,7 @@ public:
 	virtual void Swap();
 
 	virtual int GetVideoModes(CVideoMode *pModes, int MaxModes);
-	
+
 };
 
 #endif
diff --git a/src/engine/client/input.cpp b/src/engine/client/input.cpp
index 5cd58342..0b4a44a4 100644
--- a/src/engine/client/input.cpp
+++ b/src/engine/client/input.cpp
@@ -154,7 +154,7 @@ int CInput::Update()
 					// skip private use area of the BMP(contains the unicodes for keyboard function keys on MacOS)
 					if(Event.key.keysym.unicode < 0xE000 || Event.key.keysym.unicode > 0xF8FF)	// ignore_convention
 						AddEvent(Event.key.keysym.unicode, 0, 0); // ignore_convention
-                    Key = Event.key.keysym.sym;  // ignore_convention
+					Key = Event.key.keysym.sym; // ignore_convention
 					break;
 				case SDL_KEYUP:
 					Action = IInput::FLAG_RELEASE;
diff --git a/src/engine/client/serverbrowser.cpp b/src/engine/client/serverbrowser.cpp
index 436c8c15..64d06116 100644
--- a/src/engine/client/serverbrowser.cpp
+++ b/src/engine/client/serverbrowser.cpp
@@ -86,7 +86,7 @@ bool CServerBrowser::SortCompareName(int Index1, int Index2) const
 	CServerEntry *a = m_ppServerlist[Index1];
 	CServerEntry *b = m_ppServerlist[Index2];
 	//	make sure empty entries are listed last
-	return (a->m_GotInfo && b->m_GotInfo) || (!a->m_GotInfo && !b->m_GotInfo) ?  str_comp(a->m_Info.m_aName, b->m_Info.m_aName) < 0 :
+	return (a->m_GotInfo && b->m_GotInfo) || (!a->m_GotInfo && !b->m_GotInfo) ? str_comp(a->m_Info.m_aName, b->m_Info.m_aName) < 0 :
 			a->m_GotInfo ? true : false;
 }
 
@@ -535,7 +535,7 @@ void CServerBrowser::RequestImpl(const NETADDR &Addr, CServerEntry *pEntry) cons
 	Packet.m_Flags = NETSENDFLAG_CONNLESS;
 	Packet.m_DataSize = sizeof(Buffer);
 	Packet.m_pData = Buffer;
-	
+
 	m_pNetClient->Send(&Packet);
 
 	if(pEntry)
@@ -659,7 +659,7 @@ void CServerBrowser::AddFavorite(const NETADDR &Addr)
 	if(pEntry)
 		pEntry->m_Info.m_Favorite = 1;
 
-    if(g_Config.m_Debug)
+	if(g_Config.m_Debug)
 	{
 		char aAddrStr[NETADDR_MAXSTRSIZE];
 		net_addr_str(&Addr, aAddrStr, sizeof(aAddrStr));
@@ -705,7 +705,7 @@ int CServerBrowser::LoadingProgression() const
 {
 	if(m_NumServers == 0)
 		return 0;
-	
+
 	int Servers = m_NumServers;
 	int Loaded = m_NumServers-m_NumRequests;
 	return 100.0f * Loaded/Servers;
diff --git a/src/engine/client/serverbrowser.h b/src/engine/client/serverbrowser.h
index e0d39aad..a9111d15 100644
--- a/src/engine/client/serverbrowser.h
+++ b/src/engine/client/serverbrowser.h
@@ -103,7 +103,7 @@ private:
 
 	CServerEntry *Find(const NETADDR &Addr);
 	CServerEntry *Add(const NETADDR &Addr);
- 
+
 	void RemoveRequest(CServerEntry *pEntry);
 	void QueueRequest(CServerEntry *pEntry);
 
diff --git a/src/engine/client/text.cpp b/src/engine/client/text.cpp
index da91980d..b0896b92 100644
--- a/src/engine/client/text.cpp
+++ b/src/engine/client/text.cpp
@@ -36,7 +36,7 @@ static int aFontSizes[] = {8,9,10,11,12,13,14,15,16,17,18,19,20,36,64};
 struct CFontChar
 {
 	int m_ID;
-	
+
 	// these values are scaled to the pFont size
 	// width * font_size == real_size
 	float m_Width;
@@ -44,7 +44,7 @@ struct CFontChar
 	float m_OffsetX;
 	float m_OffsetY;
 	float m_AdvanceX;
-	
+
 	float m_aUvs[4];
 	int64 m_TouchTime;
 };
@@ -57,16 +57,16 @@ struct CFontSizeData
 	GLuint m_aTextures[2];
 	int m_TextureWidth;
 	int m_TextureHeight;
-	
+
 	int m_NumXChars;
 	int m_NumYChars;
-	
+
 	int m_CharMaxWidth;
 	int m_CharMaxHeight;
-	
+
 	CFontChar m_aCharacters[MAX_CHARACTERS*MAX_CHARACTERS];
-	
-	int m_CurrentCharacter;	
+
+	int m_CurrentCharacter;
 };
 
 class CFont
@@ -82,7 +82,7 @@ class CTextRender : public IEngineTextRender
 {
 	IGraphics *m_pGraphics;
 	IGraphics *Graphics() { return m_pGraphics; }
-	
+
 	int WordLength(const char *pText)
 	{
 		int s = 1;
@@ -106,13 +106,13 @@ class CTextRender : public IEngineTextRender
 	float m_TextOutlineG;
 	float m_TextOutlineB;
 	float m_TextOutlineA;
-	
+
 	int m_FontTextureFormat;
 
 	CFont *m_pDefaultFont;
 
 	FT_Library m_FTLibrary;
-	
+
 	int GetFontSizeIndex(int Pixelsize)
 	{
 		for(unsigned i = 0; i < NUM_FONT_SIZES; i++)
@@ -120,18 +120,18 @@ class CTextRender : public IEngineTextRender
 			if(aFontSizes[i] >= Pixelsize)
 				return i;
 		}
-		
+
 		return NUM_FONT_SIZES-1;
 	}
-	
+
 
 
 	void Grow(unsigned char *pIn, unsigned char *pOut, int w, int h)
 	{
-		for(int y = 0; y < h; y++) 
-			for(int x = 0; x < w; x++) 
-			{ 
-				int c = pIn[y*w+x]; 
+		for(int y = 0; y < h; y++)
+			for(int x = 0; x < w; x++)
+			{
+				int c = pIn[y*w+x];
 
 				for(int sy = -1; sy <= 1; sy++)
 					for(int sx = -1; sx <= 1; sx++)
@@ -142,7 +142,7 @@ class CTextRender : public IEngineTextRender
 						{
 							int Index = GetY*w+GetX;
 							if(pIn[Index] > c)
-								c = pIn[Index]; 
+								c = pIn[Index];
 						}
 					}
 
@@ -157,18 +157,18 @@ class CTextRender : public IEngineTextRender
 		int Height = CharHeight*Ychars;
 		void *pMem = mem_alloc(Width*Height, 1);
 		mem_zero(pMem, Width*Height);
-		
+
 		if(pSizeData->m_aTextures[0] == 0)
 			glGenTextures(2, pSizeData->m_aTextures);
 		else
 			FontMemoryUsage -= pSizeData->m_TextureWidth*pSizeData->m_TextureHeight*2;
-		
+
 		pSizeData->m_NumXChars = Xchars;
 		pSizeData->m_NumYChars = Ychars;
 		pSizeData->m_TextureWidth = Width;
 		pSizeData->m_TextureHeight = Height;
 		pSizeData->m_CurrentCharacter = 0;
-		
+
 		for(int i = 0; i < 2; i++)
 		{
 			glBindTexture(GL_TEXTURE_2D, pSizeData->m_aTextures[i]);
@@ -177,9 +177,9 @@ class CTextRender : public IEngineTextRender
 			glTexImage2D(GL_TEXTURE_2D, 0, m_FontTextureFormat, Width, Height, 0, m_FontTextureFormat, GL_UNSIGNED_BYTE, pMem);
 			FontMemoryUsage += Width*Height;
 		}
-		
+
 		dbg_msg("", "pFont memory usage: %d", FontMemoryUsage);
-		
+
 		mem_free(pMem);
 	}
 
@@ -198,43 +198,43 @@ class CTextRender : public IEngineTextRender
 			pSizeData->m_NumXChars <<= 1;
 		else
 			pSizeData->m_NumYChars <<= 1;
-		InitTexture(pSizeData, pSizeData->m_CharMaxWidth, pSizeData->m_CharMaxHeight, pSizeData->m_NumXChars, pSizeData->m_NumYChars);		
+		InitTexture(pSizeData, pSizeData->m_CharMaxWidth, pSizeData->m_CharMaxHeight, pSizeData->m_NumXChars, pSizeData->m_NumYChars);
 	}
-	
-	
+
+
 	// TODO: Refactor: move this into a pFont class
 	void InitIndex(CFont *pFont, int Index)
 	{
 		CFontSizeData *pSizeData = &pFont->m_aSizes[Index];
-		
+
 		pSizeData->m_FontSize = aFontSizes[Index];
 		FT_Set_Pixel_Sizes(pFont->m_FtFace, 0, pSizeData->m_FontSize);
-		
+
 		int OutlineThickness = AdjustOutlineThicknessToFontSize(1, pSizeData->m_FontSize);
-			
+
 		{
 			unsigned GlyphIndex;
 			int MaxH = 0;
 			int MaxW = 0;
-			
+
 			int Charcode = FT_Get_First_Char(pFont->m_FtFace, &GlyphIndex);
 			while(GlyphIndex != 0)
-			{   
+			{
 				// do stuff
 				FT_Load_Glyph(pFont->m_FtFace, GlyphIndex, FT_LOAD_DEFAULT);
-				
+
 				if(pFont->m_FtFace->glyph->metrics.width > MaxW) MaxW = pFont->m_FtFace->glyph->metrics.width; // ignore_convention
 				if(pFont->m_FtFace->glyph->metrics.height > MaxH) MaxH = pFont->m_FtFace->glyph->metrics.height; // ignore_convention
 				Charcode = FT_Get_Next_Char(pFont->m_FtFace, Charcode, &GlyphIndex);
 			}
-			
+
 			MaxW = (MaxW>>6)+2+OutlineThickness*2;
 			MaxH = (MaxH>>6)+2+OutlineThickness*2;
-			
+
 			for(pSizeData->m_CharMaxWidth = 1; pSizeData->m_CharMaxWidth < MaxW; pSizeData->m_CharMaxWidth <<= 1);
 			for(pSizeData->m_CharMaxHeight = 1; pSizeData->m_CharMaxHeight < MaxH; pSizeData->m_CharMaxHeight <<= 1);
 		}
-		
+
 		//dbg_msg("pFont", "init size %d, texture size %d %d", pFont->sizes[index].font_size, w, h);
 		//FT_New_Face(m_FTLibrary, "data/fonts/vera.ttf", 0, &pFont->ft_face);
 		InitTexture(pSizeData, pSizeData->m_CharMaxWidth, pSizeData->m_CharMaxHeight, 8, 8);
@@ -253,7 +253,7 @@ class CTextRender : public IEngineTextRender
 	{
 		int x = (SlotID%pSizeData->m_NumXChars) * (pSizeData->m_TextureWidth/pSizeData->m_NumXChars);
 		int y = (SlotID/pSizeData->m_NumXChars) * (pSizeData->m_TextureHeight/pSizeData->m_NumYChars);
-		
+
 		glBindTexture(GL_TEXTURE_2D, pSizeData->m_aTextures[Texnum]);
 		glTexSubImage2D(GL_TEXTURE_2D, 0, x, y,
 			pSizeData->m_TextureWidth/pSizeData->m_NumXChars,
@@ -284,13 +284,13 @@ class CTextRender : public IEngineTextRender
 				if(pSizeData->m_aCharacters[i].m_TouchTime < pSizeData->m_aCharacters[Oldest].m_TouchTime)
 					Oldest = i;
 			}
-			
+
 			if(time_get()-pSizeData->m_aCharacters[Oldest].m_TouchTime < time_freq())
 			{
 				IncreaseTextureSize(pSizeData);
 				return GetSlot(pSizeData);
 			}
-			
+
 			return Oldest;
 		}
 	}
@@ -315,12 +315,12 @@ class CTextRender : public IEngineTextRender
 		}
 
 		pBitmap = &pFont->m_FtFace->glyph->bitmap; // ignore_convention
-		
+
 		// fetch slot
 		SlotID = GetSlot(pSizeData);
 		if(SlotID < 0)
 			return -1;
-		
+
 		// adjust spacing
 		int OutlineThickness = AdjustOutlineThicknessToFontSize(1, pSizeData->m_FontSize);
 		x += OutlineThickness;
@@ -337,7 +337,7 @@ class CTextRender : public IEngineTextRender
 		}
 		else if(pBitmap->pixel_mode == FT_PIXEL_MODE_MONO) // ignore_convention
 		{
-			for(py = 0; py < pBitmap->rows; py++)  // ignore_convention
+			for(py = 0; py < pBitmap->rows; py++) // ignore_convention
 				for(px = 0; px < pBitmap->width; px++) // ignore_convention
 				{
 					if(pBitmap->buffer[py*pBitmap->pitch+px/8]&(1<<(7-(px%8)))) // ignore_convention
@@ -345,13 +345,13 @@ class CTextRender : public IEngineTextRender
 				}
 		}
 
-		if(0) for(py = 0; py < SlotW; py++) 
-			for(px = 0; px < SlotH; px++) 
+		if(0) for(py = 0; py < SlotW; py++)
+			for(px = 0; px < SlotH; px++)
 				ms_aGlyphData[py*SlotW+px] = 255;
-		
+
 		// upload the glyph
 		UploadGlyph(pSizeData, 0, SlotID, Chr, ms_aGlyphData);
-		
+
 		if(OutlineThickness == 1)
 		{
 			Grow(ms_aGlyphData, ms_aGlyphDataOutlined, SlotW, SlotH);
@@ -366,7 +366,7 @@ class CTextRender : public IEngineTextRender
 			}
 			UploadGlyph(pSizeData, 1, SlotID, Chr, ms_aGlyphData);
 		}
-		
+
 		// set char info
 		{
 			CFontChar *pFontchr = &pSizeData->m_aCharacters[SlotID];
@@ -375,27 +375,27 @@ class CTextRender : public IEngineTextRender
 			float Vscale = 1.0f/pSizeData->m_TextureHeight;
 			int Height = pBitmap->rows + OutlineThickness*2 + 2; // ignore_convention
 			int Width = pBitmap->width + OutlineThickness*2 + 2; // ignore_convention
-			
+
 			pFontchr->m_ID = Chr;
 			pFontchr->m_Height = Height * Scale;
 			pFontchr->m_Width = Width * Scale;
 			pFontchr->m_OffsetX = (pFont->m_FtFace->glyph->bitmap_left-1) * Scale; // ignore_convention
 			pFontchr->m_OffsetY = (pSizeData->m_FontSize - pFont->m_FtFace->glyph->bitmap_top) * Scale; // ignore_convention
 			pFontchr->m_AdvanceX = (pFont->m_FtFace->glyph->advance.x>>6) * Scale; // ignore_convention
-			
+
 			pFontchr->m_aUvs[0] = (SlotID%pSizeData->m_NumXChars) / (float)(pSizeData->m_NumXChars);
 			pFontchr->m_aUvs[1] = (SlotID/pSizeData->m_NumXChars) / (float)(pSizeData->m_NumYChars);
 			pFontchr->m_aUvs[2] = pFontchr->m_aUvs[0] + Width*Uscale;
 			pFontchr->m_aUvs[3] = pFontchr->m_aUvs[1] + Height*Vscale;
 		}
-		
+
 		return SlotID;
 	}
 
 	CFontChar *GetChar(CFont *pFont, CFontSizeData *pSizeData, int Chr)
 	{
 		CFontChar *pFontchr = NULL;
-		
+
 		// search for the character
 		// TODO: remove this linear search
 		int i;
@@ -407,7 +407,7 @@ class CTextRender : public IEngineTextRender
 				break;
 			}
 		}
-		
+
 		// check if we need to render the character
 		if(!pFontchr)
 		{
@@ -415,12 +415,12 @@ class CTextRender : public IEngineTextRender
 			if(Index >= 0)
 				pFontchr = &pSizeData->m_aCharacters[Index];
 		}
-		
+
 		// touch the character
 		// TODO: don't call time_get here
 		if(pFontchr)
 			pFontchr->m_TouchTime = time_get();
-			
+
 		return pFontchr;
 	}
 
@@ -436,8 +436,8 @@ class CTextRender : public IEngineTextRender
 		FT_Get_Kerning(pFont->m_FtFace, Left, Right, FT_KERNING_DEFAULT, &Kerning);
 		return (Kerning.x>>6);
 	}
-	
-	
+
+
 public:
 	CTextRender()
 	{
@@ -457,21 +457,21 @@ public:
 		// GL_LUMINANCE can be good for debugging
 		m_FontTextureFormat = GL_ALPHA;
 	}
-		
+
 	virtual void Init()
 	{
 		m_pGraphics = Kernel()->RequestInterface<IGraphics>();
 		FT_Init_FreeType(&m_FTLibrary);
 	}
-			
+
 
 	virtual CFont *LoadFont(const char *pFilename)
 	{
 		CFont *pFont = (CFont *)mem_alloc(sizeof(CFont), 1);
-		
+
 		mem_zero(pFont, sizeof(*pFont));
 		str_copy(pFont->m_aFilename, pFilename, sizeof(pFont->m_aFilename));
-		
+
 		if(FT_New_Face(m_FTLibrary, pFont->m_aFilename, 0, &pFont->m_FtFace))
 		{
 			mem_free(pFont);
@@ -480,7 +480,7 @@ public:
 
 		for(unsigned i = 0; i < NUM_FONT_SIZES; i++)
 			pFont->m_aSizes[i].m_FontSize = -1;
-		
+
 		dbg_msg("textrender", "loaded pFont from '%s'", pFilename);
 		return pFont;
 	};
@@ -495,8 +495,8 @@ public:
 		dbg_msg("textrender", "default pFont set %p", pFont);
 		m_pDefaultFont = pFont;
 	}
-		
-		
+
+
 	virtual void SetCursor(CTextCursor *pCursor, float x, float y, float FontSize, int Flags)
 	{
 		mem_zero(pCursor, sizeof(*pCursor));
@@ -510,8 +510,8 @@ public:
 		pCursor->m_Flags = Flags;
 		pCursor->m_CharCount = 0;
 	}
-	
-		
+
+
 	virtual void Text(void *pFontSetV, float x, float y, float Size, const char *pText, int MaxWidth)
 	{
 		CTextCursor Cursor;
@@ -527,7 +527,7 @@ public:
 		TextEx(&Cursor, pText, Length);
 		return Cursor.m_X;
 	}
-	
+
 	virtual int TextLineCount(void *pFontSetV, float Size, const char *pText, float LineWidth)
 	{
 		CTextCursor Cursor;
@@ -552,12 +552,12 @@ public:
 		m_TextOutlineB = b;
 		m_TextOutlineA = a;
 	}
-	
+
 	virtual void TextEx(CTextCursor *pCursor, const char *pText, int Length)
 	{
 		CFont *pFont = pCursor->m_pFont;
 		CFontSizeData *pSizeData = NULL;
-		
+
 		//dbg_msg("textrender", "rendering text '%s'", text);
 
 		float ScreenX0, ScreenY0, ScreenX1, ScreenY1;
@@ -576,7 +576,7 @@ public:
 
 		// to correct coords, convert to screen coords, round, and convert back
 		Graphics()->GetScreen(&ScreenX0, &ScreenY0, &ScreenX1, &ScreenY1);
-		
+
 		FakeToScreenX = (Graphics()->ScreenWidth()/(ScreenX1-ScreenX0));
 		FakeToScreenY = (Graphics()->ScreenHeight()/(ScreenY1-ScreenY0));
 		ActualX = (int)(pCursor->m_X * FakeToScreenX);
@@ -592,7 +592,7 @@ public:
 		// fetch pFont data
 		if(!pFont)
 			pFont = m_pDefaultFont;
-		
+
 		if(!pFont)
 			return;
 
@@ -600,11 +600,11 @@ public:
 		RenderSetup(pFont, ActualSize);
 
 		float Scale = 1/pSizeData->m_FontSize;
-		
+
 		// set length
 		if(Length < 0)
 			Length = str_length(pText);
-			
+
 		pEnd = pText + Length;
 
 		// if we don't want to render, we can just skip the first outline pass
@@ -649,7 +649,7 @@ public:
 					Compare.m_Flags &= ~TEXTFLAG_RENDER;
 					Compare.m_LineWidth = -1;
 					TextEx(&Compare, pText, Wlen);
-					
+
 					if(Compare.m_X-DrawX > pCursor->m_LineWidth)
 					{
 						// word can't be fitted in one line, cut it
@@ -659,11 +659,11 @@ public:
 						Cutter.m_Y = DrawY;
 						Cutter.m_Flags &= ~TEXTFLAG_RENDER;
 						Cutter.m_Flags |= TEXTFLAG_STOP_AT_END;
-						
+
 						TextEx(&Cutter, (const char *)pCurrent, Wlen);
 						Wlen = Cutter.m_CharCount;
 						NewLine = 1;
-						
+
 						if(Wlen <= 3) // if we can't place 3 chars of the word on this line, take the next
 							Wlen = 0;
 					}
@@ -672,10 +672,10 @@ public:
 						NewLine = 1;
 						Wlen = 0;
 					}
-					
+
 					pBatchEnd = pCurrent + Wlen;
 				}
-				
+
 				const char *pTmp = pCurrent;
 				int NextCharacter = str_utf8_decode(&pTmp);
 				while(pCurrent < pBatchEnd)
@@ -683,7 +683,7 @@ public:
 					int Character = NextCharacter;
 					pCurrent = pTmp;
 					NextCharacter = str_utf8_decode(&pTmp);
-					
+
 					if(Character == '\n')
 					{
 						DrawX = pCursor->m_StartX;
@@ -718,14 +718,14 @@ public:
 						pCursor->m_CharCount++;
 					}
 				}
-				
+
 				if(NewLine)
 				{
 					DrawX = pCursor->m_StartX;
 					DrawY += Size;
 					GotNewLine = 1;
 					DrawX = (int)(DrawX * FakeToScreenX) / FakeToScreenX; // realign
-					DrawY = (int)(DrawY * FakeToScreenY) / FakeToScreenY;				
+					DrawY = (int)(DrawY * FakeToScreenY) / FakeToScreenY;
 					++LineCount;
 				}
 			}
@@ -736,11 +736,11 @@ public:
 
 		pCursor->m_X = DrawX;
 		pCursor->m_LineCount = LineCount;
-		
+
 		if(GotNewLine)
 			pCursor->m_Y = DrawY;
 	}
-	
+
 };
 
 IEngineTextRender *CreateEngineTextRender() { return new CTextRender; }
diff --git a/src/engine/config.h b/src/engine/config.h
index 7e00cf65..35ef9fb9 100644
--- a/src/engine/config.h
+++ b/src/engine/config.h
@@ -15,9 +15,9 @@ public:
 	virtual void Reset() = 0;
 	virtual void RestoreStrings() = 0;
 	virtual void Save() = 0;
-	
+
 	virtual void RegisterCallback(SAVECALLBACKFUNC pfnFunc, void *pUserData) = 0;
-	
+
 	virtual void WriteLine(const char *pLine) = 0;
 };
 
diff --git a/src/engine/console.h b/src/engine/console.h
index 77de927e..f8ec67b0 100644
--- a/src/engine/console.h
+++ b/src/engine/console.h
@@ -25,14 +25,14 @@ public:
 	public:
 		IResult() { m_NumArgs = 0; }
 		virtual ~IResult() {}
-		
+
 		virtual int GetInteger(unsigned Index) = 0;
 		virtual float GetFloat(unsigned Index) = 0;
 		virtual const char *GetString(unsigned Index) = 0;
-		
+
 		int NumArguments() const { return m_NumArgs; }
 	};
-	
+
 	class CCommandInfo
 	{
 	public:
@@ -50,16 +50,16 @@ public:
 	virtual void PossibleCommands(const char *pStr, int FlagMask, FPossibleCallback pfnCallback, void *pUser) = 0;
 	virtual void ParseArguments(int NumArgs, const char **ppArguments) = 0;
 
-	virtual void Register(const char *pName, const char *pParams, 
+	virtual void Register(const char *pName, const char *pParams,
 		int Flags, FCommandCallback pfnFunc, void *pUser, const char *pHelp) = 0;
 	virtual void Chain(const char *pName, FChainCommandCallback pfnChainFunc, void *pUser) = 0;
 	virtual void StoreCommands(bool Store) = 0;
-	
+
 	virtual bool LineIsValid(const char *pStr) = 0;
 	virtual void ExecuteLine(const char *Sptr) = 0;
 	virtual void ExecuteLineStroked(int Stroke, const char *pStr) = 0;
 	virtual void ExecuteFile(const char *pFilename) = 0;
-	
+
 	virtual void RegisterPrintCallback(FPrintCallback pfnPrintCallback, void *pUserData) = 0;
 	virtual void Print(int Level, const char *pFrom, const char *pStr) = 0;
 };
diff --git a/src/engine/friends.h b/src/engine/friends.h
index 50e5ef1f..bf9df904 100644
--- a/src/engine/friends.h
+++ b/src/engine/friends.h
@@ -21,11 +21,11 @@ public:
 	{
 		MAX_FRIENDS=128,
 	};
-	
+
 	virtual void Init() = 0;
-	
+
 	virtual int NumFriends() const = 0;
-	virtual const CFriendInfo *GetFriend(int Index) const = 0; 
+	virtual const CFriendInfo *GetFriend(int Index) const = 0;
 	virtual bool IsFriend(const char *pName, const char *pClan, bool PlayersOnly) const = 0;
 
 	virtual void AddFriend(const char *pName, const char *pClan) = 0;
diff --git a/src/engine/graphics.h b/src/engine/graphics.h
index de99caac..0912bfb5 100644
--- a/src/engine/graphics.h
+++ b/src/engine/graphics.h
@@ -19,11 +19,11 @@ public:
 	/* Variable: width
 		Contains the width of the image */
 	int m_Width;
-	
+
 	/* Variable: height
 		Contains the height of the image */
 	int m_Height;
-	
+
 	/* Variable: format
 		Contains the format of the image. See <Image Formats> for more information. */
 	int m_Format;
@@ -61,27 +61,27 @@ public:
 	int ScreenWidth() const { return m_ScreenWidth; }
 	int ScreenHeight() const { return m_ScreenHeight; }
 	float ScreenAspect() const { return (float)ScreenWidth()/(float)ScreenHeight(); }
-	
+
 	virtual void Clear(float r, float g, float b) = 0;
-	
+
 	virtual void ClipEnable(int x, int y, int w, int h) = 0;
 	virtual void ClipDisable() = 0;
-	
+
 	virtual void MapScreen(float TopLeftX, float TopLeftY, float BottomRightX, float BottomRightY) = 0;
 	virtual void GetScreen(float *pTopLeftX, float *pTopLeftY, float *pBottomRightX, float *pBottomRightY) = 0;
-	
+
 	// TODO: These should perhaps not be virtuals
 	virtual void BlendNone() = 0;
 	virtual void BlendNormal() = 0;
 	virtual void BlendAdditive() = 0;
 	virtual int MemoryUsage() const = 0;
-	
+
 	virtual int LoadPNG(CImageInfo *pImg, const char *pFilename, int StorageType) =0;
 	virtual int UnloadTexture(int Index) = 0;
 	virtual int LoadTextureRaw(int Width, int Height, int Format, const void *pData, int StoreFormat, int Flags) = 0;
 	virtual int LoadTexture(const char *pFilename, int StorageType, int StoreFormat, int Flags) = 0;
 	virtual void TextureSet(int TextureID) = 0;
-	
+
 	struct CLineItem
 	{
 		float m_X0, m_Y0, m_X1, m_Y1;
@@ -91,13 +91,13 @@ public:
 	virtual void LinesBegin() = 0;
 	virtual void LinesEnd() = 0;
 	virtual void LinesDraw(const CLineItem *pArray, int Num) = 0;
-	
+
 	virtual void QuadsBegin() = 0;
 	virtual void QuadsEnd() = 0;
 	virtual void QuadsSetRotation(float Angle) = 0;
 	virtual void QuadsSetSubset(float TopLeftY, float TopLeftV, float BottomRightU, float BottomRightV) = 0;
 	virtual void QuadsSetSubsetFree(float x0, float y0, float x1, float y1, float x2, float y2, float x3, float y3) = 0;
-	
+
 	struct CQuadItem
 	{
 		float m_X, m_Y, m_Width, m_Height;
@@ -106,7 +106,7 @@ public:
 	};
 	virtual void QuadsDraw(CQuadItem *pArray, int Num) = 0;
 	virtual void QuadsDrawTL(const CQuadItem *pArray, int Num) = 0;
-	
+
 	struct CFreeformItem
 	{
 		float m_X0, m_Y0, m_X1, m_Y1, m_X2, m_Y2, m_X3, m_Y3;
@@ -116,7 +116,7 @@ public:
 	};
 	virtual void QuadsDrawFreeform(const CFreeformItem *pArray, int Num) = 0;
 	virtual void QuadsText(float x, float y, float Size, float r, float g, float b, float a, const char *pText) = 0;
-	
+
 	struct CColorVertex
 	{
 		int m_Index;
@@ -126,7 +126,7 @@ public:
 	};
 	virtual void SetColorVertex(const CColorVertex *pArray, int Num) = 0;
 	virtual void SetColor(float r, float g, float b, float a) = 0;
-	
+
 	virtual void TakeScreenshot(const char *pFilename) = 0;
 	virtual int GetVideoModes(CVideoMode *pModes, int MaxModes) = 0;
 
@@ -139,13 +139,13 @@ class IEngineGraphics : public IGraphics
 public:
 	virtual bool Init() = 0;
 	virtual void Shutdown() = 0;
-	
+
 	virtual void Minimize() = 0;
 	virtual void Maximize() = 0;
-	
+
 	virtual int WindowActive() = 0;
 	virtual int WindowOpen() = 0;
-	
+
 };
 
 extern IEngineGraphics *CreateEngineGraphics();
diff --git a/src/engine/input.h b/src/engine/input.h
index aa9be78f..7d28be10 100644
--- a/src/engine/input.h
+++ b/src/engine/input.h
@@ -41,7 +41,7 @@ protected:
 
 	int KeyWasPressed(int Key) { return m_aInputState[m_InputCurrent^1][Key]; }
 
-public:	
+public:
 	enum
 	{
 		FLAG_PRESS=1,
@@ -53,7 +53,7 @@ public:
 	int NumEvents() const { return m_NumEvents; }
 	void ClearEvents() { m_NumEvents = 0; }
 	CEvent GetEvent(int Index) const
-	{ 
+	{
 		if(Index < 0 || Index >= m_NumEvents)
 		{
 			IInput::CEvent e = {0,0};
@@ -61,19 +61,19 @@ public:
 		}
 		return m_aInputEvents[Index];
 	}
-	
+
 	// keys
 	int KeyPressed(int Key) { return m_aInputState[m_InputCurrent][Key]; }
 	int KeyReleases(int Key) { return m_aInputCount[m_InputCurrent][Key].m_Releases; }
 	int KeyPresses(int Key) { return m_aInputCount[m_InputCurrent][Key].m_Presses; }
 	int KeyDown(int Key) { return KeyPressed(Key)&&!KeyWasPressed(Key); }
 	const char *KeyName(int Key) { return (Key >= 0 && Key < 512) ? g_aaKeyStrings[Key] : g_aaKeyStrings[0]; }
-	
+
 	//
 	virtual void MouseModeRelative() = 0;
 	virtual void MouseModeAbsolute() = 0;
 	virtual int MouseDoubleClick() = 0;
-	
+
 	virtual void MouseRelative(float *x, float *y) = 0;
 };
 
diff --git a/src/engine/kernel.h b/src/engine/kernel.h
index 288f49ab..b5961bc3 100644
--- a/src/engine/kernel.h
+++ b/src/engine/kernel.h
@@ -18,7 +18,7 @@ protected:
 public:
 	IInterface() : m_pKernel(0) {}
 	virtual ~IInterface() {}
-	
+
 	//virtual unsigned InterfaceID() = 0;
 	//virtual const char *InterfaceName() = 0;
 };
@@ -27,7 +27,7 @@ public:
 	public: \
 		static const char *InterfaceName() { return Name; } \
 	private:
-	
+
 		//virtual unsigned InterfaceID() { return INTERFACE_ID; }
 		//virtual const char *InterfaceName() { return name; }
 
@@ -55,7 +55,7 @@ public:
 	{
 		return ReregisterInterfaceImpl(TINTERFACE::InterfaceName(), pInterface);
 	}
-	
+
 	// Usage example:
 	//		IMyInterface *pMyHandle = Kernel()->RequestInterface<IMyInterface>()
 	template<class TINTERFACE>
diff --git a/src/engine/server.h b/src/engine/server.h
index c27365ca..28dc3d11 100644
--- a/src/engine/server.h
+++ b/src/engine/server.h
@@ -21,7 +21,7 @@ public:
 		const char *m_pName;
 		int m_Latency;
 	};
-	
+
 	int Tick() const { return m_CurrentGameTick; }
 	int TickSpeed() const { return m_TickSpeed; }
 
@@ -32,7 +32,7 @@ public:
 	virtual int GetClientInfo(int ClientID, CClientInfo *pInfo) = 0;
 	virtual void GetClientAddr(int ClientID, char *pAddrStr, int Size) = 0;
 	virtual int *LatestInput(int ClientID, int *pSize) = 0;
-	
+
 	virtual int SendMsg(CMsgPacker *pMsg, int Flags, int ClientID) = 0;
 
 	template<class T>
@@ -43,18 +43,18 @@ public:
 			return -1;
 		return SendMsg(&Packer, Flags, ClientID);
 	}
-	
+
 	virtual void SetClientName(int ClientID, char const *pName) = 0;
 	virtual void SetClientClan(int ClientID, char const *pClan) = 0;
 	virtual void SetClientCountry(int ClientID, int Country) = 0;
 	virtual void SetClientScore(int ClientID, int Score) = 0;
-	
+
 	virtual int SnapNewID() = 0;
 	virtual void SnapFreeID(int ID) = 0;
 	virtual void *SnapNewItem(int Type, int ID, int Size) = 0;
 
 	virtual void SnapSetStaticsize(int ItemType, int Size) = 0;
-	
+
 	virtual bool IsAuthed(int ClientID) = 0;
 	virtual void Kick(int ClientID, const char *pReason) = 0;
 };
@@ -67,12 +67,12 @@ public:
 	virtual void OnInit() = 0;
 	virtual void OnConsoleInit() = 0;
 	virtual void OnShutdown() = 0;
-	
+
 	virtual void OnTick() = 0;
 	virtual void OnPreSnap() = 0;
 	virtual void OnSnap(int ClientID) = 0;
 	virtual void OnPostSnap() = 0;
-	
+
 	virtual void OnMessage(int MsgID, CUnpacker *pUnpacker, int ClientID) = 0;
 
 	virtual void OnClientConnected(int ClientID) = 0;
@@ -83,7 +83,7 @@ public:
 
 	virtual bool IsClientReady(int ClientID) = 0;
 	virtual bool IsClientPlayer(int ClientID) = 0;
-	
+
 	virtual const char *GameType() = 0;
 	virtual const char *Version() = 0;
 	virtual const char *NetVersion() = 0;
diff --git a/src/engine/server/register.cpp b/src/engine/server/register.cpp
index 0b53c67c..0b7eb948 100644
--- a/src/engine/server/register.cpp
+++ b/src/engine/server/register.cpp
@@ -41,15 +41,15 @@ void CRegister::RegisterSendFwcheckresponse(NETADDR *pAddr)
 	Packet.m_pData = SERVERBROWSE_FWRESPONSE;
 	m_pNetServer->Send(&Packet);
 }
-	
+
 void CRegister::RegisterSendHeartbeat(NETADDR Addr)
 {
 	static unsigned char aData[sizeof(SERVERBROWSE_HEARTBEAT) + 2];
 	unsigned short Port = g_Config.m_SvPort;
 	CNetChunk Packet;
-	
+
 	mem_copy(aData, SERVERBROWSE_HEARTBEAT, sizeof(SERVERBROWSE_HEARTBEAT));
-	
+
 	Packet.m_ClientID = -1;
 	Packet.m_Address = Addr;
 	Packet.m_Flags = NETSENDFLAG_CONNLESS;
@@ -118,7 +118,7 @@ void CRegister::RegisterUpdate(int Nettype)
 	else if(m_RegisterState == REGISTERSTATE_UPDATE_ADDRS)
 	{
 		m_RegisterRegisteredServer = -1;
-	
+
 		if(!m_pMasterServer->IsRefreshing())
 		{
 			int i;
@@ -137,7 +137,7 @@ void CRegister::RegisterUpdate(int Nettype)
 				m_aMasterserverInfo[i].m_Count = -1;
 				m_aMasterserverInfo[i].m_LastSend = 0;
 			}
-			
+
 			m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "register", "fetching server counts");
 			RegisterNewState(REGISTERSTATE_QUERY_COUNT);
 		}
@@ -149,7 +149,7 @@ void CRegister::RegisterUpdate(int Nettype)
 		{
 			if(!m_aMasterserverInfo[i].m_Valid)
 				continue;
-				
+
 			if(m_aMasterserverInfo[i].m_Count == -1)
 			{
 				Left++;
@@ -160,7 +160,7 @@ void CRegister::RegisterUpdate(int Nettype)
 				}
 			}
 		}
-		
+
 		// check if we are done or timed out
 		if(Left == 0 || Now > m_RegisterStateStart+Freq*3)
 		{
@@ -171,7 +171,7 @@ void CRegister::RegisterUpdate(int Nettype)
 			{
 				if(!m_aMasterserverInfo[i].m_Valid || m_aMasterserverInfo[i].m_Count == -1)
 					continue;
-					
+
 				if(Best == -1 || m_aMasterserverInfo[i].m_Count < m_aMasterserverInfo[Best].m_Count)
 					Best = i;
 			}
@@ -184,7 +184,7 @@ void CRegister::RegisterUpdate(int Nettype)
 				RegisterNewState(REGISTERSTATE_ERROR);
 			}
 			else
-			{			
+			{
 				char aBuf[256];
 				str_format(aBuf, sizeof(aBuf), "chose '%s' as master, sending heartbeats", m_pMasterServer->GetName(m_RegisterRegisteredServer));
 				m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "register", aBuf);
@@ -201,7 +201,7 @@ void CRegister::RegisterUpdate(int Nettype)
 			m_aMasterserverInfo[m_RegisterRegisteredServer].m_LastSend = Now;
 			RegisterSendHeartbeat(m_aMasterserverInfo[m_RegisterRegisteredServer].m_Addr);
 		}
-		
+
 		if(Now > m_RegisterStateStart+Freq*60)
 		{
 			m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "register", "WARNING: Master server is not responding, switching master");
@@ -212,9 +212,9 @@ void CRegister::RegisterUpdate(int Nettype)
 	{
 		if(m_RegisterFirst)
 			m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "register", "server registered");
-			
+
 		m_RegisterFirst = 0;
-		
+
 		// check if we should send new heartbeat again
 		if(Now > m_RegisterStateStart+Freq)
 		{
@@ -253,7 +253,7 @@ int CRegister::RegisterProcessPacket(CNetChunk *pPacket)
 	}
 	if(!Valid)
 		return 0;
-			
+
 	if(pPacket->m_DataSize == sizeof(SERVERBROWSE_FWCHECK) &&
 		mem_comp(pPacket->m_pData, SERVERBROWSE_FWCHECK, sizeof(SERVERBROWSE_FWCHECK)) == 0)
 	{
diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp
index 3878ece1..266b9130 100644
--- a/src/engine/server/server.cpp
+++ b/src/engine/server/server.cpp
@@ -26,7 +26,7 @@
 #include "register.h"
 #include "server.h"
 
-#if defined(CONF_FAMILY_WINDOWS) 
+#if defined(CONF_FAMILY_WINDOWS)
 	#define _WIN32_WINNT 0x0501
 	#define WIN32_LEAN_AND_MEAN
 	#include <windows.h>
@@ -75,7 +75,7 @@ void CSnapIDPool::Reset()
 		m_aIDs[i].m_Next = i+1;
 		m_aIDs[i].m_State = 0;
 	}
-		
+
 	m_aIDs[MAX_IDS-1].m_Next = -1;
 	m_FirstFree = 0;
 	m_FirstTimed = -1;
@@ -88,17 +88,17 @@ void CSnapIDPool::Reset()
 void CSnapIDPool::RemoveFirstTimeout()
 {
 	int NextTimed = m_aIDs[m_FirstTimed].m_Next;
-	
+
 	// add it to the free list
 	m_aIDs[m_FirstTimed].m_Next = m_FirstFree;
 	m_aIDs[m_FirstTimed].m_State = 0;
 	m_FirstFree = m_FirstTimed;
-	
+
 	// remove it from the timed list
 	m_FirstTimed = NextTimed;
 	if(m_FirstTimed == -1)
 		m_LastTimed = -1;
-		
+
 	m_Usage--;
 }
 
@@ -109,7 +109,7 @@ int CSnapIDPool::NewID()
 	// process timed ids
 	while(m_FirstTimed != -1 && m_aIDs[m_FirstTimed].m_Timeout < Now)
 		RemoveFirstTimeout();
-	
+
 	int ID = m_FirstFree;
 	dbg_assert(ID != -1, "id error");
 	if(ID == -1)
@@ -138,7 +138,7 @@ void CSnapIDPool::FreeID(int ID)
 	m_aIDs[ID].m_State = 2;
 	m_aIDs[ID].m_Timeout = time_get()+time_freq()*5;
 	m_aIDs[ID].m_Next = -1;
-	
+
 	if(m_LastTimed != -1)
 	{
 		m_aIDs[m_LastTimed].m_Next = ID;
@@ -150,7 +150,7 @@ void CSnapIDPool::FreeID(int ID)
 		m_LastTimed = ID;
 	}
 }
-	
+
 void CServer::CClient::Reset()
 {
 	// reset input
@@ -169,15 +169,15 @@ void CServer::CClient::Reset()
 CServer::CServer() : m_DemoRecorder(&m_SnapshotDelta)
 {
 	m_TickSpeed = SERVER_TICK_SPEED;
-	
+
 	m_pGameServer = 0;
-	
+
 	m_CurrentGameTick = 0;
 	m_RunServer = 1;
 
 	m_pCurrentMapData = 0;
 	m_CurrentMapSize = 0;
-	
+
 	m_MapReload = 0;
 
 	m_RconClientID = -1;
@@ -202,12 +202,12 @@ int CServer::TrySetClientName(int ClientID, const char *pName)
 	str_format(aBuf, sizeof(aBuf), "'%s' -> '%s'", pName, aTrimmedName);
 	Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
 	pName = aTrimmedName;
-	
-	
+
+
 	// check for empty names
 	if(!pName[0])
 		return -1;
-	
+
 	// make sure that two clients doesn't have the same name
 	for(int i = 0; i < MAX_CLIENTS; i++)
 		if(i != ClientID && m_aClients[i].m_State >= CClient::STATE_READY)
@@ -227,10 +227,10 @@ void CServer::SetClientName(int ClientID, const char *pName)
 {
 	if(ClientID < 0 || ClientID >= MAX_CLIENTS || m_aClients[ClientID].m_State < CClient::STATE_READY)
 		return;
-		
+
 	if(!pName)
 		return;
-		
+
 	char aNameTry[MAX_NAME_LENGTH];
 	str_copy(aNameTry, pName, MAX_NAME_LENGTH);
 	if(TrySetClientName(ClientID, aNameTry))
@@ -249,7 +249,7 @@ void CServer::SetClientClan(int ClientID, const char *pClan)
 {
 	if(ClientID < 0 || ClientID >= MAX_CLIENTS || m_aClients[ClientID].m_State < CClient::STATE_READY || !pClan)
 		return;
-		
+
 	str_copy(m_aClients[ClientID].m_aClan, pClan, MAX_CLAN_LENGTH);
 }
 
@@ -257,7 +257,7 @@ void CServer::SetClientCountry(int ClientID, int Country)
 {
 	if(ClientID < 0 || ClientID >= MAX_CLIENTS || m_aClients[ClientID].m_State < CClient::STATE_READY)
 		return;
-		
+
 	m_aClients[ClientID].m_Country = Country;
 }
 
@@ -280,7 +280,7 @@ void CServer::Kick(int ClientID, const char *pReason)
 		Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", "you can't kick yourself");
  		return;
 	}
-		
+
 	m_NetServer.Drop(ClientID, pReason);
 }
 
@@ -343,7 +343,7 @@ void CServer::GetClientAddr(int ClientID, char *pAddrStr, int Size)
 		net_addr_str(&Addr, pAddrStr, Size);
 	}
 }
-	
+
 
 int *CServer::LatestInput(int ClientID, int *size)
 {
@@ -360,7 +360,7 @@ const char *CServer::ClientName(int ClientID)
 		return m_aClients[ClientID].m_aName;
 	else
 		return "(connecting client)";
-	
+
 }
 
 const char *CServer::ClientClan(int ClientID)
@@ -398,13 +398,13 @@ int CServer::SendMsgEx(CMsgPacker *pMsg, int Flags, int ClientID, bool System)
 	CNetChunk Packet;
 	if(!pMsg)
 		return -1;
-		
+
 	mem_zero(&Packet, sizeof(CNetChunk));
-	
+
 	Packet.m_ClientID = ClientID;
 	Packet.m_pData = pMsg->Data();
 	Packet.m_DataSize = pMsg->Size();
-	
+
 	// HACK: modify the message id in the packet and store the system flag
 	*((unsigned char*)Packet.m_pData) <<= 1;
 	if(System)
@@ -414,7 +414,7 @@ int CServer::SendMsgEx(CMsgPacker *pMsg, int Flags, int ClientID, bool System)
 		Packet.m_Flags |= NETSENDFLAG_VITAL;
 	if(Flags&MSGFLAG_FLUSH)
 		Packet.m_Flags |= NETSENDFLAG_FLUSH;
-	
+
 	// write message to demo recorder
 	if(!(Flags&MSGFLAG_NORECORD))
 		m_DemoRecorder.RecordMessage(pMsg->Data(), pMsg->Size());
@@ -441,7 +441,7 @@ int CServer::SendMsgEx(CMsgPacker *pMsg, int Flags, int ClientID, bool System)
 void CServer::DoSnapshot()
 {
 	GameServer()->OnPreSnap();
-	
+
 	// create snapshot for demo recording
 	if(m_DemoRecorder.IsRecording())
 	{
@@ -452,7 +452,7 @@ void CServer::DoSnapshot()
 		m_SnapshotBuilder.Init();
 		GameServer()->OnSnap(-1);
 		SnapshotSize = m_SnapshotBuilder.Finish(aData);
-		
+
 		// write snapshot
 		m_DemoRecorder.RecordSnapshot(Tick(), aData, SnapshotSize);
 	}
@@ -463,15 +463,15 @@ void CServer::DoSnapshot()
 		// client must be ingame to recive snapshots
 		if(m_aClients[i].m_State != CClient::STATE_INGAME)
 			continue;
-			
+
 		// this client is trying to recover, don't spam snapshots
 		if(m_aClients[i].m_SnapRate == CClient::SNAPRATE_RECOVER && (Tick()%50) != 0)
 			continue;
-			
+
 		// this client is trying to recover, don't spam snapshots
 		if(m_aClients[i].m_SnapRate == CClient::SNAPRATE_INIT && (Tick()%10) != 0)
 			continue;
-			
+
 		{
 			char aData[CSnapshot::MAX_SIZE];
 			CSnapshot *pData = (CSnapshot*)aData;	// Fix compiler warning for strict-aliasing
@@ -496,13 +496,13 @@ void CServer::DoSnapshot()
 			// 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, pData, 0);
-			
+
 			// find snapshot that we can preform delta against
 			EmptySnap.Clear();
-			
+
 			{
 				DeltashotSize = m_aClients[i].m_Snapshots.Get(m_aClients[i].m_LastAckedSnapshot, 0, &pDeltashot, 0);
 				if(DeltashotSize >= 0)
@@ -514,10 +514,10 @@ void CServer::DoSnapshot()
 						m_aClients[i].m_SnapRate = CClient::SNAPRATE_RECOVER;
 				}
 			}
-			
+
 			// create delta
 			DeltaSize = m_SnapshotDelta.CreateDelta(pDeltashot, pData, aDeltaData);
-			
+
 			if(DeltaSize)
 			{
 				// compress it
@@ -527,7 +527,7 @@ void CServer::DoSnapshot()
 
 				SnapshotSize = CVariableInt::Compress(aDeltaData, DeltaSize, aCompData);
 				NumPackets = (SnapshotSize+MaxSize-1)/MaxSize;
-				
+
 				for(int n = 0, Left = SnapshotSize; Left; n++)
 				{
 					int Chunk = Left < MaxSize ? Left : MaxSize;
@@ -549,7 +549,7 @@ void CServer::DoSnapshot()
 						Msg.AddInt(m_CurrentGameTick);
 						Msg.AddInt(m_CurrentGameTick-DeltaTick);
 						Msg.AddInt(NumPackets);
-						Msg.AddInt(n);							
+						Msg.AddInt(n);
 						Msg.AddInt(Crc);
 						Msg.AddInt(Chunk);
 						Msg.AddRaw(&aCompData[n*MaxSize], Chunk);
@@ -587,7 +587,7 @@ int CServer::NewClientCallback(int ClientID, void *pUser)
 int CServer::DelClientCallback(int ClientID, const char *pReason, void *pUser)
 {
 	CServer *pThis = (CServer *)pUser;
-	
+
 	NETADDR Addr = pThis->m_NetServer.ClientAddr(ClientID);
 	char aAddrStr[NETADDR_MAXSTRSIZE];
 	net_addr_str(&Addr, aAddrStr, sizeof(aAddrStr));
@@ -598,7 +598,7 @@ int CServer::DelClientCallback(int ClientID, const char *pReason, void *pUser)
 	// notify the mod about the drop
 	if(pThis->m_aClients[ClientID].m_State >= CClient::STATE_READY)
 		pThis->GameServer()->OnClientDrop(ClientID, pReason);
-	
+
 	pThis->m_aClients[ClientID].m_State = CClient::STATE_EMPTY;
 	pThis->m_aClients[ClientID].m_aName[0] = 0;
 	pThis->m_aClients[ClientID].m_aClan[0] = 0;
@@ -636,16 +636,16 @@ void CServer::SendRconLineAuthed(const char *pLine, void *pUser)
 	CServer *pThis = (CServer *)pUser;
 	static volatile int ReentryGuard = 0;
 	int i;
-	
+
 	if(ReentryGuard) return;
 	ReentryGuard++;
-	
+
 	for(i = 0; i < MAX_CLIENTS; i++)
 	{
 		if(pThis->m_aClients[i].m_State != CClient::STATE_EMPTY && pThis->m_aClients[i].m_Authed)
 			pThis->SendRconLine(i, pLine);
 	}
-	
+
 	ReentryGuard--;
 }
 
@@ -655,15 +655,15 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 	NETADDR Addr;
 	CUnpacker Unpacker;
 	Unpacker.Reset(pPacket->m_pData, pPacket->m_DataSize);
-	
+
 	// unpack msgid and system flag
 	int Msg = Unpacker.GetInt();
 	int Sys = Msg&1;
 	Msg >>= 1;
-	
+
 	if(Unpacker.Error())
 		return;
-	
+
 	if(Sys)
 	{
 		// system message
@@ -680,7 +680,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 					m_NetServer.Drop(ClientID, aReason);
 					return;
 				}
-			
+
 				const char *pPassword = Unpacker.GetString(CUnpacker::SANITIZE_CC);
 				if(g_Config.m_Password[0] != 0 && str_comp(g_Config.m_Password, pPassword) != 0)
 				{
@@ -688,7 +688,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 					m_NetServer.Drop(ClientID, "Wrong password");
 					return;
 				}
-			
+
 				m_aClients[ClientID].m_State = CClient::STATE_CONNECTING;
 				SendMap(ClientID);
 			}
@@ -699,11 +699,11 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 			int ChunkSize = 1024-128;
 			int Offset = Chunk * ChunkSize;
 			int Last = 0;
-				
+
 			// drop faulty map data requests
 			if(Chunk < 0 || Offset > m_CurrentMapSize)
 				return;
-				
+
 			if(Offset+ChunkSize >= m_CurrentMapSize)
 			{
 				ChunkSize = m_CurrentMapSize-Offset;
@@ -711,7 +711,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 					ChunkSize = 0;
 				Last = 1;
 			}
-				
+
 			CMsgPacker Msg(NETMSG_MAP_DATA);
 			Msg.AddInt(Last);
 			Msg.AddInt(m_CurrentMapCrc);
@@ -719,7 +719,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 			Msg.AddInt(ChunkSize);
 			Msg.AddRaw(&m_pCurrentMapData[Offset], ChunkSize);
 			SendMsgEx(&Msg, MSGFLAG_VITAL|MSGFLAG_FLUSH, ClientID, true);
-				
+
 			if(g_Config.m_Debug)
 			{
 				char aBuf[256];
@@ -734,7 +734,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 				Addr = m_NetServer.ClientAddr(ClientID);
 				char aAddrStr[NETADDR_MAXSTRSIZE];
 				net_addr_str(&Addr, aAddrStr, sizeof(aAddrStr));
-					
+
 				char aBuf[256];
 				str_format(aBuf, sizeof(aBuf), "player is ready. ClientID=%x addr=%s", ClientID, aAddrStr);
 				Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBuf);
@@ -750,7 +750,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 				Addr = m_NetServer.ClientAddr(ClientID);
 				char aAddrStr[NETADDR_MAXSTRSIZE];
 				net_addr_str(&Addr, aAddrStr, sizeof(aAddrStr));
-					
+
 				char aBuf[256];
 				str_format(aBuf, sizeof(aBuf), "player has entered the game. ClientID=%x addr=%s", ClientID, aAddrStr);
 				Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
@@ -762,18 +762,18 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 		{
 			CClient::CInput *pInput;
 			int64 TagTime;
-				
+
 			m_aClients[ClientID].m_LastAckedSnapshot = Unpacker.GetInt();
 			int IntendedTick = Unpacker.GetInt();
 			int Size = Unpacker.GetInt();
-				
+
 			// check for errors
 			if(Unpacker.Error() || Size/4 > MAX_INPUT_SIZE)
 				return;
 
 			if(m_aClients[ClientID].m_LastAckedSnapshot > 0)
 				m_aClients[ClientID].m_SnapRate = CClient::SNAPRATE_FULL;
-					
+
 			if(m_aClients[ClientID].m_Snapshots.Get(m_aClients[ClientID].m_LastAckedSnapshot, &TagTime, 0, 0) >= 0)
 				m_aClients[ClientID].m_Latency = (int)(((time_get()-TagTime)*1000)/time_freq());
 
@@ -782,7 +782,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 			if(IntendedTick > m_aClients[ClientID].m_LastInputTick)
 			{
 				int TimeLeft = ((TickStartTime(IntendedTick)-time_get())*1000) / time_freq();
-					
+
 				CMsgPacker Msg(NETMSG_INPUTTIMING);
 				Msg.AddInt(IntendedTick);
 				Msg.AddInt(TimeLeft);
@@ -792,20 +792,20 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 			m_aClients[ClientID].m_LastInputTick = IntendedTick;
 
 			pInput = &m_aClients[ClientID].m_aInputs[m_aClients[ClientID].m_CurrentInput];
-				
+
 			if(IntendedTick <= Tick())
 				IntendedTick = Tick()+1;
 
 			pInput->m_GameTick = IntendedTick;
-				
+
 			for(int i = 0; i < Size/4; i++)
 				pInput->m_aData[i] = Unpacker.GetInt();
-				
+
 			mem_copy(m_aClients[ClientID].m_LatestInput.m_aData, pInput->m_aData, MAX_INPUT_SIZE*sizeof(int));
-				
+
 			m_aClients[ClientID].m_CurrentInput++;
 			m_aClients[ClientID].m_CurrentInput %= 200;
-			
+
 			// call the mod with the fresh input data
 			if(m_aClients[ClientID].m_State == CClient::STATE_INGAME)
 				GameServer()->OnClientDirectInput(ClientID, m_aClients[ClientID].m_LatestInput.m_aData);
@@ -813,7 +813,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 		else if(Msg == NETMSG_RCON_CMD)
 		{
 			const char *pCmd = Unpacker.GetString();
-				
+
 			if(Unpacker.Error() == 0 && m_aClients[ClientID].m_Authed)
 			{
 				char aBuf[256];
@@ -829,7 +829,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 			const char *pPw;
 			Unpacker.GetString(); // login name, not used
 			pPw = Unpacker.GetString(CUnpacker::SANITIZE_CC);
-				
+
 			if(Unpacker.Error() == 0)
 			{
 				if(g_Config.m_SvRconPassword[0] == 0)
@@ -841,7 +841,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 					CMsgPacker Msg(NETMSG_RCON_AUTH_STATUS);
 					Msg.AddInt(1);
 					SendMsgEx(&Msg, MSGFLAG_VITAL, ClientID, true);
-						
+
 					m_aClients[ClientID].m_Authed = 1;
 					SendRconLine(ClientID, "Authentication successful. Remote console access granted.");
 					char aBuf[256];
@@ -905,7 +905,7 @@ void CServer::ProcessClientPacket(CNetChunk *pPacket)
 			GameServer()->OnMessage(Msg, &Unpacker, ClientID);
 	}
 }
-	
+
 void CServer::SendServerInfo(NETADDR *pAddr, int Token)
 {
 	CNetChunk Packet;
@@ -920,17 +920,17 @@ void CServer::SendServerInfo(NETADDR *pAddr, int Token)
 		{
 			if(GameServer()->IsClientPlayer(i))
 				PlayerCount++;
-			
+
 			ClientCount++;
 		}
 	}
-	
+
 	p.Reset();
 
 	p.AddRaw(SERVERBROWSE_INFO, sizeof(SERVERBROWSE_INFO));
 	str_format(aBuf, sizeof(aBuf), "%d", Token);
 	p.AddString(aBuf, 6);
-	
+
 	p.AddString(GameServer()->Version(), 32);
 	p.AddString(g_Config.m_SvName, 64);
 	p.AddString(GetMapName(), 32);
@@ -940,28 +940,28 @@ void CServer::SendServerInfo(NETADDR *pAddr, int Token)
 
 	// flags
 	int i = 0;
-	if(g_Config.m_Password[0])   // password set
+	if(g_Config.m_Password[0]) // password set
 		i |= SERVER_FLAG_PASSWORD;
 	str_format(aBuf, sizeof(aBuf), "%d", i);
 	p.AddString(aBuf, 2);
 
-	str_format(aBuf, sizeof(aBuf), "%d", PlayerCount); p.AddString(aBuf, 3);  // num players
+	str_format(aBuf, sizeof(aBuf), "%d", PlayerCount); p.AddString(aBuf, 3); // num players
 	str_format(aBuf, sizeof(aBuf), "%d", m_NetServer.MaxClients()-g_Config.m_SvSpectatorSlots); p.AddString(aBuf, 3); // max players
-	str_format(aBuf, sizeof(aBuf), "%d", ClientCount); p.AddString(aBuf, 3);  // num clients
+	str_format(aBuf, sizeof(aBuf), "%d", ClientCount); p.AddString(aBuf, 3); // num clients
 	str_format(aBuf, sizeof(aBuf), "%d", m_NetServer.MaxClients()); p.AddString(aBuf, 3); // max clients
 
 	for(i = 0; i < MAX_CLIENTS; i++)
 	{
 		if(m_aClients[i].m_State != CClient::STATE_EMPTY)
 		{
-			p.AddString(ClientName(i), MAX_NAME_LENGTH);  // client name
-			p.AddString(ClientClan(i), MAX_CLAN_LENGTH);  // client clan
-			str_format(aBuf, sizeof(aBuf), "%d", m_aClients[i].m_Country); p.AddString(aBuf, 6);  // client country
-			str_format(aBuf, sizeof(aBuf), "%d", m_aClients[i].m_Score); p.AddString(aBuf, 6);  // client score
-			str_format(aBuf, sizeof(aBuf), "%d", GameServer()->IsClientPlayer(i)?1:0); p.AddString(aBuf, 2);  // is player?
+			p.AddString(ClientName(i), MAX_NAME_LENGTH); // client name
+			p.AddString(ClientClan(i), MAX_CLAN_LENGTH); // client clan
+			str_format(aBuf, sizeof(aBuf), "%d", m_aClients[i].m_Country); p.AddString(aBuf, 6); // client country
+			str_format(aBuf, sizeof(aBuf), "%d", m_aClients[i].m_Score); p.AddString(aBuf, 6); // client score
+			str_format(aBuf, sizeof(aBuf), "%d", GameServer()->IsClientPlayer(i)?1:0); p.AddString(aBuf, 2); // is player?
 		}
 	}
-	
+
 	Packet.m_ClientID = -1;
 	Packet.m_Address = *pAddr;
 	Packet.m_Flags = NETSENDFLAG_CONNLESS;
@@ -994,21 +994,21 @@ int CServer::BanAdd(NETADDR Addr, int Seconds, const char *pReason)
 		str_format(aBuf, sizeof(aBuf), "banned %s for life", aAddrStr);
 	Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
 
-	return m_NetServer.BanAdd(Addr, Seconds, pReason);	
+	return m_NetServer.BanAdd(Addr, Seconds, pReason);
 }
 
 int CServer::BanRemove(NETADDR Addr)
 {
 	return m_NetServer.BanRemove(Addr);
 }
-	
+
 
 void CServer::PumpNetwork()
 {
 	CNetChunk Packet;
 
 	m_NetServer.Update();
-	
+
 	// process packets
 	while(m_NetServer.Recv(&Packet))
 	{
@@ -1046,7 +1046,7 @@ int CServer::LoadMap(const char *pMapName)
 	//DATAFILE *df;
 	char aBuf[512];
 	str_format(aBuf, sizeof(aBuf), "maps/%s.map", pMapName);
-	
+
 	/*df = datafile_load(buf);
 	if(!df)
 		return 0;*/
@@ -1057,25 +1057,25 @@ int CServer::LoadMap(const char *pMapName)
 		Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "mapchecker", "invalid standard map");
 		return 0;
 	}
-		
+
 	if(!m_pMap->Load(aBuf))
 		return 0;
-	
+
 	// stop recording when we change map
 	m_DemoRecorder.Stop();
-	
+
 	// reinit snapshot ids
 	m_IDPool.TimeoutIDs();
-	
+
 	// get the crc of the map
 	m_CurrentMapCrc = m_pMap->Crc();
 	char aBufMsg[256];
 	str_format(aBufMsg, sizeof(aBufMsg), "%s crc is %08x", aBuf, m_CurrentMapCrc);
 	Console()->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "server", aBufMsg);
-		
+
 	str_copy(m_aCurrentMap, pMapName, sizeof(m_aCurrentMap));
 	//map_set(df);
-	
+
 	// load compelate map into memory for download
 	{
 		IOHANDLE File = Storage()->OpenFile(aBuf, IOFLAG_READ, IStorage::TYPE_ALL);
@@ -1109,7 +1109,7 @@ int CServer::Run()
 		dbg_msg("server", "failed to load map. mapname='%s'", g_Config.m_SvMap);
 		return -1;
 	}
-	
+
 	// start server
 	NETADDR BindAddr;
 	if(g_Config.m_SvBindaddr[0] && net_host_lookup(g_Config.m_SvBindaddr, &BindAddr, NETTYPE_ALL) == 0)
@@ -1123,8 +1123,8 @@ int CServer::Run()
 		BindAddr.type = NETTYPE_ALL;
 		BindAddr.port = g_Config.m_SvPort;
 	}
-	
-	
+
+
 	if(!m_NetServer.Open(BindAddr, g_Config.m_SvMaxClients, g_Config.m_SvMaxClientsPerIP, 0))
 	{
 		dbg_msg("server", "couldn't open socket. port might already be in use");
@@ -1132,11 +1132,11 @@ int CServer::Run()
 	}
 
 	m_NetServer.SetCallbacks(NewClientCallback, DelClientCallback, this);
-	
+
 	char aBuf[256];
 	str_format(aBuf, sizeof(aBuf), "server name is '%s'", g_Config.m_SvName);
 	Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
-	
+
 	GameServer()->OnInit();
 	str_format(aBuf, sizeof(aBuf), "version %s", GameServer()->NetVersion());
 	Console()->Print(IConsole::OUTPUT_LEVEL_STANDARD, "server", aBuf);
@@ -1148,10 +1148,10 @@ int CServer::Run()
 	{
 		int64 ReportTime = time_get();
 		int ReportInterval = 3;
-	
+
 		m_Lastheartbeat = 0;
 		m_GameStartTime = time_get();
-	
+
 		if(g_Config.m_Debug)
 		{
 			str_format(aBuf, sizeof(aBuf), "baseline memory usage %dk", mem_stats()->allocated/1024);
@@ -1162,28 +1162,28 @@ int CServer::Run()
 		{
 			int64 t = time_get();
 			int NewTicks = 0;
-			
+
 			// load new map TODO: don't poll this
 			if(str_comp(g_Config.m_SvMap, m_aCurrentMap) != 0 || m_MapReload)
 			{
 				m_MapReload = 0;
-				
+
 				// load map
 				if(LoadMap(g_Config.m_SvMap))
 				{
 					// new map loaded
 					GameServer()->OnShutdown();
-					
+
 					for(int c = 0; c < MAX_CLIENTS; c++)
 					{
 						if(m_aClients[c].m_State <= CClient::STATE_AUTH)
 							continue;
-						
+
 						SendMap(c);
 						m_aClients[c].Reset();
 						m_aClients[c].m_State = CClient::STATE_CONNECTING;
 					}
-					
+
 					m_GameStartTime = time_get();
 					m_CurrentGameTick = 0;
 					Kernel()->ReregisterInterface(GameServer());
@@ -1197,12 +1197,12 @@ int CServer::Run()
 					str_copy(g_Config.m_SvMap, m_aCurrentMap, sizeof(g_Config.m_SvMap));
 				}
 			}
-			
+
 			while(t > TickStartTime(m_CurrentGameTick+1))
 			{
 				m_CurrentGameTick++;
 				NewTicks++;
-				
+
 				// apply new input
 				for(int c = 0; c < MAX_CLIENTS; c++)
 				{
@@ -1221,19 +1221,19 @@ int CServer::Run()
 
 				GameServer()->OnTick();
 			}
-			
+
 			// snap game
 			if(NewTicks)
 			{
 				if(g_Config.m_SvHighBandwidth || (m_CurrentGameTick%2) == 0)
 					DoSnapshot();
 			}
-			
+
 			// master server stuff
 			m_Register.RegisterUpdate(BindAddr.type);
-	
+
 			PumpNetwork();
-	
+
 			if(ReportTime < time_get())
 			{
 				if(g_Config.m_Debug)
@@ -1242,23 +1242,23 @@ int CServer::Run()
 					static NETSTATS prev_stats;
 					NETSTATS stats;
 					netserver_stats(net, &stats);
-					
+
 					perf_next();
-					
+
 					if(config.dbg_pref)
 						perf_dump(&rootscope);
 
 					dbg_msg("server", "send=%8d recv=%8d",
 						(stats.send_bytes - prev_stats.send_bytes)/reportinterval,
 						(stats.recv_bytes - prev_stats.recv_bytes)/reportinterval);
-						
+
 					prev_stats = stats;
 					*/
 				}
-	
+
 				ReportTime += time_freq()*ReportInterval;
 			}
-			
+
 			// wait for incomming data
 			net_socket_read_wait(m_NetServer.Socket(), 5);
 		}
@@ -1296,14 +1296,14 @@ void CServer::ConBan(IConsole::IResult *pResult, void *pUser)
 	CServer *pServer = (CServer *)pUser;
 	const char *pStr = pResult->GetString(0);
 	int Minutes = 30;
-  	const char *pReason = "No reason given";
-	
+	const char *pReason = "No reason given";
+
 	if(pResult->NumArguments() > 1)
 		Minutes = pResult->GetInteger(1);
-	
+
 	if(pResult->NumArguments() > 2)
 		pReason = pResult->GetString(2);
-	
+
 	if(net_addr_from_str(&Addr, pStr) == 0)
 	{
 		if(pServer->m_RconClientID >= 0 && pServer->m_RconClientID < MAX_CLIENTS && pServer->m_aClients[pServer->m_RconClientID].m_State != CClient::STATE_EMPTY)
@@ -1348,7 +1348,7 @@ void CServer::ConUnban(IConsole::IResult *pResult, void *pUser)
 	NETADDR Addr;
 	CServer *pServer = (CServer *)pUser;
 	const char *pStr = pResult->GetString(0);
-	
+
 	if(net_addr_from_str(&Addr, pStr) == 0 && !pServer->BanRemove(Addr))
 	{
 		char aAddrStr[NETADDR_MAXSTRSIZE];
@@ -1384,7 +1384,7 @@ void CServer::ConBans(IConsole::IResult *pResult, void *pUser)
 	char aBuf[1024];
 	char aAddrStr[NETADDR_MAXSTRSIZE];
 	CServer* pServer = (CServer *)pUser;
-	
+
 	int Num = pServer->m_NetServer.BanNum();
 	for(int i = 0; i < Num; i++)
 	{
@@ -1392,7 +1392,7 @@ void CServer::ConBans(IConsole::IResult *pResult, void *pUser)
 		pServer->m_NetServer.BanGet(i, &Info);
 		NETADDR Addr = Info.m_Addr;
 		net_addr_str(&Addr, aAddrStr, sizeof(aAddrStr));
-		
+
 		if(Info.m_Expires == -1)
 		{
 			str_format(aBuf, sizeof(aBuf), "#%i %s for life", i, aAddrStr);
@@ -1480,7 +1480,7 @@ void CServer::ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pU
 void CServer::RegisterCommands()
 {
 	m_pConsole = Kernel()->RequestInterface<IConsole>();
-	
+
 	Console()->Register("kick", "i?r", CFGFLAG_SERVER, ConKick, this, "");
 	Console()->Register("ban", "s?ir", CFGFLAG_SERVER|CFGFLAG_STORE, ConBan, this, "");
 	Console()->Register("unban", "s", CFGFLAG_SERVER|CFGFLAG_STORE, ConUnban, this, "");
@@ -1490,14 +1490,14 @@ void CServer::RegisterCommands()
 
 	Console()->Register("record", "?s", CFGFLAG_SERVER|CFGFLAG_STORE, ConRecord, this, "");
 	Console()->Register("stoprecord", "", CFGFLAG_SERVER, ConStopRecord, this, "");
-	
+
 	Console()->Register("reload", "", CFGFLAG_SERVER, ConMapReload, this, "");
 
 	Console()->Chain("sv_name", ConchainSpecialInfoupdate, this);
 	Console()->Chain("password", ConchainSpecialInfoupdate, this);
 
 	Console()->Chain("sv_max_clients_per_ip", ConchainMaxclientsperipUpdate, this);
-}	
+}
 
 
 int CServer::SnapNewID()
@@ -1515,7 +1515,7 @@ void *CServer::SnapNewItem(int Type, int ID, int Size)
 {
 	dbg_assert(Type >= 0 && Type <=0xffff, "incorrect type");
 	dbg_assert(ID >= 0 && ID <=0xffff, "incorrect id");
-	return ID < 0 ? 0 : m_SnapshotBuilder.NewItem(Type, ID, Size);		
+	return ID < 0 ? 0 : m_SnapshotBuilder.NewItem(Type, ID, Size);
 }
 
 void CServer::SnapSetStaticsize(int ItemType, int Size)
@@ -1549,7 +1549,7 @@ int main(int argc, const char **argv) // ignore_convention
 	IEngineMasterServer *pEngineMasterServer = CreateEngineMasterServer();
 	IStorage *pStorage = CreateStorage("Teeworlds", argc, argv); // ignore_convention
 	IConfig *pConfig = CreateConfig();
-	
+
 	pServer->InitRegister(&pServer->m_NetServer, pEngineMasterServer, pConsole);
 
 	{
@@ -1565,20 +1565,20 @@ int main(int argc, const char **argv) // ignore_convention
 		RegisterFail = RegisterFail || !pKernel->RegisterInterface(pConfig);
 		RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IEngineMasterServer*>(pEngineMasterServer)); // register as both
 		RegisterFail = RegisterFail || !pKernel->RegisterInterface(static_cast<IMasterServer*>(pEngineMasterServer));
-		
+
 		if(RegisterFail)
 			return -1;
 	}
-	
+
 	pEngine->Init();
 	pConfig->Init();
 	pEngineMasterServer->Init();
 	pEngineMasterServer->Load();
-		
+
 	// register all console commands
 	pServer->RegisterCommands();
 	pGameServer->OnConsoleInit();
-	
+
 	// execute autoexec file
 	pConsole->ExecuteFile("autoexec.cfg");
 
@@ -1588,13 +1588,13 @@ int main(int argc, const char **argv) // ignore_convention
 
 	// restore empty config strings to their defaults
 	pConfig->RestoreStrings();
-	
+
 	pEngine->InitLogfile();
 
 	// run the server
 	dbg_msg("server", "starting...");
 	pServer->Run();
-	
+
 	// free
 	delete pServer;
 	delete pKernel;
diff --git a/src/engine/server/server.h b/src/engine/server/server.h
index 66cac91f..9a68c9fe 100644
--- a/src/engine/server/server.h
+++ b/src/engine/server/server.h
@@ -21,17 +21,17 @@ class CSnapIDPool
 	};
 
 	CID m_aIDs[MAX_IDS];
-		
+
 	int m_FirstFree;
 	int m_FirstTimed;
 	int m_LastTimed;
 	int m_Usage;
 	int m_InUsage;
-	
-public:	
+
+public:
 
 	CSnapIDPool();
-	
+
 	void Reset();
 	void RemoveFirstTimeout();
 	int NewID();
@@ -52,7 +52,7 @@ public:
 	class CClient
 	{
 	public:
-	
+
 		enum
 		{
 			STATE_EMPTY = 0,
@@ -60,49 +60,49 @@ public:
 			STATE_CONNECTING,
 			STATE_READY,
 			STATE_INGAME,
-			
+
 			SNAPRATE_INIT=0,
 			SNAPRATE_FULL,
 			SNAPRATE_RECOVER
 		};
-	
+
 		class CInput
 		{
 		public:
 			int m_aData[MAX_INPUT_SIZE];
 			int m_GameTick; // the tick that was chosen for the input
 		};
-	
+
 		// connection state info
 		int m_State;
 		int m_Latency;
 		int m_SnapRate;
-		
+
 		int m_LastAckedSnapshot;
 		int m_LastInputTick;
 		CSnapshotStorage m_Snapshots;
-		
+
 		CInput m_LatestInput;
 		CInput m_aInputs[200]; // TODO: handle input better
 		int m_CurrentInput;
-		
+
 		char m_aName[MAX_NAME_LENGTH];
 		char m_aClan[MAX_CLAN_LENGTH];
 		int m_Country;
 		int m_Score;
 		int m_Authed;
 		int m_AuthTries;
-		
+
 		void Reset();
 	};
-	
+
 	CClient m_aClients[MAX_CLIENTS];
 
 	CSnapshotDelta m_SnapshotDelta;
 	CSnapshotBuilder m_SnapshotBuilder;
 	CSnapIDPool m_IDPool;
 	CNetServer m_NetServer;
-	
+
 	IEngineMap *m_pMap;
 
 	int64 m_GameStartTime;
@@ -117,14 +117,14 @@ public:
 	char m_aCurrentMap[64];
 	unsigned m_CurrentMapCrc;
 	unsigned char *m_pCurrentMapData;
-	int m_CurrentMapSize;	
-	
+	int m_CurrentMapSize;
+
 	CDemoRecorder m_DemoRecorder;
 	CRegister m_Register;
 	CMapChecker m_MapChecker;
-	
+
 	CServer();
-	
+
 	int TrySetClientName(int ClientID, const char *pName);
 
 	virtual void SetClientName(int ClientID, const char *pName);
@@ -162,15 +162,15 @@ public:
 	void SendConnectionReady(int ClientID);
 	void SendRconLine(int ClientID, const char *pLine);
 	static void SendRconLineAuthed(const char *pLine, void *pUser);
-	
+
 	void ProcessClientPacket(CNetChunk *pPacket);
-		
+
 	void SendServerInfo(NETADDR *pAddr, int Token);
 	void UpdateServerInfo();
 
 	int BanAdd(NETADDR Addr, int Seconds, const char *pReason);
 	int BanRemove(NETADDR Addr);
-		
+
 
 	void PumpNetwork();
 
@@ -193,8 +193,8 @@ public:
 	static void ConchainMaxclientsperipUpdate(IConsole::IResult *pResult, void *pUserData, IConsole::FCommandCallback pfnCallback, void *pCallbackUserData);
 
 	void RegisterCommands();
-	
-	
+
+
 	virtual int SnapNewID();
 	virtual void SnapFreeID(int ID);
 	virtual void *SnapNewItem(int Type, int ID, int Size);
diff --git a/src/engine/serverbrowser.h b/src/engine/serverbrowser.h
index 1ac22056..3ca59f9c 100644
--- a/src/engine/serverbrowser.h
+++ b/src/engine/serverbrowser.h
@@ -28,11 +28,11 @@ public:
 
 	int m_SortedIndex;
 	int m_ServerIndex;
-	
+
 	NETADDR m_NetAddr;
-	
+
 	int m_QuickSearchHit;
-	
+
 	int m_MaxClients;
 	int m_NumClients;
 	int m_MaxPlayers;
@@ -66,11 +66,11 @@ public:
 		SORT_MAP,
 		SORT_GAMETYPE,
 		SORT_NUMPLAYERS,
-		
+
 		QUICK_SERVERNAME=1,
 		QUICK_PLAYER=2,
 		QUICK_MAPNAME=4,
-		
+
 		TYPE_INTERNET = 0,
 		TYPE_LAN = 1,
 		TYPE_FAVORITES = 2,
@@ -84,12 +84,12 @@ public:
 	virtual bool IsRefreshing() const = 0;
 	virtual bool IsRefreshingMasters() const = 0;
 	virtual int LoadingProgression() const = 0;
-	
+
 	virtual int NumServers() const = 0;
-	
+
 	virtual int NumSortedServers() const = 0;
 	virtual const CServerInfo *SortedGet(int Index) const = 0;
-	
+
 	virtual bool IsFavorite(const NETADDR &Addr) const = 0;
 	virtual void AddFavorite(const NETADDR &Addr) = 0;
 	virtual void RemoveFavorite(const NETADDR &Addr) = 0;
diff --git a/src/engine/shared/compression.cpp b/src/engine/shared/compression.cpp
index f14e1cc4..40fe28c4 100644
--- a/src/engine/shared/compression.cpp
+++ b/src/engine/shared/compression.cpp
@@ -4,9 +4,9 @@
 
 #include "compression.h"
 
-// Format: ESDDDDDD EDDDDDDD EDD...  Extended, Data, Sign
-unsigned char *CVariableInt::Pack(unsigned char *pDst, int i) 
-{ 
+// Format: ESDDDDDD EDDDDDDD EDD... Extended, Data, Sign
+unsigned char *CVariableInt::Pack(unsigned char *pDst, int i)
+{
 	*pDst = (i>>25)&0x40; // set sign bit if i<0
 	i = i^(i>>31); // if(i<0) i = ~i
 
@@ -27,16 +27,16 @@ unsigned char *CVariableInt::Pack(unsigned char *pDst, int i)
 	}
 
 	pDst++;
-	return pDst; 
-} 
- 
+	return pDst;
+}
+
 const unsigned char *CVariableInt::Unpack(const unsigned char *pSrc, int *pInOut)
-{ 
-	int Sign = (*pSrc>>6)&1; 
-	*pInOut = *pSrc&0x3F; 
+{
+	int Sign = (*pSrc>>6)&1;
+	*pInOut = *pSrc&0x3F;
 
 	do
-	{ 
+	{
 		if(!(*pSrc&0x80)) break;
 		pSrc++;
 		*pInOut |= (*pSrc&(0x7F))<<(6);
@@ -56,8 +56,8 @@ const unsigned char *CVariableInt::Unpack(const unsigned char *pSrc, int *pInOut
 
 	pSrc++;
 	*pInOut ^= -Sign; // if(sign) *i = ~(*i)
-	return pSrc; 
-} 
+	return pSrc;
+}
 
 
 long CVariableInt::Decompress(const void *pSrc_, int Size, void *pDst_)
diff --git a/src/engine/shared/config.cpp b/src/engine/shared/config.cpp
index f531fa5a..b9aa1320 100644
--- a/src/engine/shared/config.cpp
+++ b/src/engine/shared/config.cpp
@@ -10,21 +10,21 @@ class CConfig : public IConfig
 {
 	IStorage *m_pStorage;
 	IOHANDLE m_ConfigFile;
-	
+
 	struct CCallback
 	{
 		SAVECALLBACKFUNC m_pfnFunc;
 		void *m_pUserData;
 	};
-	
+
 	enum
 	{
 		MAX_CALLBACKS = 16
 	};
-	
+
 	CCallback m_aCallbacks[MAX_CALLBACKS];
 	int m_NumCallbacks;
-	
+
 	void EscapeParam(char *pDst, const char *pSrc, int size)
 	{
 		for(int i = 0; *pSrc && i < size - 1; ++i)
@@ -43,22 +43,22 @@ public:
 		m_ConfigFile = 0;
 		m_NumCallbacks = 0;
 	}
-	
+
 	virtual void Init()
 	{
 		m_pStorage = Kernel()->RequestInterface<IStorage>();
 		Reset();
 	}
-	
+
 	virtual void Reset()
 	{
 		#define MACRO_CONFIG_INT(Name,ScriptName,def,min,max,flags,desc) g_Config.m_##Name = def;
 		#define MACRO_CONFIG_STR(Name,ScriptName,len,def,flags,desc) str_copy(g_Config.m_##Name, def, len);
 
-		#include "config_variables.h" 
+		#include "config_variables.h"
 
-		#undef MACRO_CONFIG_INT 
-		#undef MACRO_CONFIG_STR 		
+		#undef MACRO_CONFIG_INT
+		#undef MACRO_CONFIG_STR
 	}
 
 	virtual void RestoreStrings()
@@ -71,34 +71,34 @@ public:
 		#undef MACRO_CONFIG_INT
 		#undef MACRO_CONFIG_STR
 	}
-	
+
 	virtual void Save()
 	{
 		if(!m_pStorage)
 			return;
 		m_ConfigFile = m_pStorage->OpenFile("settings.cfg", IOFLAG_WRITE, IStorage::TYPE_SAVE);
-		
+
 		if(!m_ConfigFile)
 			return;
-		
+
 		char aLineBuf[1024*2];
 		char aEscapeBuf[1024*2];
 
 		#define MACRO_CONFIG_INT(Name,ScriptName,def,min,max,flags,desc) if((flags)&CFGFLAG_SAVE){ str_format(aLineBuf, sizeof(aLineBuf), "%s %i", #ScriptName, g_Config.m_##Name); WriteLine(aLineBuf); }
 		#define MACRO_CONFIG_STR(Name,ScriptName,len,def,flags,desc) if((flags)&CFGFLAG_SAVE){ EscapeParam(aEscapeBuf, g_Config.m_##Name, sizeof(aEscapeBuf)); str_format(aLineBuf, sizeof(aLineBuf), "%s \"%s\"", #ScriptName, aEscapeBuf); WriteLine(aLineBuf); }
 
-		#include "config_variables.h" 
+		#include "config_variables.h"
+
+		#undef MACRO_CONFIG_INT
+		#undef MACRO_CONFIG_STR
 
-		#undef MACRO_CONFIG_INT 
-		#undef MACRO_CONFIG_STR 				
-		
 		for(int i = 0; i < m_NumCallbacks; i++)
 			m_aCallbacks[i].m_pfnFunc(this, m_aCallbacks[i].m_pUserData);
-		
+
 		io_close(m_ConfigFile);
 		m_ConfigFile = 0;
 	}
-	
+
 	virtual void RegisterCallback(SAVECALLBACKFUNC pfnFunc, void *pUserData)
 	{
 		dbg_assert(m_NumCallbacks < MAX_CALLBACKS, "too many config callbacks");
@@ -106,7 +106,7 @@ public:
 		m_aCallbacks[m_NumCallbacks].m_pUserData = pUserData;
 		m_NumCallbacks++;
 	}
-	
+
 	virtual void WriteLine(const char *pLine)
 	{
 		if(!m_ConfigFile)
@@ -117,7 +117,7 @@ public:
 		static const char Newline[] = "\n";
 #endif
 		io_write(m_ConfigFile, pLine, str_length(pLine));
-		io_write(m_ConfigFile, Newline, sizeof(Newline)-1);			
+		io_write(m_ConfigFile, Newline, sizeof(Newline)-1);
 	}
 };
 
diff --git a/src/engine/shared/config.h b/src/engine/shared/config.h
index 9a524d22..ed89daa2 100644
--- a/src/engine/shared/config.h
+++ b/src/engine/shared/config.h
@@ -4,12 +4,12 @@
 #define ENGINE_SHARED_CONFIG_H
 
 struct CConfiguration
-{ 
-    #define MACRO_CONFIG_INT(Name,ScriptName,Def,Min,Max,Save,Desc) int m_##Name;
-    #define MACRO_CONFIG_STR(Name,ScriptName,Len,Def,Save,Desc) char m_##Name[Len]; // Flawfinder: ignore
-    #include "config_variables.h" 
-    #undef MACRO_CONFIG_INT 
-    #undef MACRO_CONFIG_STR 
+{
+	#define MACRO_CONFIG_INT(Name,ScriptName,Def,Min,Max,Save,Desc) int m_##Name;
+	#define MACRO_CONFIG_STR(Name,ScriptName,Len,Def,Save,Desc) char m_##Name[Len]; // Flawfinder: ignore
+	#include "config_variables.h"
+	#undef MACRO_CONFIG_INT
+	#undef MACRO_CONFIG_STR
 };
 
 extern CConfiguration g_Config;
diff --git a/src/engine/shared/config_variables.h b/src/engine/shared/config_variables.h
index 8dec2102..eb7f9ca7 100644
--- a/src/engine/shared/config_variables.h
+++ b/src/engine/shared/config_variables.h
@@ -56,7 +56,7 @@ MACRO_CONFIG_INT(SndNonactiveMute, snd_nonactive_mute, 0, 0, 1, CFGFLAG_SAVE|CFG
 MACRO_CONFIG_INT(GfxScreenWidth, gfx_screen_width, 800, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution width")
 MACRO_CONFIG_INT(GfxScreenHeight, gfx_screen_height, 600, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Screen resolution height")
 MACRO_CONFIG_INT(GfxFullscreen, gfx_fullscreen, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Fullscreen")
-MACRO_CONFIG_INT(GfxAlphabits, gfx_alphabits, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Alpha bits for framebuffer  (fullscreen only)")
+MACRO_CONFIG_INT(GfxAlphabits, gfx_alphabits, 0, 0, 0, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Alpha bits for framebuffer (fullscreen only)")
 MACRO_CONFIG_INT(GfxColorDepth, gfx_color_depth, 24, 16, 24, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Colors bits for framebuffer (fullscreen only)")
 MACRO_CONFIG_INT(GfxClear, gfx_clear, 0, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Clear screen before rendering")
 MACRO_CONFIG_INT(GfxVsync, gfx_vsync, 1, 0, 1, CFGFLAG_SAVE|CFGFLAG_CLIENT, "Vertical sync")
diff --git a/src/engine/shared/console.cpp b/src/engine/shared/console.cpp
index 3241d05d..032ff2ae 100644
--- a/src/engine/shared/console.cpp
+++ b/src/engine/shared/console.cpp
@@ -38,21 +38,21 @@ int CConsole::ParseStart(CResult *pResult, const char *pString, int Length)
 	int Len = sizeof(pResult->m_aStringStorage);
 	if(Length < Len)
 		Len = Length;
-		
+
 	str_copy(pResult->m_aStringStorage, pString, Length);
 	pStr = pResult->m_aStringStorage;
-	
+
 	// get command
 	pStr = str_skip_whitespaces(pStr);
 	pResult->m_pCommand = pStr;
 	pStr = str_skip_to_whitespace(pStr);
-	
+
 	if(*pStr)
 	{
 		pStr[0] = 0;
 		pStr++;
 	}
-	
+
 	pResult->m_pArgsStart = pStr;
 	return 0;
 }
@@ -63,38 +63,38 @@ int CConsole::ParseArgs(CResult *pResult, const char *pFormat)
 	char *pStr;
 	int Optional = 0;
 	int Error = 0;
-	
+
 	pStr = pResult->m_pArgsStart;
 
-	while(1)	
+	while(1)
 	{
 		// fetch command
 		Command = *pFormat;
 		pFormat++;
-		
+
 		if(!Command)
 			break;
-		
+
 		if(Command == '?')
 			Optional = 1;
 		else
 		{
 			pStr = str_skip_whitespaces(pStr);
-		
+
 			if(!(*pStr)) // error, non optional command needs value
 			{
 				if(!Optional)
 					Error = 1;
 				break;
 			}
-			
+
 			// add token
 			if(*pStr == '"')
 			{
 				char *pDst;
 				pStr++;
 				pResult->AddArgument(pStr);
-				
+
 				pDst = pStr; // we might have to process escape data
 				while(1)
 				{
@@ -109,22 +109,22 @@ int CConsole::ParseArgs(CResult *pResult, const char *pFormat)
 					}
 					else if(pStr[0] == 0)
 						return 1; // return error
-						
+
 					*pDst = *pStr;
 					pDst++;
 					pStr++;
 				}
-				
+
 				// write null termination
 				*pDst = 0;
 
-				
+
 				pStr++;
 			}
 			else
 			{
 				pResult->AddArgument(pStr);
-				
+
 				if(Command == 'r') // rest of the string
 					break;
 				else if(Command == 'i') // validate int
@@ -167,14 +167,14 @@ bool CConsole::LineIsValid(const char *pStr)
 {
 	if(!pStr || *pStr == 0)
 		return false;
-	
+
 	do
 	{
 		CResult Result;
 		const char *pEnd = pStr;
 		const char *pNextPart = 0;
 		int InString = 0;
-		
+
 		while(*pEnd)
 		{
 			if(*pEnd == '"')
@@ -186,25 +186,25 @@ bool CConsole::LineIsValid(const char *pStr)
 			}
 			else if(!InString)
 			{
-				if(*pEnd == ';')  // command separator
+				if(*pEnd == ';') // command separator
 				{
 					pNextPart = pEnd+1;
 					break;
 				}
-				else if(*pEnd == '#')  // comment, no need to do anything more
+				else if(*pEnd == '#') // comment, no need to do anything more
 					break;
 			}
-			
+
 			pEnd++;
 		}
-		
+
 		if(ParseStart(&Result, pStr, (pEnd-pStr) + 1) != 0)
 			return false;
 
 		CCommand *pCommand = FindCommand(Result.m_pCommand, m_FlagMask);
 		if(!pCommand || ParseArgs(&Result, pCommand->m_pParams))
 			return false;
-		
+
 		pStr = pNextPart;
 	}
 	while(pStr && *pStr);
@@ -213,14 +213,14 @@ bool CConsole::LineIsValid(const char *pStr)
 }
 
 void CConsole::ExecuteLineStroked(int Stroke, const char *pStr)
-{	
+{
 	while(pStr && *pStr)
 	{
 		CResult Result;
 		const char *pEnd = pStr;
 		const char *pNextPart = 0;
 		int InString = 0;
-		
+
 		while(*pEnd)
 		{
 			if(*pEnd == '"')
@@ -232,18 +232,18 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr)
 			}
 			else if(!InString)
 			{
-				if(*pEnd == ';')  // command separator
+				if(*pEnd == ';') // command separator
 				{
 					pNextPart = pEnd+1;
 					break;
 				}
-				else if(*pEnd == '#')  // comment, no need to do anything more
+				else if(*pEnd == '#') // comment, no need to do anything more
 					break;
 			}
-			
+
 			pEnd++;
 		}
-		
+
 		if(ParseStart(&Result, pStr, (pEnd-pStr) + 1) != 0)
 			return;
 
@@ -258,7 +258,7 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr)
 				Result.AddArgument(m_paStrokeStr[Stroke]);
 				IsStrokeCommand = 1;
 			}
-			
+
 			if(Stroke || IsStrokeCommand)
 			{
 				if(ParseArgs(&Result, pCommand->m_pParams))
@@ -284,7 +284,7 @@ void CConsole::ExecuteLineStroked(int Stroke, const char *pStr)
 			str_format(aBuf, sizeof(aBuf), "No such command: %s.", Result.m_pCommand);
 			Print(OUTPUT_LEVEL_STANDARD, "Console", aBuf);
 		}
-		
+
 		pStr = pNextPart;
 	}
 }
@@ -299,7 +299,7 @@ void CConsole::PossibleCommands(const char *pStr, int FlagMask, FPossibleCallbac
 			if(str_find_nocase(pCommand->m_pName, pStr))
 				pfnCallback(pCommand->m_pName, pUser);
 		}
-	}	
+	}
 }
 
 CConsole::CCommand *CConsole::FindCommand(const char *pName, int FlagMask)
@@ -312,8 +312,8 @@ CConsole::CCommand *CConsole::FindCommand(const char *pName, int FlagMask)
 			if(str_comp_nocase(pCommand->m_pName, pName) == 0)
 				return pCommand;
 		}
-	}	
-	
+	}
+
 	return 0x0;
 }
 
@@ -335,7 +335,7 @@ void CConsole::ExecuteFile(const char *pFilename)
 		m_pStorage = Kernel()->RequestInterface<IStorage>();
 	if(!m_pStorage)
 		return;
-		
+
 	// push this one to the stack
 	CExecFile ThisFile;
 	CExecFile *pPrev = m_pFirstExec;
@@ -345,13 +345,13 @@ void CConsole::ExecuteFile(const char *pFilename)
 
 	// exec the file
 	IOHANDLE File = m_pStorage->OpenFile(pFilename, IOFLAG_READ, IStorage::TYPE_ALL);
-	
+
 	char aBuf[256];
 	if(File)
 	{
 		char *pLine;
 		CLineReader lr;
-		
+
 		str_format(aBuf, sizeof(aBuf), "executing '%s'", pFilename);
 		Print(IConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf);
 		lr.Init(File);
@@ -366,7 +366,7 @@ void CConsole::ExecuteFile(const char *pFilename)
 		str_format(aBuf, sizeof(aBuf), "failed to open '%s'", pFilename);
 		Print(IConsole::OUTPUT_LEVEL_STANDARD, "console", aBuf);
 	}
-	
+
 	m_pFirstExec = pPrev;
 }
 
@@ -402,7 +402,7 @@ static void IntVariableCommand(IConsole::IResult *pResult, void *pUserData)
 	if(pResult->NumArguments())
 	{
 		int Val = pResult->GetInteger(0);
-		
+
 		// do clamping
 		if(pData->m_Min != pData->m_Max)
 		{
@@ -468,30 +468,30 @@ CConsole::CConsole(int FlagMask)
 	m_pFirstExec = 0;
 	m_pPrintCallbackUserdata = 0;
 	m_pfnPrintCallback = 0;
-	
+
 	m_pStorage = 0;
-	
+
 	// register some basic commands
 	Register("echo", "r", CFGFLAG_SERVER|CFGFLAG_CLIENT, Con_Echo, this, "Echo the text");
 	Register("exec", "r", CFGFLAG_SERVER|CFGFLAG_CLIENT, Con_Exec, this, "Execute the specified file");
-	
+
 	// TODO: this should disappear
 	#define MACRO_CONFIG_INT(Name,ScriptName,Def,Min,Max,Flags,Desc) \
 	{ \
 		static CIntVariableData Data = { this, &g_Config.m_##Name, Min, Max }; \
 		Register(#ScriptName, "?i", Flags, IntVariableCommand, &Data, Desc); \
 	}
-	
+
 	#define MACRO_CONFIG_STR(Name,ScriptName,Len,Def,Flags,Desc) \
 	{ \
 		static CStrVariableData Data = { this, g_Config.m_##Name, Len }; \
 		Register(#ScriptName, "?r", Flags, StrVariableCommand, &Data, Desc); \
 	}
 
-	#include "config_variables.h" 
+	#include "config_variables.h"
 
-	#undef MACRO_CONFIG_INT 
-	#undef MACRO_CONFIG_STR 	
+	#undef MACRO_CONFIG_INT
+	#undef MACRO_CONFIG_STR
 }
 
 void CConsole::ParseArguments(int NumArgs, const char **ppArguments)
@@ -518,7 +518,7 @@ void CConsole::ParseArguments(int NumArgs, const char **ppArguments)
 	}
 }
 
-void CConsole::Register(const char *pName, const char *pParams, 
+void CConsole::Register(const char *pName, const char *pParams,
 	int Flags, FCommandCallback pfnFunc, void *pUser, const char *pHelp)
 {
 	CCommand *pCommand = (CCommand *)mem_alloc(sizeof(CCommand), sizeof(void*));
@@ -528,8 +528,8 @@ void CConsole::Register(const char *pName, const char *pParams,
 	pCommand->m_pName = pName;
 	pCommand->m_pParams = pParams;
 	pCommand->m_Flags = Flags;
-	
-	
+
+
 	pCommand->m_pNext = m_pFirstCommand;
 	m_pFirstCommand = pCommand;
 }
@@ -543,7 +543,7 @@ void CConsole::Con_Chain(IResult *pResult, void *pUserData)
 void CConsole::Chain(const char *pName, FChainCommandCallback pfnChainFunc, void *pUser)
 {
 	CCommand *pCommand = FindCommand(pName, m_FlagMask);
-	
+
 	if(!pCommand)
 	{
 		char aBuf[256];
@@ -551,7 +551,7 @@ void CConsole::Chain(const char *pName, FChainCommandCallback pfnChainFunc, void
 		Print(IConsole::OUTPUT_LEVEL_DEBUG, "console", aBuf);
 		return;
 	}
-	
+
 	CChain *pChainInfo = (CChain *)mem_alloc(sizeof(CChain), sizeof(void*));
 
 	// store info
@@ -559,7 +559,7 @@ void CConsole::Chain(const char *pName, FChainCommandCallback pfnChainFunc, void
 	pChainInfo->m_pUserData = pUser;
 	pChainInfo->m_pfnCallback = pCommand->m_pfnCallback;
 	pChainInfo->m_pCallbackUserData = pCommand->m_pUserData;
-	
+
 	// chain
 	pCommand->m_pfnCallback = Con_Chain;
 	pCommand->m_pUserData = pChainInfo;
diff --git a/src/engine/shared/console.h b/src/engine/shared/console.h
index a276751a..77c46fb0 100644
--- a/src/engine/shared/console.h
+++ b/src/engine/shared/console.h
@@ -16,7 +16,7 @@ class CConsole : public IConsole
 		FCommandCallback m_pfnCallback;
 		void *m_pUserData;
 	};
-		
+
 
 	class CChain
 	{
@@ -25,8 +25,8 @@ class CConsole : public IConsole
 		FCommandCallback m_pfnCallback;
 		void *m_pCallbackUserData;
 		void *m_pUserData;
-	};	
-	
+	};
+
 	int m_FlagMask;
 	bool m_StoreCommands;
 	const char *m_paStrokeStr[2];
@@ -38,7 +38,7 @@ class CConsole : public IConsole
 		const char *m_pFilename;
 		struct CExecFile *m_pPrev;
 	};
-	
+
 	CExecFile *m_pFirstExec;
 	class IStorage *m_pStorage;
 
@@ -48,22 +48,22 @@ class CConsole : public IConsole
 
 	void ExecuteFileRecurse(const char *pFilename);
 	void ExecuteLineStroked(int Stroke, const char *pStr);
-	
+
 	FPrintCallback m_pfnPrintCallback;
 	void *m_pPrintCallbackUserdata;
 
 	enum
 	{
-		CONSOLE_MAX_STR_LENGTH  = 1024,
+		CONSOLE_MAX_STR_LENGTH = 1024,
 		MAX_PARTS = (CONSOLE_MAX_STR_LENGTH+1)/2
 	};
-	
+
 	class CResult : public IResult
 	{
 	public:
 		char m_aStringStorage[CONSOLE_MAX_STR_LENGTH+1];
 		char *m_pArgsStart;
-		
+
 		const char *m_pCommand;
 		const char *m_apArgs[MAX_PARTS];
 
@@ -89,7 +89,7 @@ class CConsole : public IConsole
 			}
 			return *this;
 		}
-		
+
 		void AddArgument(const char *pArg)
 		{
 			m_apArgs[m_NumArgs++] = pArg;
@@ -99,7 +99,7 @@ class CConsole : public IConsole
 		virtual int GetInteger(unsigned Index);
 		virtual float GetFloat(unsigned Index);
 	};
-	
+
 	int ParseStart(CResult *pResult, const char *pString, int Length);
 	int ParseArgs(CResult *pResult, const char *pFormat);
 
@@ -146,7 +146,7 @@ public:
 	virtual void Register(const char *pName, const char *pParams, int Flags, FCommandCallback pfnFunc, void *pUser, const char *pHelp);
 	virtual void Chain(const char *pName, FChainCommandCallback pfnChainFunc, void *pUser);
 	virtual void StoreCommands(bool Store);
-	
+
 	virtual bool LineIsValid(const char *pStr);
 	virtual void ExecuteLine(const char *pStr);
 	virtual void ExecuteFile(const char *pFilename);
diff --git a/src/engine/shared/datafile.cpp b/src/engine/shared/datafile.cpp
index 74936ea0..3a5a4b1d 100644
--- a/src/engine/shared/datafile.cpp
+++ b/src/engine/shared/datafile.cpp
@@ -75,9 +75,9 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
 	{
 		dbg_msg("datafile", "could not open '%s'", pFilename);
 		return false;
-	}	
-	
-	
+	}
+
+
 	// take the CRC of the file and store it
 	unsigned Crc = 0;
 	{
@@ -85,9 +85,9 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
 		{
 			BUFFER_SIZE = 64*1024
 		};
-		
+
 		unsigned char aBuffer[BUFFER_SIZE];
-		
+
 		while(1)
 		{
 			unsigned Bytes = io_read(File, aBuffer, BUFFER_SIZE);
@@ -95,11 +95,11 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
 				break;
 			Crc = crc32(Crc, aBuffer, Bytes); // ignore_convention
 		}
-		
+
 		io_seek(File, 0, IOSEEK_START);
 	}
-	
-	
+
+
 	// TODO: change this header
 	CDatafileHeader Header;
 	io_read(File, &Header, sizeof(Header));
@@ -113,14 +113,14 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
 	}
 
 #if defined(CONF_ARCH_ENDIAN_BIG)
-	swap_endian(&Header, sizeof(int), sizeof(Header)/sizeof(int));	
+	swap_endian(&Header, sizeof(int), sizeof(Header)/sizeof(int));
 #endif
 	if(Header.m_Version != 3 && Header.m_Version != 4)
 	{
 		dbg_msg("datafile", "wrong version. version=%x", Header.m_Version);
 		return 0;
 	}
-	
+
 	// read in the rest except the data
 	unsigned Size = 0;
 	Size += Header.m_NumItemTypes*sizeof(CDatafileItemType);
@@ -128,7 +128,7 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
 	if(Header.m_Version == 4)
 		Size += Header.m_NumRawData*sizeof(int); // v4 has uncompressed data sizes aswell
 	Size += Header.m_ItemSize;
-	
+
 	unsigned AllocSize = Size;
 	AllocSize += sizeof(CDatafile); // add space for info structure
 	AllocSize += Header.m_NumRawData*sizeof(void*); // add space for data pointers
@@ -140,10 +140,10 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
 	pTmpDataFile->m_pData = (char *)(pTmpDataFile+1)+Header.m_NumRawData*sizeof(char *);
 	pTmpDataFile->m_File = File;
 	pTmpDataFile->m_Crc = Crc;
-	
+
 	// clear the data pointers
 	mem_zero(pTmpDataFile->m_ppDataPtrs, Header.m_NumRawData*sizeof(void*));
-	
+
 	// read types, offsets, sizes and item data
 	unsigned ReadSize = io_read(File, pTmpDataFile->m_pData, Size);
 	if(ReadSize != Size)
@@ -169,12 +169,12 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
 		dbg_msg("datafile", "swaplen=%d", Header.m_Swaplen);
 		dbg_msg("datafile", "item_size=%d", m_pDataFile->m_Header.m_ItemSize);
 	}
-	
+
 	m_pDataFile->m_Info.m_pItemTypes = (CDatafileItemType *)m_pDataFile->m_pData;
 	m_pDataFile->m_Info.m_pItemOffsets = (int *)&m_pDataFile->m_Info.m_pItemTypes[m_pDataFile->m_Header.m_NumItemTypes];
 	m_pDataFile->m_Info.m_pDataOffsets = (int *)&m_pDataFile->m_Info.m_pItemOffsets[m_pDataFile->m_Header.m_NumItems];
 	m_pDataFile->m_Info.m_pDataSizes = (int *)&m_pDataFile->m_Info.m_pDataOffsets[m_pDataFile->m_Header.m_NumRawData];
-	
+
 	if(Header.m_Version == 4)
 		m_pDataFile->m_Info.m_pItemStart = (char *)&m_pDataFile->m_Info.m_pDataSizes[m_pDataFile->m_Header.m_NumRawData];
 	else
@@ -191,7 +191,7 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
 			void *p = datafile_get_data(df, i);
 			dbg_msg("datafile", "%d %d", (int)((char*)p - (char*)(&m_pDataFile->data)), size);
 		}
-			
+
 		for(int i = 0; i < datafile_num_items(df); i++)
 		{
 			int type, id;
@@ -218,7 +218,7 @@ bool CDataFileReader::Open(class IStorage *pStorage, const char *pFilename, int
 		}
 		*/
 	}
-		
+
 	return true;
 }
 
@@ -227,7 +227,7 @@ bool CDataFileReader::GetCrcSize(class IStorage *pStorage, const char *pFilename
 	IOHANDLE File = pStorage->OpenFile(pFilename, IOFLAG_READ, StorageType);
 	if(!File)
 		return false;
-	
+
 	// get crc and size
 	unsigned Crc = 0;
 	unsigned Size = 0;
@@ -240,7 +240,7 @@ bool CDataFileReader::GetCrcSize(class IStorage *pStorage, const char *pFilename
 		Crc = crc32(Crc, aBuffer, Bytes); // ignore_convention
 		Size += Bytes;
 	}
-	
+
 	io_close(File);
 
 	*pCrc = Crc;
@@ -258,23 +258,23 @@ int CDataFileReader::NumData()
 int CDataFileReader::GetDataSize(int Index)
 {
 	if(!m_pDataFile) { return 0; }
-	
+
 	if(Index == m_pDataFile->m_Header.m_NumRawData-1)
 		return m_pDataFile->m_Header.m_DataSize-m_pDataFile->m_Info.m_pDataOffsets[Index];
-	return  m_pDataFile->m_Info.m_pDataOffsets[Index+1]-m_pDataFile->m_Info.m_pDataOffsets[Index];
+	return m_pDataFile->m_Info.m_pDataOffsets[Index+1]-m_pDataFile->m_Info.m_pDataOffsets[Index];
 }
 
 void *CDataFileReader::GetDataImpl(int Index, int Swap)
 {
 	if(!m_pDataFile) { return 0; }
-	
+
 	// load it if needed
 	if(!m_pDataFile->m_ppDataPtrs[Index])
 	{
 		// fetch the data size
 		int DataSize = GetDataSize(Index);
 		int SwapSize = DataSize;
-		
+
 		if(m_pDataFile->m_Header.m_Version == 4)
 		{
 			// v4 has compressed data
@@ -284,7 +284,7 @@ void *CDataFileReader::GetDataImpl(int Index, int Swap)
 
 			dbg_msg("datafile", "loading data index=%d size=%d uncompressed=%d", Index, DataSize, UncompressedSize);
 			m_pDataFile->m_ppDataPtrs[Index] = (char *)mem_alloc(UncompressedSize, 1);
-			
+
 			// read the compressed data
 			io_seek(m_pDataFile->m_File, m_pDataFile->m_DataStartOffset+m_pDataFile->m_Info.m_pDataOffsets[Index], IOSEEK_START);
 			io_read(m_pDataFile->m_File, pTemp, DataSize);
@@ -311,7 +311,7 @@ void *CDataFileReader::GetDataImpl(int Index, int Swap)
 			swap_endian(m_pDataFile->m_ppDataPtrs[Index], sizeof(int), SwapSize/sizeof(int));
 #endif
 	}
-	
+
 	return m_pDataFile->m_ppDataPtrs[Index];
 }
 
@@ -329,7 +329,7 @@ void CDataFileReader::UnloadData(int Index)
 {
 	if(Index < 0)
 		return;
-		
+
 	//
 	mem_free(m_pDataFile->m_ppDataPtrs[Index]);
 	m_pDataFile->m_ppDataPtrs[Index] = 0x0;
@@ -340,13 +340,13 @@ int CDataFileReader::GetItemSize(int Index)
 	if(!m_pDataFile) { return 0; }
 	if(Index == m_pDataFile->m_Header.m_NumItems-1)
 		return m_pDataFile->m_Header.m_ItemSize-m_pDataFile->m_Info.m_pItemOffsets[Index];
-	return  m_pDataFile->m_Info.m_pItemOffsets[Index+1]-m_pDataFile->m_Info.m_pItemOffsets[Index];
+	return m_pDataFile->m_Info.m_pItemOffsets[Index+1]-m_pDataFile->m_Info.m_pItemOffsets[Index];
 }
 
 void *CDataFileReader::GetItem(int Index, int *pType, int *pID)
 {
 	if(!m_pDataFile) { if(pType) *pType = 0; if(pID) *pID = 0; return 0; }
-	
+
 	CDatafileItem *i = (CDatafileItem *)(m_pDataFile->m_Info.m_pItemStart+m_pDataFile->m_Info.m_pItemOffsets[Index]);
 	if(pType)
 		*pType = (i->m_TypeAndID>>16)&0xffff; // remove sign extention
@@ -362,7 +362,7 @@ void CDataFileReader::GetType(int Type, int *pStart, int *pNum)
 
 	if(!m_pDataFile)
 		return;
-	
+
 	for(int i = 0; i < m_pDataFile->m_Header.m_NumItemTypes; i++)
 	{
 		if(m_pDataFile->m_Info.m_pItemTypes[i].m_Type == Type)
@@ -377,7 +377,7 @@ void CDataFileReader::GetType(int Type, int *pStart, int *pNum)
 void *CDataFileReader::FindItem(int Type, int ID)
 {
 	if(!m_pDataFile) return 0;
-	
+
 	int Start, Num;
 	GetType(Type, &Start, &Num);
 	for(int i = 0; i < Num; i++)
@@ -400,12 +400,12 @@ bool CDataFileReader::Close()
 {
 	if(!m_pDataFile)
 		return true;
-	
+
 	// free the data that is loaded
 	int i;
 	for(i = 0; i < m_pDataFile->m_Header.m_NumRawData; i++)
 		mem_free(m_pDataFile->m_ppDataPtrs[i]);
-	
+
 	io_close(m_pDataFile->m_File);
 	mem_free(m_pDataFile);
 	m_pDataFile = 0;
@@ -424,7 +424,7 @@ bool CDataFileWriter::Open(class IStorage *pStorage, const char *pFilename)
 	m_File = pStorage->OpenFile(pFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE);
 	if(!m_File)
 		return false;
-	
+
 	m_NumItems = 0;
 	m_NumDatas = 0;
 	m_NumItemTypes = 0;
@@ -435,7 +435,7 @@ bool CDataFileWriter::Open(class IStorage *pStorage, const char *pFilename)
 		m_aItemTypes[i].m_First = -1;
 		m_aItemTypes[i].m_Last = -1;
 	}
-	
+
 	return true;
 }
 
@@ -450,7 +450,7 @@ int CDataFileWriter::AddItem(int Type, int ID, int Size, void *pData)
 	m_aItems[m_NumItems].m_Type = Type;
 	m_aItems[m_NumItems].m_ID = ID;
 	m_aItems[m_NumItems].m_Size = Size;
-	
+
 	// copy data
 	m_aItems[m_NumItems].m_pData = mem_alloc(Size, 1);
 	mem_copy(m_aItems[m_NumItems].m_pData, pData, Size);
@@ -461,16 +461,16 @@ int CDataFileWriter::AddItem(int Type, int ID, int Size, void *pData)
 	// link
 	m_aItems[m_NumItems].m_Prev = m_aItemTypes[Type].m_Last;
 	m_aItems[m_NumItems].m_Next = -1;
-	
+
 	if(m_aItemTypes[Type].m_Last != -1)
 		m_aItems[m_aItemTypes[Type].m_Last].m_Next = m_NumItems;
 	m_aItemTypes[Type].m_Last = m_NumItems;
-	
+
 	if(m_aItemTypes[Type].m_First == -1)
 		m_aItemTypes[Type].m_First = m_NumItems;
-	
+
 	m_aItemTypes[Type].m_Num++;
-		
+
 	m_NumItems++;
 	return m_NumItems-1;
 }
@@ -491,7 +491,7 @@ int CDataFileWriter::AddData(int Size, void *pData)
 		dbg_msg("datafile", "compression error %d", Result);
 		dbg_assert(0, "zlib error");
 	}
-		
+
 	pInfo->m_UncompressedSize = Size;
 	pInfo->m_CompressedSize = (int)s;
 	pInfo->m_pCompressedData = mem_alloc(pInfo->m_CompressedSize, 1);
@@ -539,23 +539,23 @@ int CDataFileWriter::Finish()
 			dbg_msg("datafile", "item=%d size=%d (%d)", i, m_aItems[i].m_Size, m_aItems[i].m_Size+sizeof(CDatafileItem));
 		ItemSize += m_aItems[i].m_Size + sizeof(CDatafileItem);
 	}
-	
-	
+
+
 	for(int i = 0; i < m_NumDatas; i++)
 		DataSize += m_aDatas[i].m_CompressedSize;
-	
+
 	// calculate the complete size
 	TypesSize = m_NumItemTypes*sizeof(CDatafileItemType);
 	HeaderSize = sizeof(CDatafileHeader);
 	OffsetSize = (m_NumItems + m_NumDatas + m_NumDatas) * sizeof(int); // ItemOffsets, DataOffsets, DataUncompressedSizes
 	FileSize = HeaderSize + TypesSize + OffsetSize + ItemSize + DataSize;
 	SwapSize = FileSize - DataSize;
-	
+
 	(void)SwapSize;
-	
+
 	if(DEBUG)
 		dbg_msg("datafile", "num_m_aItemTypes=%d TypesSize=%d m_aItemsize=%d DataSize=%d", m_NumItemTypes, TypesSize, ItemSize, DataSize);
-	
+
 	// construct Header
 	{
 		Header.m_aID[0] = 'D';
@@ -570,7 +570,7 @@ int CDataFileWriter::Finish()
 		Header.m_NumRawData = m_NumDatas;
 		Header.m_ItemSize = ItemSize;
 		Header.m_DataSize = DataSize;
-		
+
 		// write Header
 		if(DEBUG)
 			dbg_msg("datafile", "HeaderSize=%d", sizeof(Header));
@@ -579,7 +579,7 @@ int CDataFileWriter::Finish()
 #endif
 		io_write(m_File, &Header, sizeof(Header));
 	}
-	
+
 	// write types
 	for(int i = 0, Count = 0; i < 0xffff; i++)
 	{
@@ -599,7 +599,7 @@ int CDataFileWriter::Finish()
 			Count += m_aItemTypes[i].m_Num;
 		}
 	}
-	
+
 	// write item offsets
 	for(int i = 0, Offset = 0; i < 0xffff; i++)
 	{
@@ -617,13 +617,13 @@ int CDataFileWriter::Finish()
 #endif
 				io_write(m_File, &Temp, sizeof(Temp));
 				Offset += m_aItems[k].m_Size + sizeof(CDatafileItem);
-				
+
 				// next
 				k = m_aItems[k].m_Next;
 			}
 		}
 	}
-	
+
 	// write data offsets
 	for(int i = 0, Offset = 0; i < m_NumDatas; i++)
 	{
@@ -648,7 +648,7 @@ int CDataFileWriter::Finish()
 #endif
 		io_write(m_File, &UncompressedSize, sizeof(UncompressedSize));
 	}
-	
+
 	// write m_aItems
 	for(int i = 0; i < 0xffff; i++)
 	{
@@ -663,20 +663,20 @@ int CDataFileWriter::Finish()
 				Item.m_Size = m_aItems[k].m_Size;
 				if(DEBUG)
 					dbg_msg("datafile", "writing item type=%x idx=%d id=%d size=%d", i, k, m_aItems[k].m_ID, m_aItems[k].m_Size);
-				
+
 #if defined(CONF_ARCH_ENDIAN_BIG)
 				swap_endian(&Item, sizeof(int), sizeof(Item)/sizeof(int));
 				swap_endian(m_aItems[k].m_pData, sizeof(int), m_aItems[k].m_Size/sizeof(int));
 #endif
 				io_write(m_File, &Item, sizeof(Item));
 				io_write(m_File, m_aItems[k].m_pData, m_aItems[k].m_Size);
-				
+
 				// next
 				k = m_aItems[k].m_Next;
 			}
 		}
 	}
-	
+
 	// write data
 	for(int i = 0; i < m_NumDatas; i++)
 	{
@@ -690,10 +690,10 @@ int CDataFileWriter::Finish()
 		mem_free(m_aItems[i].m_pData);
 	for(int i = 0; i < m_NumDatas; ++i)
 		mem_free(m_aDatas[i].m_pCompressedData);
-	
+
 	io_close(m_File);
 	m_File = 0;
-	
+
 	if(DEBUG)
 		dbg_msg("datafile", "done");
 	return 0;
diff --git a/src/engine/shared/datafile.h b/src/engine/shared/datafile.h
index 15bed033..46e8ada8 100644
--- a/src/engine/shared/datafile.h
+++ b/src/engine/shared/datafile.h
@@ -11,14 +11,14 @@ class CDataFileReader
 public:
 	CDataFileReader() : m_pDataFile(0) {}
 	~CDataFileReader() { Close(); }
-	
+
 	bool IsOpen() const { return m_pDataFile != 0; }
-	
+
 	bool Open(class IStorage *pStorage, const char *pFilename, int StorageType);
 	bool Close();
 
 	static bool GetCrcSize(class IStorage *pStorage, const char *pFilename, int StorageType, unsigned *pCrc, unsigned *pSize);
-	
+
 	void *GetData(int Index);
 	void *GetDataSwapped(int Index); // makes sure that the data is 32bit LE ints when saved
 	int GetDataSize(int Index);
@@ -30,7 +30,7 @@ public:
 	int NumItems();
 	int NumData();
 	void Unload();
-	
+
 	unsigned Crc();
 };
 
@@ -60,15 +60,15 @@ class CDataFileWriter
 		int m_First;
 		int m_Last;
 	};
-	
+
 	IOHANDLE m_File;
 	int m_NumItems;
 	int m_NumDatas;
 	int m_NumItemTypes;
 	CItemTypeInfo m_aItemTypes[0xffff];
 	CItemInfo m_aItems[1024];
-	CDataInfo m_aDatas[1024];	
-	
+	CDataInfo m_aDatas[1024];
+
 public:
 	CDataFileWriter() : m_File(0) {}
 	bool Open(class IStorage *pStorage, const char *Filename);
diff --git a/src/engine/shared/demo.cpp b/src/engine/shared/demo.cpp
index ac78f22f..e48c2f1e 100644
--- a/src/engine/shared/demo.cpp
+++ b/src/engine/shared/demo.cpp
@@ -47,7 +47,7 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
 		char aBuf[512];
 		str_format(aMapFilename, sizeof(aMapFilename), "%s.map", pMap);
 		if(pStorage->FindFile(aMapFilename, "maps", IStorage::TYPE_ALL, aBuf, sizeof(aBuf)))
-			MapFile =  pStorage->OpenFile(aBuf, IOFLAG_READ, IStorage::TYPE_ALL);
+			MapFile = pStorage->OpenFile(aBuf, IOFLAG_READ, IStorage::TYPE_ALL);
 	}
 	if(!MapFile)
 	{
@@ -67,7 +67,7 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
 		m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demo_recorder", aBuf);
 		return -1;
 	}
-	
+
 	// write header
 	mem_zero(&Header, sizeof(Header));
 	mem_copy(Header.m_aMarker, gs_aHeaderMarker, sizeof(Header.m_aMarker));
@@ -87,7 +87,7 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
 	// Header.m_Length - add this on stop
 	str_timestamp(Header.m_aTimestamp, sizeof(Header.m_aTimestamp));
 	io_write(DemoFile, &Header, sizeof(Header));
-	
+
 	// write map data
 	while(1)
 	{
@@ -98,11 +98,11 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
 		io_write(DemoFile, &aChunk, Bytes);
 	}
 	io_close(MapFile);
-	
+
 	m_LastKeyFrame = -1;
 	m_LastTickMarker = -1;
 	m_FirstTick = -1;
-	
+
 	char aBuf[256];
 	str_format(aBuf, sizeof(aBuf), "Recording to '%s'", pFilename);
 	m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demo_recorder", aBuf);
@@ -113,25 +113,25 @@ int CDemoRecorder::Start(class IStorage *pStorage, class IConsole *pConsole, con
 
 /*
 	Tickmarker
-		7   = Always set
-		6   = Keyframe flag
-		0-5 = Delta tick
-	
+		7	= Always set
+		6	= Keyframe flag
+		0-5	= Delta tick
+
 	Normal
-		7   = Not set
-		5-6 = Type
-		0-4 = Size
+		7 = Not set
+		5-6	= Type
+		0-4	= Size
 */
 
 enum
 {
 	CHUNKTYPEFLAG_TICKMARKER = 0x80,
 	CHUNKTICKFLAG_KEYFRAME = 0x40, // only when tickmarker is set
-	
+
 	CHUNKMASK_TICK = 0x3f,
 	CHUNKMASK_TYPE = 0x60,
 	CHUNKMASK_SIZE = 0x1f,
-	
+
 	CHUNKTYPE_SNAPSHOT = 1,
 	CHUNKTYPE_MESSAGE = 2,
 	CHUNKTYPE_DELTA = 3,
@@ -152,7 +152,7 @@ void CDemoRecorder::WriteTickMarker(int Tick, int Keyframe)
 
 		if(Keyframe)
 			aChunk[0] |= CHUNKTICKFLAG_KEYFRAME;
-		
+
 		io_write(m_File, aChunk, sizeof(aChunk));
 	}
 	else
@@ -160,7 +160,7 @@ void CDemoRecorder::WriteTickMarker(int Tick, int Keyframe)
 		unsigned char aChunk[1];
 		aChunk[0] = CHUNKTYPEFLAG_TICKMARKER | (Tick-m_LastTickMarker);
 		io_write(m_File, aChunk, sizeof(aChunk));
-	}	
+	}
 
 	m_LastTickMarker = Tick;
 	if(m_FirstTick < 0)
@@ -172,7 +172,7 @@ void CDemoRecorder::Write(int Type, const void *pData, int Size)
 	char aBuffer[64*1024];
 	char aBuffer2[64*1024];
 	unsigned char aChunk[3];
-	
+
 	if(!m_File)
 		return;
 
@@ -183,8 +183,8 @@ void CDemoRecorder::Write(int Type, const void *pData, int Size)
 		aBuffer2[Size++] = 0;
 	Size = CVariableInt::Compress(aBuffer2, Size, aBuffer); // buffer2 -> buffer
 	Size = CNetBase::Compress(aBuffer, Size, aBuffer2, sizeof(aBuffer2)); // buffer -> buffer2
-	
-	
+
+
 	aChunk[0] = ((Type&0x3)<<5);
 	if(Size < 30)
 	{
@@ -207,7 +207,7 @@ void CDemoRecorder::Write(int Type, const void *pData, int Size)
 			io_write(m_File, aChunk, 3);
 		}
 	}
-	
+
 	io_write(m_File, aBuffer2, Size);
 }
 
@@ -217,10 +217,10 @@ void CDemoRecorder::RecordSnapshot(int Tick, const void *pData, int Size)
 	{
 		// write full tickmarker
 		WriteTickMarker(Tick, 1);
-		
+
 		// write snapshot
 		Write(CHUNKTYPE_SNAPSHOT, pData, Size);
-			
+
 		m_LastKeyFrame = Tick;
 		mem_copy(m_aLastSnapshotData, pData, Size);
 	}
@@ -232,7 +232,7 @@ void CDemoRecorder::RecordSnapshot(int Tick, const void *pData, int Size)
 
 		// write tickmarker
 		WriteTickMarker(Tick, 0);
-		
+
 		DeltaSize = m_pSnapshotDelta->CreateDelta((CSnapshot*)m_aLastSnapshotData, (CSnapshot*)pData, &aDeltaData);
 		if(DeltaSize)
 		{
@@ -262,7 +262,7 @@ int CDemoRecorder::Stop()
 	aLength[2] = (DemoLength>>8)&0xff;
 	aLength[3] = (DemoLength)&0xff;
 	io_write(m_File, aLength, sizeof(aLength));
-		
+
 	io_close(m_File);
 	m_File = 0;
 	m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demo_recorder", "Stopped recording");
@@ -290,19 +290,19 @@ void CDemoPlayer::SetListner(IListner *pListner)
 int CDemoPlayer::ReadChunkHeader(int *pType, int *pSize, int *pTick)
 {
 	unsigned char Chunk = 0;
-	
+
 	*pSize = 0;
 	*pType = 0;
-	
+
 	if(io_read(m_File, &Chunk, sizeof(Chunk)) != sizeof(Chunk))
 		return -1;
-		
+
 	if(Chunk&CHUNKTYPEFLAG_TICKMARKER)
 	{
 		// decode tick marker
 		int Tickdelta = Chunk&(CHUNKMASK_TICK);
 		*pType = Chunk&(CHUNKTYPEFLAG_TICKMARKER|CHUNKTICKFLAG_KEYFRAME);
-		
+
 		if(Tickdelta == 0)
 		{
 			unsigned char aTickdata[4];
@@ -314,21 +314,21 @@ int CDemoPlayer::ReadChunkHeader(int *pType, int *pSize, int *pTick)
 		{
 			*pTick += Tickdelta;
 		}
-		
+
 	}
 	else
 	{
 		// decode normal chunk
 		*pType = (Chunk&CHUNKMASK_TYPE)>>5;
 		*pSize = Chunk&CHUNKMASK_SIZE;
-		
+
 		if(*pSize == 30)
 		{
 			unsigned char aSizedata[1];
 			if(io_read(m_File, aSizedata, sizeof(aSizedata)) != sizeof(aSizedata))
 				return -1;
 			*pSize = aSizedata[0];
-			
+
 		}
 		else if(*pSize == 31)
 		{
@@ -338,7 +338,7 @@ int CDemoPlayer::ReadChunkHeader(int *pType, int *pSize, int *pTick)
 			*pSize = (aSizedata[1]<<8) | aSizedata[0];
 		}
 	}
-	
+
 	return 0;
 }
 
@@ -358,17 +358,17 @@ void CDemoPlayer::ScanFile()
 	while(1)
 	{
 		long CurrentPos = io_tell(m_File);
-		
+
 		if(ReadChunkHeader(&ChunkType, &ChunkSize, &ChunkTick))
 			break;
-			
+
 		// read the chunk
 		if(ChunkType&CHUNKTYPEFLAG_TICKMARKER)
 		{
 			if(ChunkType&CHUNKTICKFLAG_KEYFRAME)
 			{
 				CKeyFrameSearch *pKey;
-				
+
 				// save the position
 				pKey = (CKeyFrameSearch *)Heap.Allocate(sizeof(CKeyFrameSearch));
 				pKey->m_Frame.m_Filepos = CurrentPos;
@@ -381,21 +381,21 @@ void CDemoPlayer::ScanFile()
 				pCurrentKey = pKey;
 				m_Info.m_SeekablePoints++;
 			}
-			
+
 			if(m_Info.m_Info.m_FirstTick == -1)
 				m_Info.m_Info.m_FirstTick = ChunkTick;
 			m_Info.m_Info.m_LastTick = ChunkTick;
 		}
 		else if(ChunkSize)
 			io_skip(m_File, ChunkSize);
-			
+
 	}
 
 	// copy all the frames to an array instead for fast access
 	m_pKeyFrames = (CKeyFrame*)mem_alloc(m_Info.m_SeekablePoints*sizeof(CKeyFrame), 1);
 	for(pCurrentKey = pFirstKey, i = 0; pCurrentKey; pCurrentKey = pCurrentKey->m_pNext, i++)
 		m_pKeyFrames[i] = pCurrentKey->m_Frame;
-		
+
 	// destroy the temporary heap and seek back to the start
 	io_seek(m_File, StartPos, IOSEEK_START);
 }
@@ -429,7 +429,7 @@ void CDemoPlayer::DoTick()
 				Pause();
 			break;
 		}
-		
+
 		// read the chunk
 		if(ChunkSize)
 		{
@@ -440,7 +440,7 @@ void CDemoPlayer::DoTick()
 				Stop();
 				break;
 			}
-			
+
 			DataSize = CNetBase::Decompress(aCompresseddata, ChunkSize, aDecompressed, sizeof(aDecompressed));
 			if(DataSize < 0)
 			{
@@ -449,7 +449,7 @@ void CDemoPlayer::DoTick()
 				Stop();
 				break;
 			}
-			
+
 			DataSize = CVariableInt::Decompress(aDecompressed, DataSize, aData);
 
 			if(DataSize < 0)
@@ -459,16 +459,16 @@ void CDemoPlayer::DoTick()
 				break;
 			}
 		}
-			
+
 		if(ChunkType == CHUNKTYPE_DELTA)
 		{
 			// process delta snapshot
 			static char aNewsnap[CSnapshot::MAX_SIZE];
-			
+
 			GotSnapshot = 1;
-			
+
 			DataSize = m_pSnapshotDelta->UnpackDelta((CSnapshot*)m_aLastSnapshotData, (CSnapshot*)aNewsnap, aData, DataSize);
-			
+
 			if(DataSize >= 0)
 			{
 				if(m_pListner)
@@ -488,7 +488,7 @@ void CDemoPlayer::DoTick()
 		{
 			// process full snapshot
 			GotSnapshot = 1;
-			
+
 			m_LastSnapshotDataSize = DataSize;
 			mem_copy(m_aLastSnapshotData, aData, DataSize);
 			if(m_pListner)
@@ -502,7 +502,7 @@ void CDemoPlayer::DoTick()
 				GotSnapshot = 1;
 				m_pListner->OnDemoPlayerSnapshot(m_aLastSnapshotData, m_LastSnapshotDataSize);
 			}
-			
+
 			// check the remaining types
 			if(ChunkType&CHUNKTYPEFLAG_TICKMARKER)
 			{
@@ -544,7 +544,7 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
 		m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demo_player", aBuf);
 		return -1;
 	}
-	
+
 	// store the filename
 	str_copy(m_aFilename, pFilename, sizeof(m_aFilename));
 
@@ -556,7 +556,7 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
 	m_Info.m_Info.m_CurrentTick = -1;
 	m_Info.m_PreviousTick = -1;
 	m_Info.m_Info.m_Speed = 1;
-	
+
 	m_LastSnapshotDataSize = -1;
 
 	// read the header
@@ -580,7 +580,7 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
 		m_File = 0;
 		return -1;
 	}
-	
+
 	// get demo type
 	if(!str_comp(m_Info.m_Header.m_aType, "client"))
 		m_DemoType = DEMOTYPE_CLIENT;
@@ -588,17 +588,17 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
 		m_DemoType = DEMOTYPE_SERVER;
 	else
 		m_DemoType = DEMOTYPE_INVALID;
-	
+
 	// read map
 	unsigned MapSize = (m_Info.m_Header.m_aMapSize[0]<<24) | (m_Info.m_Header.m_aMapSize[1]<<16) | (m_Info.m_Header.m_aMapSize[2]<<8) | (m_Info.m_Header.m_aMapSize[3]);
-	
+
 	// check if we already have the map
 	// TODO: improve map checking (maps folder, check crc)
 	unsigned Crc = (m_Info.m_Header.m_aMapCrc[0]<<24) | (m_Info.m_Header.m_aMapCrc[1]<<16) | (m_Info.m_Header.m_aMapCrc[2]<<8) | (m_Info.m_Header.m_aMapCrc[3]);
 	char aMapFilename[128];
 	str_format(aMapFilename, sizeof(aMapFilename), "downloadedmaps/%s_%08x.map", m_Info.m_Header.m_aMapName, Crc);
 	IOHANDLE MapFile = pStorage->OpenFile(aMapFilename, IOFLAG_READ, IStorage::TYPE_ALL);
-		
+
 	if(MapFile)
 	{
 		io_skip(m_File, MapSize);
@@ -609,20 +609,20 @@ int CDemoPlayer::Load(class IStorage *pStorage, class IConsole *pConsole, const
 		// get map data
 		unsigned char *pMapData = (unsigned char *)mem_alloc(MapSize, 1);
 		io_read(m_File, pMapData, MapSize);
-			
+
 		// save map
 		MapFile = pStorage->OpenFile(aMapFilename, IOFLAG_WRITE, IStorage::TYPE_SAVE);
 		io_write(MapFile, pMapData, MapSize);
 		io_close(MapFile);
-			
+
 		// free data
 		mem_free(pMapData);
 	}
-	
-	
+
+
 	// scan the file for interessting points
 	ScanFile();
-	
+
 	// ready for playback
 	return 0;
 }
@@ -638,7 +638,7 @@ int CDemoPlayer::Play()
 	// fill in previous and next tick
 	while(m_Info.m_PreviousTick == -1 && IsPlaying())
 		DoTick();
-		
+
 	// set start info
 	/*m_Info.start_tick = m_Info.previous_tick;
 	m_Info.start_time = time_get();*/
@@ -653,15 +653,15 @@ int CDemoPlayer::SetPos(float Percent)
 	int WantedTick;
 	if(!m_File)
 		return -1;
-	
+
 	// -5 because we have to have a current tick and previous tick when we do the playback
 	WantedTick = m_Info.m_Info.m_FirstTick + (int)((m_Info.m_Info.m_LastTick-m_Info.m_Info.m_FirstTick)*Percent) - 5;
-	
+
 	Keyframe = (int)(m_Info.m_SeekablePoints*Percent);
 
 	if(Keyframe < 0 || Keyframe >= m_Info.m_SeekablePoints)
 		return -1;
-	
+
 	// get correct key frame
 	if(m_pKeyFrames[Keyframe].m_Tick < WantedTick)
 		while(Keyframe < m_Info.m_SeekablePoints-1 && m_pKeyFrames[Keyframe].m_Tick < WantedTick)
@@ -669,7 +669,7 @@ int CDemoPlayer::SetPos(float Percent)
 
 	while(Keyframe && m_pKeyFrames[Keyframe].m_Tick > WantedTick)
 		Keyframe--;
-	
+
 	// seek to the correct keyframe
 	io_seek(m_File, m_pKeyFrames[Keyframe].m_Filepos, IOSEEK_START);
 
@@ -681,9 +681,9 @@ int CDemoPlayer::SetPos(float Percent)
 	// playback everything until we hit our tick
 	while(m_Info.m_PreviousTick < WantedTick)
 		DoTick();
-	
+
 	Play();
-	
+
 	return 0;
 }
 
@@ -697,19 +697,19 @@ int CDemoPlayer::Update()
 	int64 Now = time_get();
 	int64 Deltatime = Now-m_Info.m_LastUpdate;
 	m_Info.m_LastUpdate = Now;
-	
+
 	if(!IsPlaying())
 		return 0;
-	
+
 	if(m_Info.m_Info.m_Paused)
 	{
-		
+
 	}
 	else
 	{
 		int64 Freq = time_freq();
 		m_Info.m_CurrentTime += (int64)(Deltatime*(double)m_Info.m_Info.m_Speed);
-		
+
 		while(1)
 		{
 			int64 CurtickStart = (m_Info.m_Info.m_CurrentTick)*Freq/SERVER_TICK_SPEED;
@@ -717,22 +717,22 @@ int CDemoPlayer::Update()
 			// break if we are ready
 			if(CurtickStart > m_Info.m_CurrentTime)
 				break;
-			
+
 			// do one more tick
 			DoTick();
-			
+
 			if(m_Info.m_Info.m_Paused)
 				return 0;
 		}
 
 		// update intratick
-		{	
+		{
 			int64 CurtickStart = (m_Info.m_Info.m_CurrentTick)*Freq/SERVER_TICK_SPEED;
 			int64 PrevtickStart = (m_Info.m_PreviousTick)*Freq/SERVER_TICK_SPEED;
 			m_Info.m_IntraTick = (m_Info.m_CurrentTime - PrevtickStart) / (float)(CurtickStart-PrevtickStart);
 			m_Info.m_TickTime = (m_Info.m_CurrentTime - PrevtickStart) / (float)Freq;
 		}
-		
+
 		if(m_Info.m_Info.m_CurrentTick == m_Info.m_PreviousTick ||
 			m_Info.m_Info.m_CurrentTick == m_Info.m_NextTick)
 		{
@@ -742,7 +742,7 @@ int CDemoPlayer::Update()
 			m_pConsole->Print(IConsole::OUTPUT_LEVEL_ADDINFO, "demo_player", aBuf);
 		}
 	}
-	
+
 	return 0;
 }
 
@@ -750,7 +750,7 @@ int CDemoPlayer::Stop()
 {
 	if(!m_File)
 		return -1;
-		
+
 	m_pConsole->Print(IConsole::OUTPUT_LEVEL_STANDARD, "demo_player", "Stopped playback");
 	io_close(m_File);
 	m_File = 0;
@@ -776,20 +776,20 @@ bool CDemoPlayer::GetDemoInfo(class IStorage *pStorage, const char *pFilename, i
 {
 	if(!pDemoHeader)
 		return false;
-	
+
 	mem_zero(pDemoHeader, sizeof(CDemoHeader));
 
 	IOHANDLE File = pStorage->OpenFile(pFilename, IOFLAG_READ, StorageType);
 	if(!File)
 		return false;
-	
+
 	io_read(File, pDemoHeader, sizeof(CDemoHeader));
 	if(mem_comp(pDemoHeader->m_aMarker, gs_aHeaderMarker, sizeof(gs_aHeaderMarker)) || pDemoHeader->m_Version < gs_ActVersion)
 	{
 		io_close(File);
 		return false;
 	}
-	
+
 	io_close(File);
 	return true;
 }
diff --git a/src/engine/shared/demo.h b/src/engine/shared/demo.h
index c877536d..f1897f21 100644
--- a/src/engine/shared/demo.h
+++ b/src/engine/shared/demo.h
@@ -17,12 +17,12 @@ class CDemoRecorder : public IDemoRecorder
 	int m_FirstTick;
 	unsigned char m_aLastSnapshotData[CSnapshot::MAX_SIZE];
 	class CSnapshotDelta *m_pSnapshotDelta;
-	
+
 	void WriteTickMarker(int Tick, int Keyframe);
 	void Write(int Type, const void *pData, int Size);
 public:
 	CDemoRecorder(class CSnapshotDelta *pSnapshotDelta);
-	
+
 	int Start(class IStorage *pStorage, class IConsole *pConsole, const char *pFilename, const char *pNetversion, const char *pMap, unsigned MapCrc, const char *pType);
 	int Stop();
 
@@ -44,21 +44,21 @@ public:
 		virtual void OnDemoPlayerSnapshot(void *pData, int Size) = 0;
 		virtual void OnDemoPlayerMessage(void *pData, int Size) = 0;
 	};
-	
+
 	struct CPlaybackInfo
 	{
 		CDemoHeader m_Header;
-		
+
 		IDemoPlayer::CInfo m_Info;
 
 		int64 m_LastUpdate;
 		int64 m_CurrentTime;
-		
+
 		int m_SeekablePoints;
-		
+
 		int m_NextTick;
 		int m_PreviousTick;
-		
+
 		float m_IntraTick;
 		float m_TickTime;
 	};
@@ -73,12 +73,12 @@ private:
 		long m_Filepos;
 		int m_Tick;
 	};
-		
+
 	struct CKeyFrameSearch
 	{
 		CKeyFrame m_Frame;
 		CKeyFrameSearch *m_pNext;
-	};	
+	};
 
 	class IConsole *m_pConsole;
 	IOHANDLE m_File;
@@ -97,25 +97,25 @@ private:
 	int NextFrame();
 
 public:
-	
+
 	CDemoPlayer(class CSnapshotDelta *m_pSnapshotDelta);
-	
+
 	void SetListner(IListner *pListner);
-		
+
 	int Load(class IStorage *pStorage, class IConsole *pConsole, const char *pFilename, int StorageType);
 	int Play();
 	void Pause();
 	void Unpause();
-	int Stop();	
+	int Stop();
 	void SetSpeed(float Speed);
 	int SetPos(float Precent);
 	const CInfo *BaseInfo() const { return &m_Info.m_Info; }
 	char *GetDemoName();
 	bool GetDemoInfo(class IStorage *pStorage, const char *pFilename, int StorageType, CDemoHeader *pDemoHeader) const;
 	int GetDemoType() const;
-	
+
 	int Update();
-	
+
 	const CPlaybackInfo *Info() const { return &m_Info; }
 	int IsPlaying() const { return m_File != 0; }
 };
diff --git a/src/engine/shared/engine.cpp b/src/engine/shared/engine.cpp
index b4b4f2a5..5cc19c00 100644
--- a/src/engine/shared/engine.cpp
+++ b/src/engine/shared/engine.cpp
@@ -43,7 +43,7 @@ public:
 			pEngine->m_Logging = false;
 		}
 		else
-		{			
+		{
 			char aBuf[32];
 			str_timestamp(aBuf, sizeof(aBuf));
 			char aFilenameSent[128], aFilenameRecv[128];
@@ -59,7 +59,7 @@ public:
 	{
 		dbg_logger_stdout();
 		dbg_logger_debugger();
-	
+
 		//
 		dbg_msg("engine", "running on %s-%s-%s", CONF_FAMILY_STRING, CONF_PLATFORM_STRING, CONF_ARCH_STRING);
 	#ifdef CONF_ARCH_ENDIAN_LITTLE
@@ -73,7 +73,7 @@ public:
 		// init the network
 		net_init();
 		CNetBase::Init();
-	
+
 		m_JobPool.Init(1);
 
 		m_Logging = false;
diff --git a/src/engine/shared/huffman.cpp b/src/engine/shared/huffman.cpp
index feb35b96..c88502b5 100644
--- a/src/engine/shared/huffman.cpp
+++ b/src/engine/shared/huffman.cpp
@@ -15,7 +15,7 @@ void CHuffman::Setbits_r(CNode *pNode, int Bits, unsigned Depth)
 		Setbits_r(&m_aNodes[pNode->m_aLeafs[1]], Bits|(1<<Depth), Depth+1);
 	if(pNode->m_aLeafs[0] != 0xffff)
 		Setbits_r(&m_aNodes[pNode->m_aLeafs[0]], Bits, Depth+1);
-		
+
 	if(pNode->m_NumBits)
 	{
 		pNode->m_Bits = Bits;
@@ -28,7 +28,7 @@ static void BubbleSort(CHuffmanConstructNode **ppList, int Size)
 {
 	int Changed = 1;
 	CHuffmanConstructNode *pTemp;
-	
+
 	while(Changed)
 	{
 		Changed = 0;
@@ -68,15 +68,15 @@ void CHuffman::ConstructTree(const unsigned *pFrequencies)
 		apNodesLeft[i] = &aNodesLeftStorage[i];
 
 	}
-	
+
 	m_NumNodes = HUFFMAN_MAX_SYMBOLS;
-	
+
 	// construct the table
 	while(NumNodesLeft > 1)
 	{
 		// we can't rely on stdlib's qsort for this, it can generate different results on different implementations
 		BubbleSort(apNodesLeft, NumNodesLeft);
-		
+
 		m_aNodes[m_NumNodes].m_NumBits = 0;
 		m_aNodes[m_NumNodes].m_aLeafs[0] = apNodesLeft[NumNodesLeft-1]->m_NodeId;
 		m_aNodes[m_NumNodes].m_aLeafs[1] = apNodesLeft[NumNodesLeft-2]->m_NodeId;
@@ -89,7 +89,7 @@ void CHuffman::ConstructTree(const unsigned *pFrequencies)
 
 	// set start node
 	m_pStartNode = &m_aNodes[m_NumNodes-1];
-	
+
 	// build symbol bits
 	Setbits_r(m_pStartNode, 0, 0);
 }
@@ -230,7 +230,7 @@ int CHuffman::Decompress(const void *pInput, int InputSize, void *pOutput, int O
 		// {C} load symbol now if we didn't that earlier at location {A}
 		if(!pNode)
 			pNode = m_apDecodeLut[Bits&HUFFMAN_LUTMASK];
-		
+
 		if(!pNode)
 			return -1;
 
diff --git a/src/engine/shared/huffman.h b/src/engine/shared/huffman.h
index 0edc36c6..0d15ed99 100644
--- a/src/engine/shared/huffman.h
+++ b/src/engine/shared/huffman.h
@@ -13,7 +13,7 @@ class CHuffman
 
 		HUFFMAN_MAX_SYMBOLS=HUFFMAN_EOF_SYMBOL+1,
 		HUFFMAN_MAX_NODES=HUFFMAN_MAX_SYMBOLS*2-1,
-		
+
 		HUFFMAN_LUTBITS = 10,
 		HUFFMAN_LUTSIZE = (1<<HUFFMAN_LUTBITS),
 		HUFFMAN_LUTMASK = (HUFFMAN_LUTSIZE-1)
@@ -36,10 +36,10 @@ class CHuffman
 	CNode *m_apDecodeLut[HUFFMAN_LUTSIZE];
 	CNode *m_pStartNode;
 	int m_NumNodes;
-	
+
 	void Setbits_r(CNode *pNode, int Bits, unsigned Depth);
 	void ConstructTree(const unsigned *pFrequencies);
-	
+
 public:
 	/*
 		Function: huffman_init
@@ -86,6 +86,6 @@ public:
 			Returns the size of the uncompressed data. Negative value on failure.
 	*/
 	int Decompress(const void *pInput, int InputSize, void *pOutput, int OutputSize);
-	
+
 };
 #endif // __HUFFMAN_HEADER__
diff --git a/src/engine/shared/jobs.cpp b/src/engine/shared/jobs.cpp
index 4bc09325..02db4634 100644
--- a/src/engine/shared/jobs.cpp
+++ b/src/engine/shared/jobs.cpp
@@ -14,11 +14,11 @@ CJobPool::CJobPool()
 void CJobPool::WorkerThread(void *pUser)
 {
 	CJobPool *pPool = (CJobPool *)pUser;
-	
+
 	while(1)
 	{
 		CJob *pJob = 0;
-		
+
 		// fetch job from queue
 		lock_wait(pPool->m_Lock);
 		if(pPool->m_pFirstJob)
@@ -31,7 +31,7 @@ void CJobPool::WorkerThread(void *pUser)
 				pPool->m_pLastJob = 0;
 		}
 		lock_release(pPool->m_Lock);
-		
+
 		// do the job if we have one
 		if(pJob)
 		{
@@ -42,7 +42,7 @@ void CJobPool::WorkerThread(void *pUser)
 		else
 			thread_sleep(10);
 	}
-	
+
 }
 
 int CJobPool::Init(int NumThreads)
@@ -58,9 +58,9 @@ int CJobPool::Add(CJob *pJob, JOBFUNC pfnFunc, void *pData)
 	mem_zero(pJob, sizeof(CJob));
 	pJob->m_pfnFunc = pfnFunc;
 	pJob->m_pFuncData = pData;
-	
+
 	lock_wait(m_Lock);
-	
+
 	// add job to queue
 	pJob->m_pPrev = m_pLastJob;
 	if(m_pLastJob)
@@ -68,7 +68,7 @@ int CJobPool::Add(CJob *pJob, JOBFUNC pfnFunc, void *pData)
 	m_pLastJob = pJob;
 	if(!m_pFirstJob)
 		m_pFirstJob = pJob;
-	
+
 	lock_release(m_Lock);
 	return 0;
 }
diff --git a/src/engine/shared/jobs.h b/src/engine/shared/jobs.h
index 2b0d7d15..9e15228a 100644
--- a/src/engine/shared/jobs.h
+++ b/src/engine/shared/jobs.h
@@ -9,14 +9,14 @@ class CJobPool;
 class CJob
 {
 	friend class CJobPool;
-	
+
 	CJobPool *m_pPool;
 	CJob *m_pPrev;
 	CJob *m_pNext;
-	
+
 	volatile int m_Status;
 	volatile int m_Result;
-	
+
 	JOBFUNC m_pfnFunc;
 	void *m_pFuncData;
 public:
@@ -25,14 +25,14 @@ public:
 		m_Status = STATE_DONE;
 		m_pFuncData = 0;
 	}
-	
+
 	enum
 	{
 		STATE_PENDING=0,
 		STATE_RUNNING,
 		STATE_DONE
 	};
-	
+
 	int Status() const { return m_Status; }
 	int Result() const {return m_Result; }
 };
@@ -42,12 +42,12 @@ class CJobPool
 	LOCK m_Lock;
 	CJob *m_pFirstJob;
 	CJob *m_pLastJob;
-	
+
 	static void WorkerThread(void *pUser);
-	
+
 public:
 	CJobPool();
-	
+
 	int Init(int NumThreads);
 	int Add(CJob *pJob, JOBFUNC pfnFunc, void *pData);
 };
diff --git a/src/engine/shared/kernel.cpp b/src/engine/shared/kernel.cpp
index f59af8c7..b422b591 100644
--- a/src/engine/shared/kernel.cpp
+++ b/src/engine/shared/kernel.cpp
@@ -9,7 +9,7 @@ class CKernel : public IKernel
 	{
 		MAX_INTERFACES=32,
 	};
-	
+
 	class CInterfaceInfo
 	{
 	public:
@@ -18,14 +18,14 @@ class CKernel : public IKernel
 			m_aName[0] = 0;
 			m_pInterface = 0x0;
 		}
-		
+
 		char m_aName[64];
 		IInterface *m_pInterface;
 	};
 
 	CInterfaceInfo m_aInterfaces[MAX_INTERFACES];
 	int m_NumInterfaces;
-	
+
 	CInterfaceInfo *FindInterfaceInfo(const char *pName)
 	{
 		for(int i = 0; i < m_NumInterfaces; i++)
@@ -35,7 +35,7 @@ class CKernel : public IKernel
 		}
 		return 0x0;
 	}
-	
+
 public:
 
 	CKernel()
@@ -58,18 +58,18 @@ public:
 			dbg_msg("kernel", "ERROR: couldn't register interface '%s'. maximum of interfaces reached", pName);
 			return false;
 		}
-			
+
 		if(FindInterfaceInfo(pName) != 0)
 		{
 			dbg_msg("kernel", "ERROR: couldn't register interface '%s'. interface already exists", pName);
 			return false;
 		}
-		
+
 		pInterface->m_pKernel = this;
 		m_aInterfaces[m_NumInterfaces].m_pInterface = pInterface;
 		str_copy(m_aInterfaces[m_NumInterfaces].m_aName, pName, sizeof(m_aInterfaces[m_NumInterfaces].m_aName));
 		m_NumInterfaces++;
-		
+
 		return true;
 	}
 
@@ -80,12 +80,12 @@ public:
 			dbg_msg("kernel", "ERROR: couldn't reregister interface '%s'. interface doesn't exist");
 			return false;
 		}
-		
+
 		pInterface->m_pKernel = this;
-		
+
 		return true;
 	}
-	
+
 	virtual IInterface *RequestInterfaceImpl(const char *pName)
 	{
 		CInterfaceInfo *pInfo = FindInterfaceInfo(pName);
diff --git a/src/engine/shared/map.cpp b/src/engine/shared/map.cpp
index c57dd708..36c89cdc 100644
--- a/src/engine/shared/map.cpp
+++ b/src/engine/shared/map.cpp
@@ -10,7 +10,7 @@ class CMap : public IEngineMap
 	CDataFileReader m_DataFile;
 public:
 	CMap() {}
-	
+
 	virtual void *GetData(int Index) { return m_DataFile.GetData(Index); }
 	virtual void *GetDataSwapped(int Index) { return m_DataFile.GetDataSwapped(Index); }
 	virtual void UnloadData(int Index) { m_DataFile.UnloadData(Index); }
@@ -18,7 +18,7 @@ public:
 	virtual void GetType(int Type, int *pStart, int *pNum) { m_DataFile.GetType(Type, pStart, pNum); }
 	virtual void *FindItem(int Type, int ID) { return m_DataFile.FindItem(Type, ID); }
 	virtual int NumItems() { return m_DataFile.NumItems(); }
-	
+
 	virtual void Unload()
 	{
 		m_DataFile.Close();
@@ -31,12 +31,12 @@ public:
 			return false;
 		return m_DataFile.Open(pStorage, pMapName, IStorage::TYPE_ALL);
 	}
-	
+
 	virtual bool IsLoaded()
 	{
 		return m_DataFile.IsOpen();
 	}
-	
+
 	virtual unsigned Crc()
 	{
 		return m_DataFile.Crc();
diff --git a/src/engine/shared/mapchecker.cpp b/src/engine/shared/mapchecker.cpp
index dec4271d..f8ba30ae 100644
--- a/src/engine/shared/mapchecker.cpp
+++ b/src/engine/shared/mapchecker.cpp
@@ -42,7 +42,7 @@ void CMapChecker::AddMaplist(CMapVersion *pMaplist, int Num)
 		m_pFirst = pEntry;
 
 		str_copy(pEntry->m_aMapName, pMaplist[i].m_aName, sizeof(pEntry->m_aMapName));
-		pEntry->m_MapCrc = (pMaplist[i].m_aCrc[0]<<24) | (pMaplist[i].m_aCrc[1]<<16) | (pMaplist[i].m_aCrc[2]<<8) | pMaplist[i].m_aCrc[3]; 
+		pEntry->m_MapCrc = (pMaplist[i].m_aCrc[0]<<24) | (pMaplist[i].m_aCrc[1]<<16) | (pMaplist[i].m_aCrc[2]<<8) | pMaplist[i].m_aCrc[3];
 		pEntry->m_MapSize = (pMaplist[i].m_aSize[0]<<24) | (pMaplist[i].m_aSize[1]<<16) | (pMaplist[i].m_aSize[2]<<8) | pMaplist[i].m_aSize[3];
 	}
 }
diff --git a/src/engine/shared/mapchecker.h b/src/engine/shared/mapchecker.h
index 0d4332d9..6d9568d0 100644
--- a/src/engine/shared/mapchecker.h
+++ b/src/engine/shared/mapchecker.h
@@ -19,7 +19,7 @@ class CMapChecker
 		unsigned m_MapSize;
 		CWhitelistEntry *m_pNext;
 	};
-	
+
 	class CHeap m_Whitelist;
 	CWhitelistEntry *m_pFirst;
 
diff --git a/src/engine/shared/masterserver.cpp b/src/engine/shared/masterserver.cpp
index 0e8cb394..1bf402ca 100644
--- a/src/engine/shared/masterserver.cpp
+++ b/src/engine/shared/masterserver.cpp
@@ -19,7 +19,7 @@ public:
 		char m_aHostname[128];
 		NETADDR m_Addr;
 		bool m_Valid;
-		
+
 		CHostLookup m_Lookup;
 	} ;
 
@@ -27,7 +27,7 @@ public:
 	int m_NeedsUpdate;
 	IEngine *m_pEngine;
 	IStorage *m_pStorage;
-	
+
 	CMasterServer()
 	{
 		SetDefault();
@@ -38,10 +38,10 @@ public:
 	virtual int RefreshAddresses(int Nettype)
 	{
 		int i;
-		
+
 		if(m_NeedsUpdate != -1)
 			return 0;
-		
+
 		dbg_msg("engine/mastersrv", "refreshing master server addresses");
 
 		// add lookup jobs
@@ -50,7 +50,7 @@ public:
 			m_pEngine->HostLookup(&m_aMasterServers[i].m_Lookup, m_aMasterServers[i].m_aHostname, Nettype);
 			m_aMasterServers[i].m_Valid = false;
 		}
-		
+
 		m_NeedsUpdate = 1;
 		return 0;
 	}
@@ -61,7 +61,7 @@ public:
 		if(m_NeedsUpdate != 1)
 			return;
 		m_NeedsUpdate = 0;
-		
+
 		for(int i = 0; i < MAX_MASTERSERVERS; i++)
 		{
 			if(m_aMasterServers[i].m_Lookup.m_Job.Status() != CJob::STATE_DONE)
@@ -78,7 +78,7 @@ public:
 					m_aMasterServers[i].m_Valid = false;
 			}
 		}
-		
+
 		if(!m_NeedsUpdate)
 		{
 			dbg_msg("engine/mastersrv", "saving addresses");
@@ -91,12 +91,12 @@ public:
 		return m_NeedsUpdate;
 	}
 
-	virtual NETADDR GetAddr(int Index) 
+	virtual NETADDR GetAddr(int Index)
 	{
 		return m_aMasterServers[Index].m_Addr;
 	}
 
-	virtual const char *GetName(int Index) 
+	virtual const char *GetName(int Index)
 	{
 		return m_aMasterServers[Index].m_aHostname;
 	}
@@ -136,12 +136,12 @@ public:
 		int Count = 0;
 		if(!m_pStorage)
 			return -1;
-		
+
 		// try to open file
 		File = m_pStorage->OpenFile("masters.cfg", IOFLAG_READ, IStorage::TYPE_SAVE);
 		if(!File)
 			return -1;
-		
+
 		LineReader.Init(File);
 		while(1)
 		{
@@ -166,7 +166,7 @@ public:
 			//else
 			//	dbg_msg("engine/mastersrv", "warning: couldn't parse master server '%s'", pLine);
 		}
-		
+
 		io_close(File);
 		return 0;
 	}
@@ -177,7 +177,7 @@ public:
 
 		if(!m_pStorage)
 			return -1;
-			
+
 		// try to open file
 		File = m_pStorage->OpenFile("masters.cfg", IOFLAG_WRITE, IStorage::TYPE_SAVE);
 		if(!File)
@@ -189,10 +189,10 @@ public:
 			net_addr_str(&m_aMasterServers[i].m_Addr, aAddrStr, sizeof(aAddrStr));
 			char aBuf[1024];
 			str_format(aBuf, sizeof(aBuf), "%s %s\n", m_aMasterServers[i].m_aHostname, aAddrStr);
-				
+
 			io_write(File, aBuf, str_length(aBuf));
 		}
-		
+
 		io_close(File);
 		return 0;
 	}
diff --git a/src/engine/shared/memheap.cpp b/src/engine/shared/memheap.cpp
index 850577dd..c1c09eaf 100644
--- a/src/engine/shared/memheap.cpp
+++ b/src/engine/shared/memheap.cpp
@@ -10,7 +10,7 @@ void CHeap::NewChunk()
 {
 	CChunk *pChunk;
 	char *pMem;
-	
+
 	// allocate memory
 	pMem = (char*)mem_alloc(sizeof(CChunk)+CHUNK_SIZE, 1);
 	if(!pMem)
@@ -25,14 +25,14 @@ void CHeap::NewChunk()
 	pChunk->m_pNext = (CChunk *)0x0;
 
 	pChunk->m_pNext = m_pCurrent;
-	m_pCurrent = pChunk;	
+	m_pCurrent = pChunk;
 }
 
 //****************
 void *CHeap::AllocateFromChunk(unsigned int Size)
 {
 	char *pMem;
-	
+
 	// check if we need can fit the allocation
 	if(m_pCurrent->m_pCurrent + Size > m_pCurrent->m_pEnd)
 		return (void*)0x0;
@@ -66,14 +66,14 @@ void CHeap::Clear()
 {
 	CChunk *pChunk = m_pCurrent;
 	CChunk *pNext;
-	
+
 	while(pChunk)
 	{
 		pNext = pChunk->m_pNext;
 		mem_free(pChunk);
 		pChunk = pNext;
 	}
-	
+
 	m_pCurrent = 0x0;
 }
 
@@ -88,10 +88,10 @@ void *CHeap::Allocate(unsigned Size)
 	{
 		// allocate new chunk and add it to the heap
 		NewChunk();
-		
+
 		// try to allocate again
 		pMem = (char *)AllocateFromChunk(Size);
 	}
-	
+
 	return pMem;
 }
diff --git a/src/engine/shared/memheap.h b/src/engine/shared/memheap.h
index 7228212a..39adf2b1 100644
--- a/src/engine/shared/memheap.h
+++ b/src/engine/shared/memheap.h
@@ -11,20 +11,20 @@ class CHeap
 		char *m_pEnd;
 		CChunk *m_pNext;
 	};
-	
+
 	enum
 	{
 		// how large each chunk should be
 		CHUNK_SIZE = 1025*64,
 	};
-	
+
 	CChunk *m_pCurrent;
-	
-	
+
+
 	void Clear();
 	void NewChunk();
 	void *AllocateFromChunk(unsigned int Size);
-	
+
 public:
 	CHeap();
 	~CHeap();
diff --git a/src/engine/shared/network.cpp b/src/engine/shared/network.cpp
index 89ffae6d..ada4b18a 100644
--- a/src/engine/shared/network.cpp
+++ b/src/engine/shared/network.cpp
@@ -26,35 +26,35 @@ int CNetRecvUnpacker::FetchChunk(CNetChunk *pChunk)
 {
 	CNetChunkHeader Header;
 	unsigned char *pEnd = m_Data.m_aChunkData + m_Data.m_DataSize;
-	
+
 	while(1)
 	{
 		unsigned char *pData = m_Data.m_aChunkData;
-		
+
 		// check for old data to unpack
 		if(!m_Valid || m_CurrentChunk >= m_Data.m_NumChunks)
 		{
 			Clear();
 			return 0;
 		}
-		
+
 		// TODO: add checking here so we don't read too far
 		for(int i = 0; i < m_CurrentChunk; i++)
 		{
 			pData = Header.Unpack(pData);
 			pData += Header.m_Size;
 		}
-		
+
 		// unpack the header
 		pData = Header.Unpack(pData);
 		m_CurrentChunk++;
-		
+
 		if(pData+Header.m_Size > pEnd)
 		{
 			Clear();
 			return 0;
 		}
-		
+
 		// handle sequence stuff
 		if(m_pConnection && (Header.m_Flags&NET_CHUNKFLAG_VITAL))
 		{
@@ -76,7 +76,7 @@ int CNetRecvUnpacker::FetchChunk(CNetChunk *pChunk)
 				continue; // take the next chunk in the packet
 			}
 		}
-		
+
 		// fill in the info
 		pChunk->m_ClientID = m_ClientID;
 		pChunk->m_Address = m_Addr;
@@ -116,7 +116,7 @@ void CNetBase::SendPacket(NETSOCKET Socket, NETADDR *pAddr, CNetPacketConstruct
 		io_write(ms_DataLogSent, &pPacket->m_aChunkData, pPacket->m_DataSize);
 		io_flush(ms_DataLogSent);
 	}
-	
+
 	// compress
 	CompressedSize = ms_Huffman.Compress(pPacket->m_aChunkData, pPacket->m_DataSize, &aBuffer[3], NET_MAX_PACKETSIZE-4);
 
@@ -174,7 +174,7 @@ int CNetBase::UnpackPacket(unsigned char *pBuffer, int Size, CNetPacketConstruct
 		io_write(ms_DataLogRecv, pBuffer, Size);
 		io_flush(ms_DataLogRecv);
 	}
-	
+
 	// read the packet
 	pPacket->m_Flags = pBuffer[0]>>4;
 	pPacket->m_Ack = ((pBuffer[0]&0xf)<<8) | pBuffer[1];
@@ -188,7 +188,7 @@ int CNetBase::UnpackPacket(unsigned char *pBuffer, int Size, CNetPacketConstruct
 			dbg_msg("", "connection less packet too small, %d", Size);
 			return -1;
 		}
-			
+
 		pPacket->m_Flags = NET_PACKETFLAG_CONNLESS;
 		pPacket->m_Ack = 0;
 		pPacket->m_NumChunks = 0;
@@ -220,7 +220,7 @@ int CNetBase::UnpackPacket(unsigned char *pBuffer, int Size, CNetPacketConstruct
 		io_write(ms_DataLogRecv, pPacket->m_aChunkData, pPacket->m_DataSize);
 		io_flush(ms_DataLogRecv);
 	}
-		
+
 	// return success
 	return 0;
 }
@@ -235,7 +235,7 @@ void CNetBase::SendControlMsg(NETSOCKET Socket, NETADDR *pAddr, int Ack, int Con
 	Construct.m_DataSize = 1+ExtraSize;
 	Construct.m_aChunkData[0] = ControlMsg;
 	mem_copy(&Construct.m_aChunkData[1], pExtra, ExtraSize);
-	
+
 	// send the control message
 	CNetBase::SendPacket(Socket, pAddr, &Construct);
 }
@@ -284,7 +284,7 @@ int CNetBase::IsSeqInBackroom(int Seq, int Ack)
 		if(Seq <= Ack && Seq >= Bottom)
 			return 1;
 	}
-	
+
 	return 0;
 }
 
diff --git a/src/engine/shared/network.h b/src/engine/shared/network.h
index cb1ec33a..f344049e 100644
--- a/src/engine/shared/network.h
+++ b/src/engine/shared/network.h
@@ -13,7 +13,7 @@ CURRENT:
 		unsigned char flags_ack; // 4bit flags, 4bit ack
 		unsigned char ack; // 8 bit ack
 		unsigned char num_chunks; // 8 bit chunks
-		
+
 		(unsigned char padding[3])	// 24 bit extra incase it's a connection less packet
 									// this is to make sure that it's compatible with the
 									// old protocol
@@ -30,11 +30,11 @@ enum
 	NETSENDFLAG_VITAL=1,
 	NETSENDFLAG_CONNLESS=2,
 	NETSENDFLAG_FLUSH=4,
-	
+
 	NETSTATE_OFFLINE=0,
 	NETSTATE_CONNECTING,
 	NETSTATE_ONLINE,
-	
+
 	NETBANTYPE_SOFT=1,
 	NETBANTYPE_DROP=2
 };
@@ -65,17 +65,17 @@ enum
 
 	NET_CHUNKFLAG_VITAL=1,
 	NET_CHUNKFLAG_RESEND=2,
-	
+
 	NET_CTRLMSG_KEEPALIVE=0,
 	NET_CTRLMSG_CONNECT=1,
 	NET_CTRLMSG_CONNECTACCEPT=2,
 	NET_CTRLMSG_ACCEPT=3,
 	NET_CTRLMSG_CLOSE=4,
-	
+
 	NET_SERVER_MAXBANS=1024,
-	
+
 	NET_CONN_BUFFERSIZE=1024*32,
-	
+
 	NET_ENUM_TERMINATOR
 };
 
@@ -100,7 +100,7 @@ public:
 	int m_Flags;
 	int m_Size;
 	int m_Sequence;
-	
+
 	unsigned char *Pack(unsigned char *pData);
 	unsigned char *Unpack(unsigned char *pData);
 };
@@ -138,30 +138,30 @@ private:
 	unsigned short m_Sequence;
 	unsigned short m_Ack;
 	unsigned m_State;
-	
+
 	int m_Token;
 	int m_RemoteClosed;
-	
+
 	TStaticRingBuffer<CNetChunkResend, NET_CONN_BUFFERSIZE> m_Buffer;
-	
+
 	int64 m_LastUpdateTime;
 	int64 m_LastRecvTime;
 	int64 m_LastSendTime;
-	
+
 	char m_ErrorString[256];
-	
+
 	CNetPacketConstruct m_Construct;
-	
+
 	NETADDR m_PeerAddr;
 	NETSOCKET m_Socket;
 	NETSTATS m_Stats;
-	
+
 	//
 	void Reset();
 	void ResetStats();
 	void SetError(const char *pString);
 	void AckChunks(int Ack);
-	
+
 	int QueueChunkEx(int Flags, int DataSize, const void *pData, int Sequence);
 	void SendControl(int ControlMsg, const void *pExtra, int ExtraSize);
 	void ResendChunk(CNetChunkResend *pResend);
@@ -173,7 +173,7 @@ public:
 	void Disconnect(const char *pReason);
 
 	int Update();
-	int Flush();	
+	int Flush();
 
 	int Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr);
 	int QueueChunk(int Flags, int DataSize, const void *pData);
@@ -182,13 +182,13 @@ public:
 	void SignalResend();
 	int State() const { return m_State; }
 	NETADDR PeerAddress() const { return m_PeerAddr; }
-	
+
 	void ResetErrorString() { m_ErrorString[0] = 0; }
 	const char *ErrorString() const { return m_ErrorString; }
-	
+
 	// Needed for GotProblems in NetClient
 	int64 LastRecvTime() const { return m_LastRecvTime; }
-	
+
 	int AckSequence() const { return m_Ack; }
 };
 
@@ -196,7 +196,7 @@ struct CNetRecvUnpacker
 {
 public:
 	bool m_Valid;
-	
+
 	NETADDR m_Addr;
 	CNetConnection *m_pConnection;
 	int m_CurrentChunk;
@@ -207,7 +207,7 @@ public:
 	CNetRecvUnpacker() { Clear(); }
 	void Clear();
 	void Start(const NETADDR *pAddr, CNetConnection *pConnection, int ClientID);
-	int FetchChunk(CNetChunk *pChunk);	
+	int FetchChunk(CNetChunk *pChunk);
 };
 
 // server side
@@ -220,29 +220,29 @@ public:
 		int m_Expires;
 		char m_Reason[128];
 	};
-	
+
 private:
 	class CSlot
 	{
 	public:
 		CNetConnection m_Connection;
 	};
-	
+
 	class CBan
 	{
 	public:
 		CBanInfo m_Info;
-		
+
 		// hash list
 		CBan *m_pHashNext;
 		CBan *m_pHashPrev;
-		
+
 		// used or free list
 		CBan *m_pNext;
 		CBan *m_pPrev;
 	};
-	
-	
+
+
 	NETSOCKET m_Socket;
 	CSlot m_aSlots[NET_MAX_CLIENTS];
 	int m_MaxClients;
@@ -256,23 +256,23 @@ private:
 	NETFUNC_NEWCLIENT m_pfnNewClient;
 	NETFUNC_DELCLIENT m_pfnDelClient;
 	void *m_UserPtr;
-	
+
 	CNetRecvUnpacker m_RecvUnpacker;
-	
+
 	void BanRemoveByObject(CBan *pBan);
-	
+
 public:
 	int SetCallbacks(NETFUNC_NEWCLIENT pfnNewClient, NETFUNC_DELCLIENT pfnDelClient, void *pUser);
 
 	//
 	bool Open(NETADDR BindAddr, int MaxClients, int MaxClientsPerIP, int Flags);
 	int Close();
-	
+
 	//
 	int Recv(CNetChunk *pChunk);
 	int Send(CNetChunk *pChunk);
 	int Update();
-	
+
 	//
 	int Drop(int ClientID, const char *pReason);
 
@@ -304,21 +304,21 @@ public:
 	// openness
 	bool Open(NETADDR BindAddr, int Flags);
 	int Close();
-	
+
 	// connection state
 	int Disconnect(const char *Reason);
 	int Connect(NETADDR *Addr);
-	
+
 	// communication
 	int Recv(CNetChunk *Chunk);
 	int Send(CNetChunk *Chunk);
-	
+
 	// pumping
 	int Update();
 	int Flush();
 
 	int ResetErrorString();
-	
+
 	// error and state
 	int State();
 	int GotProblems();
@@ -339,14 +339,14 @@ public:
 	static void Init();
 	static int Compress(const void *pData, int DataSize, void *pOutput, int OutputSize);
 	static int Decompress(const void *pData, int DataSize, void *pOutput, int OutputSize);
-	
+
 	static void SendControlMsg(NETSOCKET Socket, NETADDR *pAddr, int Ack, int ControlMsg, const void *pExtra, int ExtraSize);
 	static void SendPacketConnless(NETSOCKET Socket, NETADDR *pAddr, const void *pData, int DataSize);
 	static void SendPacket(NETSOCKET Socket, NETADDR *pAddr, CNetPacketConstruct *pPacket);
 	static int UnpackPacket(unsigned char *pBuffer, int Size, CNetPacketConstruct *pPacket);
 
 	// The backroom is ack-NET_MAX_SEQUENCE/2. Used for knowing if we acked a packet or not
-	static int IsSeqInBackroom(int Seq, int Ack);	
+	static int IsSeqInBackroom(int Seq, int Ack);
 };
 
 
diff --git a/src/engine/shared/network_client.cpp b/src/engine/shared/network_client.cpp
index 82a09474..2c035606 100644
--- a/src/engine/shared/network_client.cpp
+++ b/src/engine/shared/network_client.cpp
@@ -61,7 +61,7 @@ int CNetClient::Recv(CNetChunk *pChunk)
 		// check for a chunk
 		if(m_RecvUnpacker.FetchChunk(pChunk))
 			return 1;
-		
+
 		// TODO: empty the recvinfo
 		NETADDR Addr;
 		int Bytes = net_udp_recv(m_Socket, &Addr, m_RecvUnpacker.m_aBuffer, NET_MAX_PACKETSIZE);
@@ -98,7 +98,7 @@ int CNetClient::Send(CNetChunk *pChunk)
 		dbg_msg("netclient", "chunk payload too big. %d. dropping chunk", pChunk->m_DataSize);
 		return -1;
 	}
-	
+
 	if(pChunk->m_Flags&NETSENDFLAG_CONNLESS)
 	{
 		// send connectionless packet
@@ -108,10 +108,10 @@ int CNetClient::Send(CNetChunk *pChunk)
 	{
 		int Flags = 0;
 		dbg_assert(pChunk->m_ClientID == 0, "errornous client id");
-		
+
 		if(pChunk->m_Flags&NETSENDFLAG_VITAL)
 			Flags = NET_CHUNKFLAG_VITAL;
-		
+
 		m_Connection.QueueChunk(Flags, pChunk->m_DataSize, pChunk->m_pData);
 
 		if(pChunk->m_Flags&NETSENDFLAG_FLUSH)
diff --git a/src/engine/shared/network_conn.cpp b/src/engine/shared/network_conn.cpp
index dd61de86..6531f5aa 100644
--- a/src/engine/shared/network_conn.cpp
+++ b/src/engine/shared/network_conn.cpp
@@ -14,16 +14,16 @@ void CNetConnection::Reset()
 	m_Sequence = 0;
 	m_Ack = 0;
 	m_RemoteClosed = 0;
-	
+
 	m_State = NET_CONNSTATE_OFFLINE;
 	m_LastSendTime = 0;
 	m_LastRecvTime = 0;
 	m_LastUpdateTime = 0;
 	m_Token = -1;
 	mem_zero(&m_PeerAddr, sizeof(m_PeerAddr));
-	
+
 	m_Buffer.Init();
-	
+
 	mem_zero(&m_Construct, sizeof(m_Construct));
 }
 
@@ -41,7 +41,7 @@ void CNetConnection::Init(NETSOCKET Socket)
 {
 	Reset();
 	ResetStats();
-	
+
 	m_Socket = Socket;
 	mem_zero(m_ErrorString, sizeof(m_ErrorString));
 }
@@ -53,7 +53,7 @@ void CNetConnection::AckChunks(int Ack)
 		CNetChunkResend *pResend = m_Buffer.First();
 		if(!pResend)
 			break;
-		
+
 		if(CNetBase::IsSeqInBackroom(pResend->m_Sequence, Ack))
 			m_Buffer.PopFirst();
 		else
@@ -75,10 +75,10 @@ int CNetConnection::Flush()
 	// send of the packets
 	m_Construct.m_Ack = m_Ack;
 	CNetBase::SendPacket(m_Socket, &m_PeerAddr, &m_Construct);
-	
+
 	// update send times
 	m_LastSendTime = time_get();
-	
+
 	// clear construct so we can start building a new package
 	mem_zero(&m_Construct, sizeof(m_Construct));
 	return NumChunks;
@@ -87,7 +87,7 @@ int CNetConnection::Flush()
 int CNetConnection::QueueChunkEx(int Flags, int DataSize, const void *pData, int Sequence)
 {
 	unsigned char *pChunkData;
-	
+
 	// check if we have space for it, if not, flush the connection
 	if(m_Construct.m_DataSize + DataSize + NET_MAX_CHUNKHEADERSIZE > (int)sizeof(m_Construct.m_aChunkData))
 		Flush();
@@ -105,9 +105,9 @@ int CNetConnection::QueueChunkEx(int Flags, int DataSize, const void *pData, int
 	//
 	m_Construct.m_NumChunks++;
 	m_Construct.m_DataSize = (int)(pChunkData-m_Construct.m_aChunkData);
-	
+
 	// set packet flags aswell
-	
+
 	if(Flags&NET_CHUNKFLAG_VITAL && !(Flags&NET_CHUNKFLAG_RESEND))
 	{
 		// save packet if we need to resend
@@ -163,7 +163,7 @@ int CNetConnection::Connect(NETADDR *pAddr)
 {
 	if(State() != NET_CONNSTATE_OFFLINE)
 		return -1;
-	
+
 	// init connection
 	Reset();
 	m_PeerAddr = *pAddr;
@@ -189,14 +189,14 @@ void CNetConnection::Disconnect(const char *pReason)
 		if(pReason)
 			str_copy(m_ErrorString, pReason, sizeof(m_ErrorString));
 	}
-	
+
 	Reset();
 }
 
 int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
 {
 	int64 Now = time_get();
-	
+
 	// check if resend is requested
 	if(pPacket->m_Flags&NET_PACKETFLAG_RESEND)
 		Resend();
@@ -205,14 +205,14 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
 	if(pPacket->m_Flags&NET_PACKETFLAG_CONTROL)
 	{
 		int CtrlMsg = pPacket->m_aChunkData[0];
-		
+
 		if(CtrlMsg == NET_CTRLMSG_CLOSE)
 		{
 			if(net_addr_comp(&m_PeerAddr, pAddr) == 0)
 			{
 				m_State = NET_CONNSTATE_ERROR;
 				m_RemoteClosed = 1;
-				
+
 				if(pPacket->m_DataSize)
 				{
 					// make sure to sanitize the error string form the other party
@@ -222,17 +222,17 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
 					else
 						str_copy(Str, (char *)pPacket->m_aChunkData, sizeof(Str));
 					str_sanitize_strong(Str);
-					
+
 					// set the error string
 					SetError(Str);
 				}
 				else
 					SetError("No reason given");
-					
+
 				if(g_Config.m_Debug)
 					dbg_msg("conn", "closed reason='%s'", ErrorString());
 			}
-			return 0;			
+			return 0;
 		}
 		else
 		{
@@ -249,7 +249,7 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
 					m_LastUpdateTime = Now;
 					SendControl(NET_CTRLMSG_CONNECTACCEPT, 0, 0);
 					if(g_Config.m_Debug)
-						dbg_msg("connection", "got connection, sending connect+accept");			
+						dbg_msg("connection", "got connection, sending connect+accept");
 				}
 			}
 			else if(State() == NET_CONNSTATE_CONNECT)
@@ -276,13 +276,13 @@ int CNetConnection::Feed(CNetPacketConstruct *pPacket, NETADDR *pAddr)
 				dbg_msg("connection", "connecting online");
 		}
 	}
-	
+
 	if(State() == NET_CONNSTATE_ONLINE)
 	{
 		m_LastRecvTime = Now;
 		AckChunks(pPacket->m_Ack);
 	}
-	
+
 	return 1;
 }
 
@@ -292,7 +292,7 @@ int CNetConnection::Update()
 
 	if(State() == NET_CONNSTATE_OFFLINE || State() == NET_CONNSTATE_ERROR)
 		return 0;
-	
+
 	// check for timeout
 	if(State() != NET_CONNSTATE_OFFLINE &&
 		State() != NET_CONNSTATE_CONNECT &&
@@ -320,7 +320,7 @@ int CNetConnection::Update()
 				ResendChunk(pResend);
 		}
 	}
-	
+
 	// send keep alives if nothing has happend for 250ms
 	if(State() == NET_CONNSTATE_ONLINE)
 	{
@@ -330,7 +330,7 @@ int CNetConnection::Update()
 			if(NumFlushedChunks && g_Config.m_Debug)
 				dbg_msg("connection", "flushed connection due to timeout. %d chunks.", NumFlushedChunks);
 		}
-			
+
 		if(time_get()-m_LastSendTime > time_freq())
 			SendControl(NET_CTRLMSG_KEEPALIVE, 0, 0);
 	}
@@ -344,6 +344,6 @@ int CNetConnection::Update()
 		if(time_get()-m_LastSendTime > time_freq()/2) // send a new connect/accept every 500ms
 			SendControl(NET_CTRLMSG_CONNECTACCEPT, 0, 0);
 	}
-	
+
 	return 0;
 }
diff --git a/src/engine/shared/network_server.cpp b/src/engine/shared/network_server.cpp
index 76d5f695..3078ab9f 100644
--- a/src/engine/shared/network_server.cpp
+++ b/src/engine/shared/network_server.cpp
@@ -8,7 +8,7 @@
 	Object->Prev = (struct CBan *)0; \
 	Object->Next = First; \
 	First = Object; }
-	
+
 #define MACRO_LIST_LINK_AFTER(Object, After, Prev, Next) \
 	{ Object->Prev = After; \
 	Object->Next = After->Next; \
@@ -22,7 +22,7 @@
 	if(Object->Prev) Object->Prev->Next = Object->Next; \
 	else First = Object->Next; \
 	Object->Next = 0; Object->Prev = 0; }
-	
+
 #define MACRO_LIST_FIND(Start, Next, Expression) \
 	{ while(Start && !(Expression)) Start = Start->Next; }
 
@@ -30,12 +30,12 @@ bool CNetServer::Open(NETADDR BindAddr, int MaxClients, int MaxClientsPerIP, int
 {
 	// zero out the whole structure
 	mem_zero(this, sizeof(*this));
-	
+
 	// open socket
 	m_Socket = net_udp_create(BindAddr);
 	if(!m_Socket.type)
 		return false;
-	
+
 	// clamp clients
 	m_MaxClients = MaxClients;
 	if(m_MaxClients > NET_MAX_CLIENTS)
@@ -44,17 +44,17 @@ bool CNetServer::Open(NETADDR BindAddr, int MaxClients, int MaxClientsPerIP, int
 		m_MaxClients = 1;
 
 	m_MaxClientsPerIP = MaxClientsPerIP;
-	
+
 	for(int i = 0; i < NET_MAX_CLIENTS; i++)
 		m_aSlots[i].m_Connection.Init(m_Socket);
-	
+
 	// setup all pointers for bans
 	for(int i = 1; i < NET_SERVER_MAXBANS-1; i++)
 	{
 		m_BanPool[i].m_pNext = &m_BanPool[i+1];
 		m_BanPool[i].m_pPrev = &m_BanPool[i-1];
 	}
-	
+
 	m_BanPool[0].m_pNext = &m_BanPool[1];
 	m_BanPool[NET_SERVER_MAXBANS-1].m_pPrev = &m_BanPool[NET_SERVER_MAXBANS-2];
 	m_BanPool_FirstFree = &m_BanPool[0];
@@ -88,9 +88,9 @@ int CNetServer::Drop(int ClientID, const char *pReason)
 		);*/
 	if(m_pfnDelClient)
 		m_pfnDelClient(ClientID, pReason, m_UserPtr);
-		
+
 	m_aSlots[ClientID].m_Connection.Disconnect(pReason);
-		
+
 	return 0;
 }
 
@@ -99,7 +99,7 @@ int CNetServer::BanGet(int Index, CBanInfo *pInfo)
 	CBan *pBan;
 	for(pBan = m_BanPool_FirstUsed; pBan && Index; pBan = pBan->m_pNext, Index--)
 		{}
-		
+
 	if(!pBan)
 		return 0;
 	*pInfo = pBan->m_Info;
@@ -134,15 +134,15 @@ int CNetServer::BanRemove(NETADDR Addr)
 	int IpHash = (Addr.ip[0]+Addr.ip[1]+Addr.ip[2]+Addr.ip[3]+Addr.ip[4]+Addr.ip[5]+Addr.ip[6]+Addr.ip[7]+
 					Addr.ip[8]+Addr.ip[9]+Addr.ip[10]+Addr.ip[11]+Addr.ip[12]+Addr.ip[13]+Addr.ip[14]+Addr.ip[15])&0xff;
 	CBan *pBan = m_aBans[IpHash];
-	
+
 	MACRO_LIST_FIND(pBan, m_pHashNext, net_addr_comp(&pBan->m_Info.m_Addr, &Addr) == 0);
-	
+
 	if(pBan)
 	{
 		BanRemoveByObject(pBan);
 		return 0;
 	}
-	
+
 	return -1;
 }
 
@@ -152,13 +152,13 @@ int CNetServer::BanAdd(NETADDR Addr, int Seconds, const char *pReason)
 					Addr.ip[8]+Addr.ip[9]+Addr.ip[10]+Addr.ip[11]+Addr.ip[12]+Addr.ip[13]+Addr.ip[14]+Addr.ip[15])&0xff;
 	int Stamp = -1;
 	CBan *pBan;
-	
+
 	// remove the port
 	Addr.port = 0;
-	
+
 	if(Seconds)
 		Stamp = time_timestamp() + Seconds;
-		
+
 	// search to see if it already exists
 	pBan = m_aBans[IpHash];
 	MACRO_LIST_FIND(pBan, m_pHashNext, net_addr_comp(&pBan->m_Info.m_Addr, &Addr) == 0);
@@ -168,29 +168,29 @@ int CNetServer::BanAdd(NETADDR Addr, int Seconds, const char *pReason)
 		pBan->m_Info.m_Expires = Stamp;
 		return 0;
 	}
-	
+
 	if(!m_BanPool_FirstFree)
 		return -1;
 
 	// fetch and clear the new ban
 	pBan = m_BanPool_FirstFree;
 	MACRO_LIST_UNLINK(pBan, m_BanPool_FirstFree, m_pPrev, m_pNext);
-	
+
 	// setup the ban info
 	pBan->m_Info.m_Expires = Stamp;
 	pBan->m_Info.m_Addr = Addr;
 	str_copy(pBan->m_Info.m_Reason, pReason, sizeof(pBan->m_Info.m_Reason));
-	
+
 	// add it to the ban hash
 	MACRO_LIST_LINK_FIRST(pBan, m_aBans[IpHash], m_pHashPrev, m_pHashNext);
-	
+
 	// insert it into the used list
 	{
 		if(m_BanPool_FirstUsed)
 		{
 			CBan *pInsertAfter = m_BanPool_FirstUsed;
 			MACRO_LIST_FIND(pInsertAfter, m_pNext, Stamp < pInsertAfter->m_Info.m_Expires);
-			
+
 			if(pInsertAfter)
 				pInsertAfter = pInsertAfter->m_pPrev;
 			else
@@ -200,7 +200,7 @@ int CNetServer::BanAdd(NETADDR Addr, int Seconds, const char *pReason)
 				while(pInsertAfter->m_pNext)
 					pInsertAfter = pInsertAfter->m_pNext;
 			}
-			
+
 			if(pInsertAfter)
 			{
 				MACRO_LIST_LINK_AFTER(pBan, pInsertAfter, m_pPrev, m_pNext);
@@ -220,7 +220,7 @@ int CNetServer::BanAdd(NETADDR Addr, int Seconds, const char *pReason)
 	{
 		char Buf[128];
 		NETADDR BanAddr;
-		
+
 		int Mins = (Seconds + 59) / 60;
 		if(Mins)
 		{
@@ -231,12 +231,12 @@ int CNetServer::BanAdd(NETADDR Addr, int Seconds, const char *pReason)
 		}
 		else
 			str_format(Buf, sizeof(Buf), "You have been banned for life (%s)", pReason);
-		
+
 		for(int i = 0; i < MaxClients(); i++)
 		{
 			BanAddr = m_aSlots[i].m_Connection.PeerAddress();
 			BanAddr.port = 0;
-			
+
 			if(net_addr_comp(&Addr, &BanAddr) == 0)
 				Drop(i, Buf);
 		}
@@ -253,14 +253,14 @@ int CNetServer::Update()
 		if(m_aSlots[i].m_Connection.State() == NET_CONNSTATE_ERROR)
 			Drop(i, m_aSlots[i].m_Connection.ErrorString());
 	}
-	
+
 	// remove expired bans
 	while(m_BanPool_FirstUsed && m_BanPool_FirstUsed->m_Info.m_Expires < Now)
 	{
 		CBan *pBan = m_BanPool_FirstUsed;
 		BanRemoveByObject(pBan);
 	}
-	
+
 	return 0;
 }
 
@@ -270,22 +270,22 @@ int CNetServer::Update()
 int CNetServer::Recv(CNetChunk *pChunk)
 {
 	unsigned Now = time_timestamp();
-	
+
 	while(1)
 	{
 		NETADDR Addr;
-			
+
 		// check for a chunk
 		if(m_RecvUnpacker.FetchChunk(pChunk))
 			return 1;
-		
+
 		// TODO: empty the recvinfo
 		int Bytes = net_udp_recv(m_Socket, &Addr, m_RecvUnpacker.m_aBuffer, NET_MAX_PACKETSIZE);
 
 		// no more packets for now
 		if(Bytes <= 0)
 			break;
-		
+
 		if(CNetBase::UnpackPacket(m_RecvUnpacker.m_aBuffer, Bytes, &m_RecvUnpacker.m_Data) == 0)
 		{
 			CBan *pBan = 0;
@@ -294,14 +294,14 @@ int CNetServer::Recv(CNetChunk *pChunk)
 							BanAddr.ip[8]+BanAddr.ip[9]+BanAddr.ip[10]+BanAddr.ip[11]+BanAddr.ip[12]+BanAddr.ip[13]+BanAddr.ip[14]+BanAddr.ip[15])&0xff;
 			int Found = 0;
 			BanAddr.port = 0;
-			
+
 			// search a ban
 			for(pBan = m_aBans[IpHash]; pBan; pBan = pBan->m_pHashNext)
 			{
 				if(net_addr_comp(&pBan->m_Info.m_Addr, &BanAddr) == 0)
 					break;
 			}
-			
+
 			// check if we just should drop the packet
 			if(pBan)
 			{
@@ -320,7 +320,7 @@ int CNetServer::Recv(CNetChunk *pChunk)
 				CNetBase::SendControlMsg(m_Socket, &Addr, 0, NET_CTRLMSG_CLOSE, BanStr, str_length(BanStr)+1);
 				continue;
 			}
-			
+
 			if(m_RecvUnpacker.m_Data.m_Flags&NET_PACKETFLAG_CONNLESS)
 			{
 				pChunk->m_Flags = NETSENDFLAG_CONNLESS;
@@ -331,12 +331,12 @@ int CNetServer::Recv(CNetChunk *pChunk)
 				return 1;
 			}
 			else
-			{			
+			{
 				// TODO: check size here
 				if(m_RecvUnpacker.m_Data.m_Flags&NET_PACKETFLAG_CONTROL && m_RecvUnpacker.m_Data.m_aChunkData[0] == NET_CTRLMSG_CONNECT)
 				{
 					Found = 0;
-				
+
 					// check if we already got this client
 					for(int i = 0; i < MaxClients(); i++)
 					{
@@ -348,7 +348,7 @@ int CNetServer::Recv(CNetChunk *pChunk)
 							break;
 						}
 					}
-					
+
 					// client that wants to connect
 					if(!Found)
 					{
@@ -386,7 +386,7 @@ int CNetServer::Recv(CNetChunk *pChunk)
 								break;
 							}
 						}
-						
+
 						if(!Found)
 						{
 							const char FullMsg[] = "This server is full";
@@ -423,7 +423,7 @@ int CNetServer::Send(CNetChunk *pChunk)
 		dbg_msg("netserver", "packet payload too big. %d. dropping packet", pChunk->m_DataSize);
 		return -1;
 	}
-	
+
 	if(pChunk->m_Flags&NETSENDFLAG_CONNLESS)
 	{
 		// send connectionless packet
@@ -434,10 +434,10 @@ int CNetServer::Send(CNetChunk *pChunk)
 		int Flags = 0;
 		dbg_assert(pChunk->m_ClientID >= 0, "errornous client id");
 		dbg_assert(pChunk->m_ClientID < MaxClients(), "errornous client id");
-		
+
 		if(pChunk->m_Flags&NETSENDFLAG_VITAL)
 			Flags = NET_CHUNKFLAG_VITAL;
-		
+
 		if(m_aSlots[pChunk->m_ClientID].m_Connection.QueueChunk(Flags, pChunk->m_DataSize, pChunk->m_pData) == 0)
 		{
 			if(pChunk->m_Flags&NETSENDFLAG_FLUSH)
diff --git a/src/engine/shared/packer.cpp b/src/engine/shared/packer.cpp
index cd211468..cc218825 100644
--- a/src/engine/shared/packer.cpp
+++ b/src/engine/shared/packer.cpp
@@ -17,7 +17,7 @@ void CPacker::AddInt(int i)
 {
 	if(m_Error)
 		return;
-		
+
 	// make sure that we have space enough
 	if(m_pEnd - m_pCurrent < 6)
 	{
@@ -32,7 +32,7 @@ void CPacker::AddString(const char *pStr, int Limit)
 {
 	if(m_Error)
 		return;
-	
+
 	//
 	if(Limit > 0)
 	{
@@ -40,7 +40,7 @@ void CPacker::AddString(const char *pStr, int Limit)
 		{
 			*m_pCurrent++ = *pStr++;
 			Limit--;
-			
+
 			if(m_pCurrent >= m_pEnd)
 			{
 				m_Error = 1;
@@ -69,13 +69,13 @@ void CPacker::AddRaw(const void *pData, int Size)
 {
 	if(m_Error)
 		return;
-		
+
 	if(m_pCurrent+Size >= m_pEnd)
 	{
 		m_Error = 1;
 		return;
 	}
-	
+
 	const unsigned char *pSrc = (const unsigned char *)pData;
 	while(Size)
 	{
@@ -97,13 +97,13 @@ int CUnpacker::GetInt()
 {
 	if(m_Error)
 		return 0;
-		
+
 	if(m_pCurrent >= m_pEnd)
 	{
 		m_Error = 1;
 		return 0;
 	}
-	
+
 	int i;
 	m_pCurrent = CVariableInt::Unpack(m_pCurrent, &i);
 	if(m_pCurrent > m_pEnd)
@@ -118,7 +118,7 @@ const char *CUnpacker::GetString(int SanitizeType)
 {
 	if(m_Error || m_pCurrent >= m_pEnd)
 		return "";
-		
+
 	char *pPtr = (char *)m_pCurrent;
 	while(*m_pCurrent) // skip the string
 	{
@@ -130,7 +130,7 @@ const char *CUnpacker::GetString(int SanitizeType)
 		}
 	}
 	m_pCurrent++;
-	
+
 	// sanitize all strings
 	if(SanitizeType&SANITIZE)
 		str_sanitize(pPtr);
@@ -144,7 +144,7 @@ const unsigned char *CUnpacker::GetRaw(int Size)
 	const unsigned char *pPtr = m_pCurrent;
 	if(m_Error)
 		return 0;
-	
+
 	// check for nasty sizes
 	if(Size < 0 || m_pCurrent+Size > m_pEnd)
 	{
diff --git a/src/engine/shared/packer.h b/src/engine/shared/packer.h
index 9091370a..bd04e36e 100644
--- a/src/engine/shared/packer.h
+++ b/src/engine/shared/packer.h
@@ -21,7 +21,7 @@ public:
 	void AddInt(int i);
 	void AddString(const char *pStr, int Limit);
 	void AddRaw(const void *pData, int Size);
-	
+
 	int Size() const { return (int)(m_pCurrent-m_aBuffer); }
 	const unsigned char *Data() const { return m_aBuffer; }
 	bool Error() const { return m_Error; }
diff --git a/src/engine/shared/protocol.h b/src/engine/shared/protocol.h
index 859f4941..4a4895ad 100644
--- a/src/engine/shared/protocol.h
+++ b/src/engine/shared/protocol.h
@@ -7,13 +7,13 @@
 
 /*
 	Connection diagram - How the initilization works.
-	
+
 	Client -> INFO -> Server
 		Contains version info, name, and some other info.
-		
+
 	Client <- MAP <- Server
 		Contains current map.
-	
+
 	Client -> READY -> Server
 		The client has loaded the map and is ready to go,
 		but the mod needs to send it's information aswell.
@@ -21,7 +21,7 @@
 		mods_connected is called on the server.
 		The client should call client_entergame when the
 		mod has done it's initilization.
-		
+
 	Client -> ENTERGAME -> Server
 		Tells the server to start sending snapshots.
 		client_entergame and server_client_enter is called.
@@ -31,11 +31,11 @@
 enum
 {
 	NETMSG_NULL=0,
-	
+
 	// the first thing sent by the client
 	// contains the version info for the client
 	NETMSG_INFO=1,
-	
+
 	// sent by server
 	NETMSG_MAP_CHANGE,		// sent when client should switch map
 	NETMSG_MAP_DATA,		// map transfer, contains a chunk of the map file
@@ -50,18 +50,18 @@ enum
 
 	NETMSG_AUTH_CHALLANGE,	//
 	NETMSG_AUTH_RESULT,		//
-	
+
 	// sent by client
 	NETMSG_READY,			//
 	NETMSG_ENTERGAME,
 	NETMSG_INPUT,			// contains the inputdata from the client
-	NETMSG_RCON_CMD,		// 
+	NETMSG_RCON_CMD,		//
 	NETMSG_RCON_AUTH,		//
 	NETMSG_REQUEST_MAP_DATA,//
 
 	NETMSG_AUTH_START,		//
 	NETMSG_AUTH_RESPONSE,	//
-	
+
 	// sent by both
 	NETMSG_PING,
 	NETMSG_PING_REPLY,
diff --git a/src/engine/shared/ringbuffer.cpp b/src/engine/shared/ringbuffer.cpp
index 172508d7..b9f55d73 100644
--- a/src/engine/shared/ringbuffer.cpp
+++ b/src/engine/shared/ringbuffer.cpp
@@ -3,7 +3,7 @@
 #include <base/system.h>
 
 #include "ringbuffer.h"
-	
+
 CRingBufferBase::CItem *CRingBufferBase::NextBlock(CItem *pItem)
 {
 	if(pItem->m_pNext)
@@ -27,19 +27,19 @@ CRingBufferBase::CItem *CRingBufferBase::MergeBack(CItem *pItem)
 	// merge the blocks
 	pItem->m_pPrev->m_Size += pItem->m_Size;
 	pItem->m_pPrev->m_pNext = pItem->m_pNext;
-	
+
 	// fixup pointers
 	if(pItem->m_pNext)
 		pItem->m_pNext->m_pPrev = pItem->m_pPrev;
 	else
 		m_pLast = pItem->m_pPrev;
-		
+
 	if(pItem == m_pProduce)
 		m_pProduce = pItem->m_pPrev;
-	
+
 	if(pItem == m_pConsume)
 		m_pConsume = pItem->m_pPrev;
-	
+
 	// return the current block
 	return pItem->m_pPrev;
 }
@@ -54,8 +54,8 @@ void CRingBufferBase::Init(void *pMemory, int Size, int Flags)
 	m_pLast = m_pFirst;
 	m_pProduce = m_pFirst;
 	m_pConsume = m_pFirst;
-	m_Flags = Flags;		
-	
+	m_Flags = Flags;
+
 }
 
 void *CRingBufferBase::Allocate(int Size)
@@ -67,7 +67,7 @@ void *CRingBufferBase::Allocate(int Size)
 	if(WantedSize > m_Size)
 		return 0;
 
-	while(1)	
+	while(1)
 	{
 		// check for space
 		if(m_pProduce->m_Free)
@@ -81,7 +81,7 @@ void *CRingBufferBase::Allocate(int Size)
 					pBlock = m_pFirst;
 			}
 		}
-		
+
 		if(pBlock)
 			break;
 		else
@@ -96,9 +96,9 @@ void *CRingBufferBase::Allocate(int Size)
 				return 0;
 		}
 	}
-	
+
 	// okey, we have our block
-	
+
 	// split the block if needed
 	if(pBlock->m_Size > WantedSize+(int)sizeof(CItem))
 	{
@@ -108,19 +108,19 @@ void *CRingBufferBase::Allocate(int Size)
 		if(pNewItem->m_pNext)
 			pNewItem->m_pNext->m_pPrev = pNewItem;
 		pBlock->m_pNext = pNewItem;
-		
+
 		pNewItem->m_Free = 1;
 		pNewItem->m_Size = pBlock->m_Size - WantedSize;
 		pBlock->m_Size = WantedSize;
-		
+
 		if(!pNewItem->m_pNext)
 			m_pLast = pNewItem;
 	}
-	
-	
+
+
 	// set next block
 	m_pProduce = NextBlock(pBlock);
-	
+
 	// set as used and return the item pointer
 	pBlock->m_Free = 0;
 	return (void *)(pBlock+1);
@@ -130,13 +130,13 @@ int CRingBufferBase::PopFirst()
 {
 	if(m_pConsume->m_Free)
 		return 0;
-	
+
 	// set the free flag
 	m_pConsume->m_Free = 1;
-	
+
 	// previous block is also free, merge them
 	m_pConsume = MergeBack(m_pConsume);
-	
+
 	// advance the consume pointer
 	m_pConsume = NextBlock(m_pConsume);
 	while(m_pConsume->m_Free && m_pConsume != m_pProduce)
@@ -144,7 +144,7 @@ int CRingBufferBase::PopFirst()
 		m_pConsume = MergeBack(m_pConsume);
 		m_pConsume = NextBlock(m_pConsume);
 	}
-		
+
 	// in the case that we have catched up with the produce pointer
 	// we might stand on a free block so merge em
 	MergeBack(m_pConsume);
@@ -155,7 +155,7 @@ int CRingBufferBase::PopFirst()
 void *CRingBufferBase::Prev(void *pCurrent)
 {
 	CItem *pItem = ((CItem *)pCurrent) - 1;
-	
+
 	while(1)
 	{
 		pItem = PrevBlock(pItem);
@@ -169,7 +169,7 @@ void *CRingBufferBase::Prev(void *pCurrent)
 void *CRingBufferBase::Next(void *pCurrent)
 {
 	CItem *pItem = ((CItem *)pCurrent) - 1;
-	
+
 	while(1)
 	{
 		pItem = NextBlock(pItem);
diff --git a/src/engine/shared/ringbuffer.h b/src/engine/shared/ringbuffer.h
index 9f0c5a1d..c4774528 100644
--- a/src/engine/shared/ringbuffer.h
+++ b/src/engine/shared/ringbuffer.h
@@ -15,28 +15,28 @@ class CRingBufferBase
 		int m_Free;
 		int m_Size;
 	};
-	
+
 	CItem *m_pProduce;
 	CItem *m_pConsume;
-	
+
 	CItem *m_pFirst;
 	CItem *m_pLast;
-	
+
 	void *m_pMemory;
 	int m_Size;
 	int m_Flags;
-	
+
 	CItem *NextBlock(CItem *pItem);
 	CItem *PrevBlock(CItem *pItem);
 	CItem *MergeBack(CItem *pItem);
 protected:
 	void *Allocate(int Size);
-	
+
 	void *Prev(void *pCurrent);
 	void *Next(void *pCurrent);
 	void *First();
 	void *Last();
-	
+
 	void Init(void *pMemory, int Size, int Flags);
 	int PopFirst();
 public:
@@ -53,9 +53,9 @@ class TStaticRingBuffer : public CRingBufferBase
 	unsigned char m_aBuffer[TSIZE];
 public:
 	TStaticRingBuffer() { Init(); }
-	
+
 	void Init() { CRingBufferBase::Init(m_aBuffer, TSIZE, TFLAGS); }
-	
+
 	T *Allocate(int Size) { return (T*)CRingBufferBase::Allocate(Size); }
 	int PopFirst() { return CRingBufferBase::PopFirst(); }
 
diff --git a/src/engine/shared/snapshot.cpp b/src/engine/shared/snapshot.cpp
index fee6afa2..9ef8fdc3 100644
--- a/src/engine/shared/snapshot.cpp
+++ b/src/engine/shared/snapshot.cpp
@@ -12,31 +12,31 @@ CSnapshotItem *CSnapshot::GetItem(int Index)
 
 int CSnapshot::GetItemSize(int Index)
 {
-    if(Index == m_NumItems-1)
-        return (m_DataSize - Offsets()[Index]) - sizeof(CSnapshotItem);
-    return (Offsets()[Index+1] - Offsets()[Index]) - sizeof(CSnapshotItem);
+	if(Index == m_NumItems-1)
+		return (m_DataSize - Offsets()[Index]) - sizeof(CSnapshotItem);
+	return (Offsets()[Index+1] - Offsets()[Index]) - sizeof(CSnapshotItem);
 }
 
 int CSnapshot::GetItemIndex(int Key)
 {
-    // TODO: OPT: this should not be a linear search. very bad
-    for(int i = 0; i < m_NumItems; i++)
-    {
-        if(GetItem(i)->Key() == Key)
-            return i;
-    }
-    return -1;
+	// TODO: OPT: this should not be a linear search. very bad
+	for(int i = 0; i < m_NumItems; i++)
+	{
+		if(GetItem(i)->Key() == Key)
+			return i;
+	}
+	return -1;
 }
 
 int CSnapshot::Crc()
 {
 	int Crc = 0;
-	
+
 	for(int i = 0; i < m_NumItems; i++)
 	{
 		CSnapshotItem *pItem = GetItem(i);
 		int Size = GetItemSize(i);
-		
+
 		for(int b = 0; b < Size/4; b++)
 			Crc += pItem->Data()[b];
 	}
@@ -75,7 +75,7 @@ static void GenerateHash(CItemList *pHashlist, CSnapshot *pSnapshot)
 {
 	for(int i = 0; i < HASHLIST_SIZE; i++)
 		pHashlist[i].m_Num = 0;
-		
+
 	for(int i = 0; i < pSnapshot->NumItems(); i++)
 	{
 		int Key = pSnapshot->GetItem(i)->Key();
@@ -97,7 +97,7 @@ static int GetItemIndexHashed(int Key, const CItemList *pHashlist)
 			if(pHashlist[HashID].m_aKeys[i] == Key)
 				return pHashlist[HashID].m_aIndex[i];
 	}
-	
+
 	return -1;
 }
 
@@ -113,7 +113,7 @@ static int DiffItem(int *pPast, int *pCurrent, int *pOut, int Size)
 		pCurrent++;
 		Size--;
 	}
-	
+
 	return Needed;
 }
 
@@ -122,16 +122,16 @@ void CSnapshotDelta::UndiffItem(int *pPast, int *pDiff, int *pOut, int Size)
 	while(Size)
 	{
 		*pOut = *pPast+*pDiff;
-		
+
 		if(*pDiff == 0)
 			m_aSnapshotDataRate[m_SnapshotCurrent] += 1;
 		else
 		{
 			unsigned char aBuf[16];
-			unsigned char *pEnd = CVariableInt::Pack(aBuf,  *pDiff);
+			unsigned char *pEnd = CVariableInt::Pack(aBuf, *pDiff);
 			m_aSnapshotDataRate[m_SnapshotCurrent] += (int)(pEnd - (unsigned char*)aBuf) * 8;
 		}
-		
+
 		pOut++;
 		pPast++;
 		pDiff++;
@@ -169,11 +169,11 @@ int CSnapshotDelta::CreateDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pDstData
 	CSnapshotItem *pPastItem;
 	int Count = 0;
 	int SizeCount = 0;
-	
+
 	pDelta->m_NumDeletedItems = 0;
 	pDelta->m_NumUpdateItems = 0;
 	pDelta->m_NumTempItems = 0;
-	
+
 	CItemList Hashlist[HASHLIST_SIZE];
 	GenerateHash(Hashlist, pTo);
 
@@ -189,7 +189,7 @@ int CSnapshotDelta::CreateDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pDstData
 			pData++;
 		}
 	}
-	
+
 	GenerateHash(Hashlist, pFrom);
 	int aPastIndecies[1024];
 
@@ -197,29 +197,29 @@ int CSnapshotDelta::CreateDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pDstData
 	// we do this as a separate pass because it helps the cache
 	for(i = 0; i < pTo->NumItems(); i++)
 	{
-		pCurItem = pTo->GetItem(i);  // O(1) .. O(n)
+		pCurItem = pTo->GetItem(i); // O(1) .. O(n)
 		aPastIndecies[i] = GetItemIndexHashed(pCurItem->Key(), Hashlist); // O(n) .. O(n^n)
 	}
-		
+
 	for(i = 0; i < pTo->NumItems(); i++)
 	{
 		// do delta
 		ItemSize = pTo->GetItemSize(i); // O(1) .. O(n)
-		pCurItem = pTo->GetItem(i);  // O(1) .. O(n)
+		pCurItem = pTo->GetItem(i); // O(1) .. O(n)
 		PastIndex = aPastIndecies[i];
-		
+
 		if(PastIndex != -1)
 		{
 			int *pItemDataDst = pData+3;
-	
+
 			pPastItem = pFrom->GetItem(PastIndex);
-			
+
 			if(m_aItemSizes[pCurItem->Type()])
 				pItemDataDst = pData+2;
-			
+
 			if(DiffItem((int*)pPastItem->Data(), (int*)pCurItem->Data(), pItemDataDst, ItemSize/4))
 			{
-				
+
 				*pData++ = pCurItem->Type();
 				*pData++ = pCurItem->ID();
 				if(!m_aItemSizes[pCurItem->Type()])
@@ -234,7 +234,7 @@ int CSnapshotDelta::CreateDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pDstData
 			*pData++ = pCurItem->ID();
 			if(!m_aItemSizes[pCurItem->Type()])
 				*pData++ = ItemSize/4;
-			
+
 			mem_copy(pData, pCurItem->Data(), ItemSize);
 			SizeCount += ItemSize;
 			pData += ItemSize/4;
@@ -242,7 +242,7 @@ int CSnapshotDelta::CreateDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pDstData
 			Count++;
 		}
 	}
-	
+
 	if(0)
 	{
 		dbg_msg("snapshot", "%d %d %d",
@@ -253,7 +253,7 @@ int CSnapshotDelta::CreateDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pDstData
 
 	/*
 	// TODO: pack temp stuff
-	
+
 	// finish
 	//mem_copy(pDelta->offsets, deleted, pDelta->num_deleted_items*sizeof(int));
 	//mem_copy(&(pDelta->offsets[pDelta->num_deleted_items]), update, pDelta->num_update_items*sizeof(int));
@@ -261,10 +261,10 @@ int CSnapshotDelta::CreateDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pDstData
 	//mem_copy(pDelta->data_start(), data, data_size);
 	//pDelta->data_size = data_size;
 	* */
-	
+
 	if(!pDelta->m_NumDeletedItems && !pDelta->m_NumUpdateItems && !pDelta->m_NumTempItems)
 		return 0;
-	
+
 	return (int)((char*)pData-(char*)pDstData);
 }
 
@@ -281,16 +281,16 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData
 	CData *pDelta = (CData *)pSrcData;
 	int *pData = (int *)pDelta->m_pData;
 	int *pEnd = (int *)(((char *)pSrcData + DataSize));
-	
+
 	CSnapshotItem *pFromItem;
 	int Keep, ItemSize;
 	int *pDeleted;
 	int ID, Type, Key;
 	int FromIndex;
 	int *pNewData;
-			
+
 	Builder.Init();
-	
+
 	// unpack deleted stuff
 	pDeleted = pData;
 	pData += pDelta->m_NumDeletedItems;
@@ -302,7 +302,7 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData
 	{
 		// dbg_assert(0, "fail!");
 		pFromItem = pFrom->GetItem(i);
-		ItemSize = pFrom->GetItemSize(i); 
+		ItemSize = pFrom->GetItemSize(i);
 		Keep = 1;
 		for(int d = 0; d < pDelta->m_NumDeletedItems; d++)
 		{
@@ -312,7 +312,7 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData
 				break;
 			}
 		}
-		
+
 		if(Keep)
 		{
 			// keep it
@@ -321,13 +321,13 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData
 				pFromItem->Data(), ItemSize);
 		}
 	}
-		
+
 	// unpack updated stuff
 	for(int i = 0; i < pDelta->m_NumUpdateItems; i++)
 	{
 		if(pData+2 > pEnd)
 			return -1;
-		
+
 		Type = *pData++;
 		ID = *pData++;
 		if(m_aItemSizes[Type])
@@ -339,18 +339,18 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData
 			ItemSize = (*pData++) * 4;
 		}
 		m_SnapshotCurrent = Type;
-		
+
 		if(RangeCheck(pEnd, pData, ItemSize) || ItemSize < 0) return -3;
-		
+
 		Key = (Type<<16)|ID;
-		
+
 		// create the item if needed
 		pNewData = Builder.GetItemData(Key);
 		if(!pNewData)
 			pNewData = (int *)Builder.NewItem(Key>>16, Key&0xffff, ItemSize);
 
 		//if(range_check(pEnd, pNewData, ItemSize)) return -4;
-			
+
 		FromIndex = pFrom->GetItemIndex(Key);
 		if(FromIndex != -1)
 		{
@@ -364,10 +364,10 @@ int CSnapshotDelta::UnpackDelta(CSnapshot *pFrom, CSnapshot *pTo, void *pSrcData
 			m_aSnapshotDataRate[m_SnapshotCurrent] += ItemSize*8;
 			m_aSnapshotDataUpdates[m_SnapshotCurrent]++;
 		}
-			
+
 		pData += ItemSize/4;
 	}
-	
+
 	// finish up
 	return Builder.Finish(pTo);
 }
@@ -402,24 +402,24 @@ void CSnapshotStorage::PurgeUntil(int Tick)
 {
 	CHolder *pHolder = m_pFirst;
 	CHolder *pNext;
-	
+
 	while(pHolder)
 	{
 		pNext = pHolder->m_pNext;
 		if(pHolder->m_Tick >= Tick)
 			return; // no more to remove
 		mem_free(pHolder);
-		
+
 		// did we come to the end of the list?
-        if (!pNext)
-            break;
+		if (!pNext)
+			break;
 
 		m_pFirst = pNext;
 		pNext->m_pPrev = 0x0;
-		
+
 		pHolder = pNext;
 	}
-	
+
 	// no more snapshots in storage
 	m_pFirst = 0;
 	m_pLast = 0;
@@ -429,12 +429,12 @@ void CSnapshotStorage::Add(int Tick, int64 Tagtime, int DataSize, void *pData, i
 {
 	// allocate memory for holder + snapshot_data
 	int TotalSize = sizeof(CHolder)+DataSize;
-	
+
 	if(CreateAlt)
 		TotalSize += DataSize;
-	
+
 	CHolder *pHolder = (CHolder *)mem_alloc(TotalSize, 1);
-	
+
 	// set data
 	pHolder->m_Tick = Tick;
 	pHolder->m_Tagtime = Tagtime;
@@ -449,8 +449,8 @@ void CSnapshotStorage::Add(int Tick, int64 Tagtime, int DataSize, void *pData, i
 	}
 	else
 		pHolder->m_pAltSnap = 0;
-		
-	
+
+
 	// link
 	pHolder->m_pNext = 0;
 	pHolder->m_pPrev = m_pLast;
@@ -464,7 +464,7 @@ void CSnapshotStorage::Add(int Tick, int64 Tagtime, int DataSize, void *pData, i
 int CSnapshotStorage::Get(int Tick, int64 *pTagtime, CSnapshot **ppData, CSnapshot **ppAltData)
 {
 	CHolder *pHolder = m_pFirst;
-	
+
 	while(pHolder)
 	{
 		if(pHolder->m_Tick == Tick)
@@ -477,10 +477,10 @@ int CSnapshotStorage::Get(int Tick, int64 *pTagtime, CSnapshot **ppData, CSnapsh
 				*ppData = pHolder->m_pAltSnap;
 			return pHolder->m_SnapSize;
 		}
-		
+
 		pHolder = pHolder->m_pNext;
 	}
-	
+
 	return -1;
 }
 
@@ -492,7 +492,7 @@ void CSnapshotBuilder::Init()
 	m_NumItems = 0;
 }
 
-CSnapshotItem *CSnapshotBuilder::GetItem(int Index) 
+CSnapshotItem *CSnapshotBuilder::GetItem(int Index)
 {
 	return (CSnapshotItem *)&(m_aData[m_aOffsets[Index]]);
 }
diff --git a/src/engine/shared/snapshot.h b/src/engine/shared/snapshot.h
index 34c3a548..ebd13f20 100644
--- a/src/engine/shared/snapshot.h
+++ b/src/engine/shared/snapshot.h
@@ -11,7 +11,7 @@ class CSnapshotItem
 {
 public:
 	int m_TypeAndID;
-	
+
 	int *Data() { return (int *)(this+1); }
 	int Type() { return m_TypeAndID>>16; }
 	int ID() { return m_TypeAndID&0xffff; }
@@ -90,15 +90,15 @@ public:
 	public:
 		CHolder *m_pPrev;
 		CHolder *m_pNext;
-		
+
 		int64 m_Tagtime;
 		int m_Tick;
-		
+
 		int m_SnapSize;
 		CSnapshot *m_pSnap;
 		CSnapshot *m_pAltSnap;
 	};
-	 
+
 
 	CHolder *m_pFirst;
 	CHolder *m_pLast;
@@ -125,12 +125,12 @@ class CSnapshotBuilder
 
 public:
 	void Init();
-	
+
 	void *NewItem(int Type, int ID, int Size);
-	
+
 	CSnapshotItem *GetItem(int Index);
 	int *GetItemData(int Key);
-	
+
 	int Finish(void *Snapdata);
 };
 
diff --git a/src/engine/shared/storage.cpp b/src/engine/shared/storage.cpp
index db19fcdc..d6f83dc8 100644
--- a/src/engine/shared/storage.cpp
+++ b/src/engine/shared/storage.cpp
@@ -21,7 +21,7 @@ public:
 	char m_aDatadir[MAX_PATH_LENGTH];
 	char m_aUserdir[MAX_PATH_LENGTH];
 	char m_aCurrentdir[MAX_PATH_LENGTH];
-	
+
 	CStorage()
 	{
 		mem_zero(m_aaStoragePaths, sizeof(m_aaStoragePaths));
@@ -29,7 +29,7 @@ public:
 		m_aDatadir[0] = 0;
 		m_aUserdir[0] = 0;
 	}
-	
+
 	int Init(const char *pApplicationName, int NumArgs, const char **ppArguments)
 	{
 		// get userdir
@@ -85,7 +85,7 @@ public:
 				str_append(aBuffer, "/storage.cfg", sizeof(aBuffer));
 				File = io_open(aBuffer, IOFLAG_READ);
 			}
-			
+
 			if(Pos >= MAX_PATH_LENGTH || !File)
 			{
 				dbg_msg("storage", "couldn't open storage.cfg");
@@ -151,7 +151,7 @@ public:
 			}
 		}
 	}
-		
+
 	void FindDatadir(const char *pArgv0)
 	{
 		// 1) use data-dir in PWD if present
@@ -160,35 +160,35 @@ public:
 			str_copy(m_aDatadir, "data", sizeof(m_aDatadir));
 			return;
 		}
-		
+
 		// 2) use compiled-in data-dir if present
 		if(fs_is_dir(DATA_DIR "/mapres"))
 		{
 			str_copy(m_aDatadir, DATA_DIR, sizeof(m_aDatadir));
 			return;
 		}
-		
+
 		// 3) check for usable path in argv[0]
 		{
 			unsigned int Pos = ~0U;
 			for(unsigned i = 0; pArgv0[i]; i++)
 				if(pArgv0[i] == '/' || pArgv0[i] == '\\')
 					Pos = i;
-			
+
 			if(Pos < MAX_PATH_LENGTH)
 			{
 				char aBaseDir[MAX_PATH_LENGTH];
 				str_copy(aBaseDir, pArgv0, Pos+1);
 				str_format(m_aDatadir, sizeof(m_aDatadir), "%s/data", aBaseDir);
 				str_append(aBaseDir, "/data/mapres", sizeof(aBaseDir));
-				
+
 				if(fs_is_dir(aBaseDir))
 					return;
 				else
 					m_aDatadir[0] = 0;
 			}
 		}
-		
+
 	#if defined(CONF_FAMILY_UNIX)
 		// 4) check for all default locations
 		{
@@ -200,7 +200,7 @@ public:
 				"/opt/teeworlds/data"
 			};
 			const int DirsCount = sizeof(aDirs) / sizeof(aDirs[0]);
-			
+
 			int i;
 			for (i = 0; i < DirsCount; i++)
 			{
@@ -214,7 +214,7 @@ public:
 			}
 		}
 	#endif
-		
+
 		// no data-dir found
 		dbg_msg("storage", "warning no data directory found");
 	}
@@ -240,7 +240,7 @@ public:
 		str_format(pBuffer, BufferSize, "%s%s%s", m_aaStoragePaths[Type], !m_aaStoragePaths[Type][0] ? "" : "/", pDir);
 		return pBuffer;
 	}
-	
+
 	virtual IOHANDLE OpenFile(const char *pFilename, int Flags, int Type, char *pBuffer = 0, int BufferSize = 0)
 	{
 		char aBuffer[MAX_PATH_LENGTH];
@@ -249,7 +249,7 @@ public:
 			pBuffer = aBuffer;
 			BufferSize = sizeof(aBuffer);
 		}
-		
+
 		if(Flags&IOFLAG_WRITE)
 		{
 			return io_open(GetPath(TYPE_SAVE, pFilename, pBuffer, BufferSize), Flags);
@@ -276,11 +276,11 @@ public:
 					return Handle;
 			}
 		}
-		
+
 		pBuffer[0] = 0;
-		return 0;		
+		return 0;
 	}
- 	
+
 	struct CFindCBData
 	{
 		CStorage *pStorage;
@@ -321,7 +321,7 @@ public:
 	{
 		if(BufferSize < 1)
 			return false;
-		
+
 		pBuffer[0] = 0;
 		char aBuf[MAX_PATH_LENGTH];
 		CFindCBData Data;
diff --git a/src/engine/storage.h b/src/engine/storage.h
index e0cab12f..1fd48f6a 100644
--- a/src/engine/storage.h
+++ b/src/engine/storage.h
@@ -14,7 +14,7 @@ public:
 		TYPE_SAVE = 0,
 		TYPE_ALL = -1
 	};
-	
+
 	virtual void ListDirectory(int Type, const char *pPath, FS_LISTDIR_CALLBACK pfnCallback, void *pUser) = 0;
 	virtual IOHANDLE OpenFile(const char *pFilename, int Flags, int Type, char *pBuffer = 0, int BufferSize = 0) = 0;
 	virtual bool FindFile(const char *pFilename, const char *pPath, int Type, char *pBuffer, int BufferSize) = 0;
diff --git a/src/engine/textrender.h b/src/engine/textrender.h
index 8d13f605..ddd2be5b 100644
--- a/src/engine/textrender.h
+++ b/src/engine/textrender.h
@@ -20,12 +20,12 @@ public:
 	int m_LineCount;
 	int m_CharCount;
 	int m_MaxLines;
-	
+
 	float m_StartX;
 	float m_StartY;
 	float m_LineWidth;
 	float m_X, m_Y;
-	
+
 	CFont *m_pFont;
 	float m_FontSize;
 };
@@ -35,15 +35,15 @@ class ITextRender : public IInterface
 	MACRO_INTERFACE("textrender", 0)
 public:
 	virtual void SetCursor(CTextCursor *pCursor, float x, float y, float FontSize, int Flags) = 0;
-	
+
 	virtual CFont *LoadFont(const char *pFilename) = 0;
 	virtual void DestroyFont(CFont *pFont) = 0;
-	
+
 	virtual void SetDefaultFont(CFont *pFont) = 0;
 
 	//
 	virtual void TextEx(CTextCursor *pCursor, const char *pText, int Length) = 0;
-	
+
 	// old foolish interface
 	virtual void TextColor(float r, float g, float b, float a) = 0;
 	virtual void TextOutlineColor(float r, float g, float b, float a) = 0;