Compiler warnings

This commit is contained in:
def 2017-07-09 10:27:58 +02:00
parent 66f6f16e81
commit 46cedf3a8c
7 changed files with 29 additions and 17 deletions

20
bam.lua
View file

@ -226,7 +226,7 @@ function build(settings)
settings.cc.flags:Add("/wd4244")
settings.cc.flags:Add("/EHsc")
else
settings.cc.flags:Add("-Wall")
settings.cc.flags:Add("-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
if family == "windows" then
if config.compiler.driver == "gcc" then
settings.link.flags:Add("-static-libgcc")
@ -279,6 +279,12 @@ function build(settings)
settings.link.libs:Add("advapi32")
end
external_settings = settings:Copy()
if config.compiler.driver == "cl" then
external_settings.cc.flags:Add("/w")
else
external_settings.cc.flags:Add("-w")
end
-- compile zlib if needed
if config.zlib.value == 1 then
settings.link.libs:Add("z")
@ -287,17 +293,17 @@ function build(settings)
end
zlib = {}
else
zlib = Compile(settings, Collect("src/engine/external/zlib/*.c"))
zlib = Compile(external_settings, Collect("src/engine/external/zlib/*.c"))
settings.cc.includes:Add("src/engine/external/zlib")
end
-- build the small libraries
wavpack = Compile(settings, Collect("src/engine/external/wavpack/*.c"))
pnglite = Compile(settings, Collect("src/engine/external/pnglite/*.c"))
jsonparser = Compile(settings, Collect("src/engine/external/json-parser/*.c"))
md5 = Compile(settings, "src/engine/external/md5/md5.c")
wavpack = Compile(external_settings, Collect("src/engine/external/wavpack/*.c"))
pnglite = Compile(external_settings, Collect("src/engine/external/pnglite/*.c"))
jsonparser = Compile(external_settings, Collect("src/engine/external/json-parser/*.c"))
md5 = Compile(external_settings, "src/engine/external/md5/md5.c")
if config.websockets.value then
libwebsockets = Compile(settings, Collect("src/engine/external/libwebsockets/*.c"))
libwebsockets = Compile(external_settings, Collect("src/engine/external/libwebsockets/*.c"))
end
-- build game components

View file

@ -185,6 +185,7 @@ public:
{}
plain_range_sorted(const plain_range_sorted &r)
: parent()
{
*this = r;
}

View file

@ -371,7 +371,9 @@ int CClient::SendMsgEx(CMsgPacker *pMsg, int Flags, bool System)
// HACK: modify the message id in the packet and store the system flag
if(*((unsigned char*)Packet.m_pData) == 1 && System && Packet.m_DataSize == 1)
{
dbg_break();
}
*((unsigned char*)Packet.m_pData) <<= 1;
if(System)
@ -805,7 +807,9 @@ int CClient::SendMsgExY(CMsgPacker *pMsg, int Flags, bool System, int NetClient)
// HACK: modify the message id in the packet and store the system flag
if(*((unsigned char*)Packet.m_pData) == 1 && System && Packet.m_DataSize == 1)
{
dbg_break();
}
*((unsigned char*)Packet.m_pData) <<= 1;
if(System)

View file

@ -40,10 +40,10 @@ public:
STATE_ABORTED,
};
const double Current() const { return m_Current; };
const double Size() const { return m_Size; };
const int Progress() const { return m_Progress; };
const int State() const { return m_State; };
double Current() const { return m_Current; };
double Size() const { return m_Size; };
int Progress() const { return m_Progress; };
int State() const { return m_State; };
const char *Dest() const { return m_aDest; };
void Abort() { m_Abort = true; };

View file

@ -198,7 +198,7 @@ MACRO_CONFIG_INT(SvSaveWorseScores, sv_save_worse_scores, 1, 0, 1, CFGFLAG_SERVE
MACRO_CONFIG_INT(SvPauseable, sv_pauseable, 1, 0, 1, CFGFLAG_SERVER|CFGFLAG_GAME, "Whether players can pause their char or not")
MACRO_CONFIG_INT(SvPauseMessages, sv_pause_messages, 0, 0, 1, CFGFLAG_SERVER, "Whether to show messages when a player pauses and resumes")
MACRO_CONFIG_INT(SvPauseTime, sv_pause_time, 0, 0, 1, CFGFLAG_SERVER, "Whether '/pause' and 'sv_max_dc_restore' pauses the time of player or not")
MACRO_CONFIG_INT(SvPauseFrequency, sv_pause_frequency, 1, 0, 9999, CFGFLAG_SERVER, "The minimum allowed delay between pauses")
MACRO_CONFIG_INT(SvSpecFrequency, sv_pause_frequency, 1, 0, 9999, CFGFLAG_SERVER, "The minimum allowed delay between /spec")
MACRO_CONFIG_INT(SvInvite, sv_invite, 1, 0, 1, CFGFLAG_SERVER, "Whether players can invite other players to teams")
MACRO_CONFIG_INT(SvInviteFrequency, sv_invite_frequency, 1, 0, 9999, CFGFLAG_SERVER, "The minimum allowed delay between invites")

View file

@ -52,10 +52,10 @@ public:
void Load(const char* pTileName);
void Proceed(class CLayerTiles *pLayer, int ConfigID);
int ConfigNamesNum() { return m_lConfigs.size(); }
int ConfigNamesNum() const { return m_lConfigs.size(); }
const char* GetConfigName(int Index);
const bool IsLoaded() { return m_FileLoaded; }
bool IsLoaded() const { return m_FileLoaded; }
private:
array<CConfiguration> m_lConfigs;
class CEditor *m_pEditor;

View file

@ -677,18 +677,19 @@ int CPlayer::Pause(int State, bool Force)
case PAUSE_NONE:
if(m_pCharacter->IsPaused()) // First condition might be unnecessary
{
if(!Force && m_LastPause && m_LastPause + g_Config.m_SvPauseFrequency * Server()->TickSpeed() > Server()->Tick())
if(!Force && m_LastPause && m_LastPause + g_Config.m_SvSpecFrequency * Server()->TickSpeed() > Server()->Tick())
{
GameServer()->SendChatTarget(m_ClientID, "Can't pause that quickly.");
GameServer()->SendChatTarget(m_ClientID, "Can't /spec that quickly.");
return m_Paused; // Do not update state. Do not collect $200
}
m_pCharacter->Pause(false);
GameServer()->CreatePlayerSpawn(m_pCharacter->m_Pos, m_pCharacter->Teams()->TeamMask(m_pCharacter->Team(), -1, m_ClientID));
}
// fall-thru
case PAUSE_SPEC:
if(g_Config.m_SvPauseMessages)
{
str_format(aBuf, sizeof(aBuf), (m_Paused > PAUSE_NONE) ? "'%s' paused" : "'%s' resumed", Server()->ClientName(m_ClientID));
str_format(aBuf, sizeof(aBuf), (m_Paused > PAUSE_NONE) ? "'%s' speced" : "'%s' resumed", Server()->ClientName(m_ClientID));
GameServer()->SendChat(-1, CGameContext::CHAT_ALL, aBuf);
}
break;