diff options
| author | Dennis Felsing <dennis@felsin9.de> | 2023-07-11 10:24:41 +0200 |
|---|---|---|
| committer | Dennis Felsing <dennis@felsin9.de> | 2023-07-11 10:24:41 +0200 |
| commit | 5edca2a937e40ac77e565adc4ccbf224c4967b00 (patch) | |
| tree | 406c4098ddc71f52be0d2e567f292d865b7ab314 | |
| parent | 431950c3fcc6ef37dc87f910d596bbbe776efe1e (diff) | |
| download | zcatch-5edca2a937e40ac77e565adc4ccbf224c4967b00.tar.gz zcatch-5edca2a937e40ac77e565adc4ccbf224c4967b00.zip | |
Fix linking in newer GCC
| -rw-r--r-- | src/engine/shared/netban.cpp | 44 | ||||
| -rw-r--r-- | src/engine/shared/netban.h | 42 |
2 files changed, 42 insertions, 44 deletions
diff --git a/src/engine/shared/netban.cpp b/src/engine/shared/netban.cpp index 707b709b..fab308fe 100644 --- a/src/engine/shared/netban.cpp +++ b/src/engine/shared/netban.cpp @@ -239,50 +239,6 @@ typename CNetBan::CBan<T> *CNetBan::CBanPool<T, HashCount>::Get(int Index) const return 0; } - -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) { diff --git a/src/engine/shared/netban.h b/src/engine/shared/netban.h index 70164832..75b5b29a 100644 --- a/src/engine/shared/netban.h +++ b/src/engine/shared/netban.h @@ -190,4 +190,46 @@ 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 |