Fix compile with -O3 & -Ofast

This commit is contained in:
def 2014-12-01 21:10:10 +01:00
parent 158ba846fa
commit b4cef79b82
2 changed files with 44 additions and 43 deletions

View file

@ -240,49 +240,6 @@ typename CNetBan::CBan<T> *CNetBan::CBanPool<T, HashCount>::Get(int Index) const
}
template<class T>
void CNetBan::MakeBanInfo(const CBan<T> *pBan, char *pBuf, unsigned BuffSize, int Type) const
{
if(pBan == 0 || pBuf == 0)
{
if(BuffSize > 0)
pBuf[0] = 0;
return;
}
// build type based part
char aBuf[256];
if(Type == MSGTYPE_PLAYER)
str_copy(aBuf, "You have been banned", sizeof(aBuf));
else
{
char aTemp[256];
switch(Type)
{
case MSGTYPE_LIST:
str_format(aBuf, sizeof(aBuf), "%s banned", NetToString(&pBan->m_Data, aTemp, sizeof(aTemp))); break;
case MSGTYPE_BANADD:
str_format(aBuf, sizeof(aBuf), "banned %s", NetToString(&pBan->m_Data, aTemp, sizeof(aTemp))); break;
case MSGTYPE_BANREM:
str_format(aBuf, sizeof(aBuf), "unbanned %s", NetToString(&pBan->m_Data, aTemp, sizeof(aTemp))); break;
default:
aBuf[0] = 0;
}
}
// add info part
if(pBan->m_Info.m_Expires != CBanInfo::EXPIRES_NEVER)
{
int Mins = ((pBan->m_Info.m_Expires-time_timestamp()) + 59) / 60;
if(Mins <= 1)
str_format(pBuf, BuffSize, "%s for 1 minute (%s)", aBuf, pBan->m_Info.m_aReason);
else
str_format(pBuf, BuffSize, "%s for %d minutes (%s)", aBuf, Mins, pBan->m_Info.m_aReason);
}
else
str_format(pBuf, BuffSize, "%s for life (%s)", aBuf, pBan->m_Info.m_aReason);
}
template<class T>
int CNetBan::Ban(T *pBanPool, const typename T::CDataType *pData, int Seconds, const char *pReason)
{

View file

@ -190,4 +190,48 @@ public:
static void ConBansSave(class IConsole::IResult *pResult, void *pUser);
};
template<class T>
void CNetBan::MakeBanInfo(const CBan<T> *pBan, char *pBuf, unsigned BuffSize, int Type) const
{
if(pBan == 0 || pBuf == 0)
{
if(BuffSize > 0)
pBuf[0] = 0;
return;
}
// build type based part
char aBuf[256];
if(Type == MSGTYPE_PLAYER)
str_copy(aBuf, "You have been banned", sizeof(aBuf));
else
{
char aTemp[256];
switch(Type)
{
case MSGTYPE_LIST:
str_format(aBuf, sizeof(aBuf), "%s banned", NetToString(&pBan->m_Data, aTemp, sizeof(aTemp))); break;
case MSGTYPE_BANADD:
str_format(aBuf, sizeof(aBuf), "banned %s", NetToString(&pBan->m_Data, aTemp, sizeof(aTemp))); break;
case MSGTYPE_BANREM:
str_format(aBuf, sizeof(aBuf), "unbanned %s", NetToString(&pBan->m_Data, aTemp, sizeof(aTemp))); break;
default:
aBuf[0] = 0;
}
}
// add info part
if(pBan->m_Info.m_Expires != CBanInfo::EXPIRES_NEVER)
{
int Mins = ((pBan->m_Info.m_Expires-time_timestamp()) + 59) / 60;
if(Mins <= 1)
str_format(pBuf, BuffSize, "%s for 1 minute (%s)", aBuf, pBan->m_Info.m_aReason);
else
str_format(pBuf, BuffSize, "%s for %d minutes (%s)", aBuf, Mins, pBan->m_Info.m_aReason);
}
else
str_format(pBuf, BuffSize, "%s for life (%s)", aBuf, pBan->m_Info.m_aReason);
}
#endif