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
This commit is contained in:
Magnus Auvinen 2012-08-17 00:03:53 +02:00 committed by oy
parent 6af382ade1
commit 98042012a6
9 changed files with 35 additions and 27 deletions

View file

@ -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)
{

View file

@ -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;

View file

@ -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();
}

View file

@ -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);
};

View file

@ -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]);
}

View file

@ -6,6 +6,7 @@
#include <engine/storage.h>
#include <versionsrv/versionsrv.h>
#include <versionsrv/mapversions.h>
#include "datafile.h"
#include "memheap.h"

View file

@ -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);

View file

@ -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

View file

@ -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'};