about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2012-08-17 00:03:53 +0200
committeroy <Tom_Adams@web.de>2013-02-24 17:54:29 +0100
commit98042012a6c6e639c9736b32518dd082ca539615 (patch)
tree069cdf4a2149dde7c5efcce1df56942f89bc3365 /src
parent6af382ade1d350091545dd24ab79020bda7825f2 (diff)
downloadzcatch-98042012a6c6e639c9736b32518dd082ca539615.tar.gz
zcatch-98042012a6c6e639c9736b32518dd082ca539615.zip
cleaned up warnings that clang spits out. some bugs found with it.
Conflicts:

	src/game/server/gamemodes/ctf.cpp
	src/game/server/gamemodes/ctf.h
Diffstat (limited to 'src')
-rw-r--r--src/base/tl/range.h2
-rw-r--r--src/engine/client/graphics_threaded.h2
-rw-r--r--src/engine/server/server.cpp4
-rw-r--r--src/engine/server/server.h6
-rw-r--r--src/engine/shared/console.cpp6
-rw-r--r--src/engine/shared/mapchecker.cpp1
-rw-r--r--src/engine/shared/netban.h2
-rw-r--r--src/versionsrv/mapversions.h22
-rw-r--r--src/versionsrv/versionsrv.h17
9 files changed, 35 insertions, 27 deletions
diff --git a/src/base/tl/range.h b/src/base/tl/range.h
index f1fc070b..1d225f49 100644
--- a/src/base/tl/range.h
+++ b/src/base/tl/range.h
@@ -154,7 +154,7 @@ public:
 	void pop_back() { tl_assert(!empty()); end--; }
 	T& front() { tl_assert(!empty()); return *begin; }
 	T& back() { tl_assert(!empty()); return *(end-1); }
-	T& index(unsigned i) { tl_assert(i >= 0 && i < (unsigned)(end-begin)); return begin[i]; }
+	T& index(unsigned i) { tl_assert(i < (unsigned)(end-begin)); return begin[i]; }
 	unsigned size() const { return (unsigned)(end-begin); }
 	plain_range slice(unsigned startindex, unsigned endindex)
 	{
diff --git a/src/engine/client/graphics_threaded.h b/src/engine/client/graphics_threaded.h
index b88ee3cb..5c15d062 100644
--- a/src/engine/client/graphics_threaded.h
+++ b/src/engine/client/graphics_threaded.h
@@ -296,6 +296,8 @@ public:
 		INITFLAG_BORDERLESS = 8,
 	};
 
+	virtual ~IGraphicsBackend() {}
+
 	virtual int Init(const char *pName, int *Width, int *Height, int FsaaSamples, int Flags) = 0;
 	virtual int Shutdown() = 0;
 
diff --git a/src/engine/server/server.cpp b/src/engine/server/server.cpp
index 3cad5d1c..4b7f6332 100644
--- a/src/engine/server/server.cpp
+++ b/src/engine/server/server.cpp
@@ -145,7 +145,7 @@ void CSnapIDPool::FreeID(int ID)
 }
 
 
-void CServerBan::Init(IConsole *pConsole, IStorage *pStorage, CServer* pServer)
+void CServerBan::InitServerBan(IConsole *pConsole, IStorage *pStorage, CServer* pServer)
 {
 	CNetBan::Init(pConsole, pStorage);
 
@@ -1618,7 +1618,7 @@ void CServer::RegisterCommands()
 	Console()->Chain("console_output_level", ConchainConsoleOutputLevelUpdate, this);
 
 	// register console commands in sub parts
-	m_ServerBan.Init(Console(), Storage(), this);
+	m_ServerBan.InitServerBan(Console(), Storage(), this);
 	m_pGameServer->OnConsoleInit();
 }
 
diff --git a/src/engine/server/server.h b/src/engine/server/server.h
index 696b472d..c3c1794d 100644
--- a/src/engine/server/server.h
+++ b/src/engine/server/server.h
@@ -50,10 +50,10 @@ class CServerBan : public CNetBan
 public:
 	class CServer *Server() const { return m_pServer; }
 
