From 7877953b6cff641fa2fecd69d99b06430b4daa03 Mon Sep 17 00:00:00 2001 From: Peter Covington Date: Sat, 16 Apr 2022 09:18:06 -0400 Subject: [PATCH] Fixes --- sp/src/game/server/mapbase/custom_weapon_factory.cpp | 8 +++++--- sp/src/game/shared/mapbase/weapon_custom_scripted.cpp | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/sp/src/game/server/mapbase/custom_weapon_factory.cpp b/sp/src/game/server/mapbase/custom_weapon_factory.cpp index bb919e97..dea0380c 100644 --- a/sp/src/game/server/mapbase/custom_weapon_factory.cpp +++ b/sp/src/game/server/mapbase/custom_weapon_factory.cpp @@ -66,6 +66,8 @@ void CCustomWeaponSystem::AddManifestFile(KeyValues* pKV, bool bDontWarn) if (pKey) { char value[MAX_PATH]; + value[0] = '\0'; + // Parse %mapname%, etc. bool inparam = false; CUtlStringList outStrings; @@ -76,7 +78,7 @@ void CCustomWeaponSystem::AddManifestFile(KeyValues* pKV, bool bDontWarn) { if (FStrEq(outStrings[i], "mapname")) { - Q_strncat(value, MapName(), sizeof(value)); + Q_strncat(value, STRING(gpGlobals->mapname), sizeof(value)); } else if (FStrEq(outStrings[i], "language")) { @@ -128,7 +130,7 @@ void CCustomWeaponSystem::LoadCustomWeaponsManifest(const char* file, bool bDont m_ClassFactories[ClassIndex].pOldFactory = EntityFactoryDictionary()->FindFactory(pszClassname); } - m_ClassFactories[ClassIndex].sDataFile = file; + m_ClassFactories[ClassIndex].sDataFile = pkvWeapon->GetString(); m_ClassFactories[ClassIndex].pNewFactory = Factory.Element(FactoryIndex); EntityFactoryDictionary()->UninstallFactory(pszClassname); EntityFactoryDictionary()->InstallFactory(m_ClassFactories[ClassIndex].pNewFactory, pszClassname); @@ -141,7 +143,7 @@ void CCustomWeaponSystem::LoadCustomWeaponsManifest(const char* file, bool bDont void CCustomWeaponSystem::LevelShutdownPostEntity() { - for (int i = 0; i < m_ClassFactories.Count(); i++) + for (unsigned short i = 0; i < m_ClassFactories.Count(); i++) { EntityFactoryDictionary()->UninstallFactory(m_ClassFactories.GetElementName(i)); const CustomClassName_t& entry = m_ClassFactories.Element(i); diff --git a/sp/src/game/shared/mapbase/weapon_custom_scripted.cpp b/sp/src/game/shared/mapbase/weapon_custom_scripted.cpp index a0dcbda2..a3ca9d57 100644 --- a/sp/src/game/shared/mapbase/weapon_custom_scripted.cpp +++ b/sp/src/game/shared/mapbase/weapon_custom_scripted.cpp @@ -427,7 +427,7 @@ void CWeaponCustomScripted::SecondaryAttack( void ) // Purpose: //----------------------------------------------------------------------------- #define ACTIVITY_FUNC_OVERRIDE( name ) ScriptVariant_t retVal; \ - if (RunWeaponHook( g_Hook_##name, m_Func_##name, &retVal ) && retVal.m_bool == false) \ + if (RunWeaponHook( g_Hook_##name, m_Func_##name, &retVal ) && !retVal.IsNull()) \ { \ if (retVal.m_type == FIELD_INTEGER) \ { \