diff --git a/rehlds/engine/decals.cpp b/rehlds/engine/decals.cpp index 72fdd6c..52ef9f0 100644 --- a/rehlds/engine/decals.cpp +++ b/rehlds/engine/decals.cpp @@ -544,10 +544,14 @@ void Decal_Init(void) char pszPathID[2][15] = { "DEFAULTGAME", "GAME" }; Draw_DecalShutdown(); - for (i = 0; i < 2; i++) + for (i = 0; i < ARRAYSIZE(pszPathID); i++) { hfile = FS_OpenPathID("decals.wad", "rb", pszPathID[i]); +#ifdef REHLDS_FIXES + if (i == ARRAYSIZE(pszPathID) - 1 && !hfile) +#else if (i == 0 && !hfile) +#endif Sys_Error("Couldn't find '%s' in \"%s\" search path\n", "decals.wad", pszPathID[i]); filesize = FS_Size(hfile); @@ -567,8 +571,8 @@ void Decal_Init(void) for (i = 0; i < sv_decalnamecount; i++) { Q_memset(&sv_decalnames[i], 0, sizeof(decalname_t)); - Q_strncpy(sv_decalnames[i].name, Draw_DecalName(i), 15); - sv_decalnames[i].name[15] = 0; + Q_strncpy(sv_decalnames[i].name, Draw_DecalName(i), sizeof sv_decalnames[i].name - 1); + sv_decalnames[i].name[sizeof sv_decalnames[i].name - 1] = 0; } } diff --git a/rehlds/engine/sv_main.cpp b/rehlds/engine/sv_main.cpp index 1feca9b..3c3b990 100644 --- a/rehlds/engine/sv_main.cpp +++ b/rehlds/engine/sv_main.cpp @@ -4820,6 +4820,9 @@ void SV_ExtractFromUserinfo(client_t *cl) *p = ' '; } + // Fix name to not start with '#', so it will not resemble userid + for (char *p = newname; *p == '#'; p++) *p = ' '; + #ifdef REHLDS_FIXES Q_StripUnprintableAndSpace(newname); #else // REHLDS_FIXES @@ -4831,9 +4834,6 @@ void SV_ExtractFromUserinfo(client_t *cl) Q_UnicodeRepair(newname); } - // Fix name to not start with '#', so it will not resemble userid - for (char *p = newname; *p == '#'; p++) *p = ' '; - if (newname[0] == '\0' || !Q_stricmp(newname, "console") #ifdef REHLDS_FIXES || Q_strstr(newname, "..") != NULL) @@ -5841,6 +5841,11 @@ USERID_t *SV_StringToUserID(const char *str) return &id; } +void SV_SerializeSteamid(USERID_t* id, USERID_t* serialized) +{ + *serialized = *id; +} + /* ../engine/sv_main.c:7799 */ void SV_BanId_f(void) { @@ -5953,10 +5958,8 @@ void SV_BanId_f(void) userfilters[i].banTime = banTime; userfilters[i].banEndTime = (banTime == 0.0f) ? 0.0f : banTime * 60.0f + realtime; - Q_memcpy(&userfilters[i].userid, id, sizeof(USERID_t)); - // give 3-rd party plugins a chance to serialize ID - g_RehldsHookchains.m_SerializeSteamId.callChain(NULL, &userfilters[i].userid); + g_RehldsHookchains.m_SerializeSteamId.callChain(SV_SerializeSteamid, id, &userfilters[i].userid); if (banTime == 0.0f) Q_sprintf(szreason, "permanently"); diff --git a/rehlds/public/rehlds/rehlds_api.h b/rehlds/public/rehlds/rehlds_api.h index 2ab3fc5..84be7bc 100644 --- a/rehlds/public/rehlds/rehlds_api.h +++ b/rehlds/public/rehlds/rehlds_api.h @@ -35,7 +35,7 @@ #include "model.h" #define REHLDS_API_VERSION_MAJOR 2 -#define REHLDS_API_VERSION_MINOR 6 +#define REHLDS_API_VERSION_MINOR 7 //Steam_NotifyClientConnect hook typedef IHookChain IRehldsHook_Steam_NotifyClientConnect; @@ -78,8 +78,8 @@ typedef IHookChain IRehldsHook_Steam_NotifyBotConnect; typedef IHookChainRegistry IRehldsHookRegistry_Steam_NotifyBotConnect; //SerializeSteamId -typedef IVoidHookChain IRehldsHook_SerializeSteamId; -typedef IVoidHookChainRegistry IRehldsHookRegistry_SerializeSteamId; +typedef IVoidHookChain IRehldsHook_SerializeSteamId; +typedef IVoidHookChainRegistry IRehldsHookRegistry_SerializeSteamId; //SV_CompareUserID hook typedef IHookChain IRehldsHook_SV_CompareUserID; @@ -169,7 +169,6 @@ typedef IHookChainRegistry IRehldsHookRegistry_SV_TransferConsistencyInfo; typedef IHookChain IRehldsHook_Steam_GSBUpdateUserData; typedef IHookChainRegistry IRehldsHookRegistry_Steam_GSBUpdateUserData; -//BUpdateUserData class IRehldsHookchains { public: virtual ~IRehldsHookchains() { } diff --git a/rehlds/rehlds/rehlds_api_impl.h b/rehlds/rehlds/rehlds_api_impl.h index 4bd12a1..d7ec4a0 100644 --- a/rehlds/rehlds/rehlds_api_impl.h +++ b/rehlds/rehlds/rehlds_api_impl.h @@ -72,8 +72,8 @@ typedef IHookChainImpl CRehldsHook_Steam_NotifyBotConnec typedef IHookChainRegistryImpl CRehldsHookRegistry_Steam_NotifyBotConnect; //SerializeSteamId -typedef IVoidHookChainImpl CRehldsHook_SerializeSteamId; -typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_SerializeSteamId; +typedef IVoidHookChainImpl CRehldsHook_SerializeSteamId; +typedef IVoidHookChainRegistryImpl CRehldsHookRegistry_SerializeSteamId; //SV_CompareUserID hook typedef IHookChainImpl CRehldsHook_SV_CompareUserID;