-	void Init(class IConsole *pConsole, class IStorage *pStorage, class CServer* pServer);
+	void InitServerBan(class IConsole *pConsole, class IStorage *pStorage, class CServer* pServer);
 
-	int BanAddr(const NETADDR *pAddr, int Seconds, const char *pReason);
-	int BanRange(const CNetRange *pRange, int Seconds, const char *pReason);
+	virtual int BanAddr(const NETADDR *pAddr, int Seconds, const char *pReason);
+	virtual int BanRange(const CNetRange *pRange, int Seconds, const char *pReason);
 
 	static void ConBanExt(class IConsole::IResult *pResult, void *pUser);
 };
diff --git a/src/engine/shared/console.cpp b/src/engine/shared/console.cpp
index 443c5904..3ff3c5b3 100644
--- a/src/engine/shared/console.cpp
+++ b/src/engine/shared/console.cpp
@@ -16,21 +16,21 @@
 
 const char *CConsole::CResult::GetString(unsigned Index)
 {
-	if (Index < 0 || Index >= m_NumArgs)
+	if (Index >= m_NumArgs)
 		return "";
 	return m_apArgs[Index];
 }
 
 int CConsole::CResult::GetInteger(unsigned Index)
 {
-	if (Index < 0 || Index >= m_NumArgs)
+	if (Index >= m_NumArgs)
 		return 0;
 	return str_toint(m_apArgs[Index]);
 }
 
 float CConsole::CResult::GetFloat(unsigned Index)
 {
-	if (Index < 0 || Index >= m_NumArgs)
+	if (Index >= m_NumArgs)
 		return 0.0f;
 	return str_tofloat(m_apArgs[Index]);
 }
diff --git a/src/engine/shared/mapchecker.cpp b/src/engine/shared/mapchecker.cpp
index f8ba30ae..5a7d062f 100644
--- a/src/engine/shared/mapchecker.cpp
+++ b/src/engine/shared/mapchecker.cpp
@@ -6,6 +6,7 @@
 #include <engine/storage.h>
 
 #include <versionsrv/versionsrv.h>
+#include <versionsrv/mapversions.h>
 
 #include "datafile.h"
 #include "memheap.h"
diff --git a/src/engine/shared/netban.h b/src/engine/shared/netban.h
index 6d690164..70164832 100644
--- a/src/engine/shared/netban.h
+++ b/src/engine/shared/netban.h
@@ -170,7 +170,7 @@ public:
 	class IStorage *Storage() const { return m_pStorage; }
 
 	virtual ~CNetBan() {}
-	virtual void Init(class IConsole *pConsole, class IStorage *pStorage);
+	void Init(class IConsole *pConsole, class IStorage *pStorage);
 	void Update();
 
 	virtual int BanAddr(const NETADDR *pAddr, int Seconds, const char *pReason);
