Skip to content

Commit fdc902f

Browse files
committed
added check if we have a valid script file for the input
1 parent 5a43eef commit fdc902f

1 file changed

Lines changed: 18 additions & 0 deletions

File tree

sp/src/game/shared/basecombatweapon_shared.cpp

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,6 +2028,24 @@ void CBaseCombatWeapon::InputChangeScript(inputdata_t& inputdata)
20282028
//don't update if other weapon that owns my owner uses the same script
20292029
if (GetOwner() && GetOwner()->Weapon_OwnsThisType(pszNewScript))
20302030
return;
2031+
2032+
char sz[128];
2033+
Q_snprintf(sz, sizeof(sz), "scripts/%s", pszNewScript);
2034+
2035+
KeyValues* pKV = ReadEncryptedKVFile(filesystem, sz, GetEncryptionKey(),
2036+
#if defined( DOD_DLL )
2037+
true // Only read .ctx files!
2038+
#else
2039+
false
2040+
#endif
2041+
);
2042+
2043+
//don't if file doesn't exists
2044+
if (!pKV)
2045+
{
2046+
Warning("Error reading weapon data file \"%s\".\n", pszNewScript);
2047+
return;
2048+
}
20312049

20322050
//copy new data for networked and stored
20332051
Q_strncpy(m_iszWeaponScriptName.GetForModify(), pszNewScript, MAX_WEAPON_STRING);

0 commit comments

Comments
 (0)