This commit is contained in:
Peter Covington 2022-04-16 09:18:06 -04:00
parent 5a0c406dbf
commit 7877953b6c
2 changed files with 6 additions and 4 deletions

View File

@ -66,6 +66,8 @@ void CCustomWeaponSystem::AddManifestFile(KeyValues* pKV, bool bDontWarn)
if (pKey) if (pKey)
{ {
char value[MAX_PATH]; char value[MAX_PATH];
value[0] = '\0';
// Parse %mapname%, etc. // Parse %mapname%, etc.
bool inparam = false; bool inparam = false;
CUtlStringList outStrings; CUtlStringList outStrings;
@ -76,7 +78,7 @@ void CCustomWeaponSystem::AddManifestFile(KeyValues* pKV, bool bDontWarn)
{ {
if (FStrEq(outStrings[i], "mapname")) 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")) 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].pOldFactory = EntityFactoryDictionary()->FindFactory(pszClassname);
} }
m_ClassFactories[ClassIndex].sDataFile = file; m_ClassFactories[ClassIndex].sDataFile = pkvWeapon->GetString();
m_ClassFactories[ClassIndex].pNewFactory = Factory.Element(FactoryIndex); m_ClassFactories[ClassIndex].pNewFactory = Factory.Element(FactoryIndex);
EntityFactoryDictionary()->UninstallFactory(pszClassname); EntityFactoryDictionary()->UninstallFactory(pszClassname);
EntityFactoryDictionary()->InstallFactory(m_ClassFactories[ClassIndex].pNewFactory, pszClassname); EntityFactoryDictionary()->InstallFactory(m_ClassFactories[ClassIndex].pNewFactory, pszClassname);
@ -141,7 +143,7 @@ void CCustomWeaponSystem::LoadCustomWeaponsManifest(const char* file, bool bDont
void CCustomWeaponSystem::LevelShutdownPostEntity() 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)); EntityFactoryDictionary()->UninstallFactory(m_ClassFactories.GetElementName(i));
const CustomClassName_t& entry = m_ClassFactories.Element(i); const CustomClassName_t& entry = m_ClassFactories.Element(i);

View File

@ -427,7 +427,7 @@ void CWeaponCustomScripted::SecondaryAttack( void )
// Purpose: // Purpose:
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
#define ACTIVITY_FUNC_OVERRIDE( name ) ScriptVariant_t retVal; \ #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) \ if (retVal.m_type == FIELD_INTEGER) \
{ \ { \