diff --git a/src/versionsrv/mapversions.h b/src/versionsrv/mapversions.h
new file mode 100644
index 00000000..fe9e4229
--- /dev/null
+++ b/src/versionsrv/mapversions.h
@@ -0,0 +1,22 @@
+/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
+/* If you are missing that file, acquire a complete release at teeworlds.com.                */
+#ifndef VERSIONSRV_MAPVERSIONS_H
+#define VERSIONSRV_MAPVERSIONS_H
+
+static CMapVersion s_aMapVersionList[] = {
+	{"ctf1", {0x06, 0xb5, 0xf1, 0x17}, {0x00, 0x00, 0x12, 0x38}},
+	{"ctf2", {0x27, 0xbc, 0x5e, 0xac}, {0x00, 0x00, 0x64, 0x1a}},
+	{"ctf3", {0xa3, 0x73, 0x9d, 0x41}, {0x00, 0x00, 0x17, 0x0f}},
+	{"ctf4", {0xbe, 0x7c, 0x4d, 0xb9}, {0x00, 0x00, 0x2e, 0xfe}},
+	{"ctf5", {0xd9, 0x21, 0x29, 0xa0}, {0x00, 0x00, 0x2f, 0x4c}},
+	{"ctf6", {0x28, 0xc8, 0x43, 0x51}, {0x00, 0x00, 0x69, 0x2f}},
+	{"ctf7", {0x1d, 0x35, 0x98, 0x72}, {0x00, 0x00, 0x15, 0x87}},
+	{"dm1", {0xf2, 0x15, 0x9e, 0x6e}, {0x00, 0x00, 0x16, 0xad}},
+	{"dm2", {0x71, 0x83, 0x98, 0x78}, {0x00, 0x00, 0x21, 0xdf}},
+	{"dm6", {0x47, 0x4d, 0xa2, 0x35}, {0x00, 0x00, 0x1e, 0x95}},
+	{"dm7", {0x42, 0x6d, 0xa1, 0x67}, {0x00, 0x00, 0x27, 0x2a}},
+	{"dm8", {0x85, 0xf1, 0x1e, 0xd6}, {0x00, 0x00, 0x9e, 0xbd}},
+	{"dm9", {0x42, 0xd4, 0x77, 0x7e}, {0x00, 0x00, 0x20, 0x11}},
+};
+static const int s_NumMapVersionItems = sizeof(s_aMapVersionList)/sizeof(CMapVersion);
+#endif
diff --git a/src/versionsrv/versionsrv.h b/src/versionsrv/versionsrv.h
index 383f1ac4..46f64251 100644
--- a/src/versionsrv/versionsrv.h
+++ b/src/versionsrv/versionsrv.h
@@ -11,23 +11,6 @@ struct CMapVersion
 	unsigned char m_aSize[4];
 };
 
-static CMapVersion s_aMapVersionList[] = {
-	{"ctf1", {0x06, 0xb5, 0xf1, 0x17}, {0x00, 0x00, 0x12, 0x38}},
-	{"ctf2", {0x27, 0xbc, 0x5e, 0xac}, {0x00, 0x00, 0x64, 0x1a}},
-	{"ctf3", {0xa3, 0x73, 0x9d, 0x41}, {0x00, 0x00, 0x17, 0x0f}},
-	{"ctf4", {0xbe, 0x7c, 0x4d, 0xb9}, {0x00, 0x00, 0x2e, 0xfe}},
-	{"ctf5", {0xd9, 0x21, 0x29, 0xa0}, {0x00, 0x00, 0x2f, 0x4c}},
-	{"ctf6", {0x28, 0xc8, 0x43, 0x51}, {0x00, 0x00, 0x69, 0x2f}},
-	{"ctf7", {0x1d, 0x35, 0x98, 0x72}, {0x00, 0x00, 0x15, 0x87}},
-	{"dm1", {0xf2, 0x15, 0x9e, 0x6e}, {0x00, 0x00, 0x16, 0xad}},
-	{"dm2", {0x71, 0x83, 0x98, 0x78}, {0x00, 0x00, 0x21, 0xdf}},
-	{"dm6", {0x47, 0x4d, 0xa2, 0x35}, {0x00, 0x00, 0x1e, 0x95}},
-	{"dm7", {0x42, 0x6d, 0xa1, 0x67}, {0x00, 0x00, 0x27, 0x2a}},
-	{"dm8", {0x85, 0xf1, 0x1e, 0xd6}, {0x00, 0x00, 0x9e, 0xbd}},
-	{"dm9", {0x42, 0xd4, 0x77, 0x7e}, {0x00, 0x00, 0x20, 0x11}},
-};
-static const int s_NumMapVersionItems = sizeof(s_aMapVersionList)/sizeof(CMapVersion);
-
 static const unsigned char VERSIONSRV_GETVERSION[] = {255, 255, 255, 255, 'v', 'e', 'r', 'g'};
 static const unsigned char VERSIONSRV_VERSION[] = {255, 255, 255, 255, 'v', 'e', 'r', 's'};