mirror of
https://github.com/celisej567/source-sdk-2013.git
synced 2026-09-11 20:11:33 +03:00
Added save/restore to client-side VScript
This commit is contained in:
@@ -757,7 +757,12 @@ public: // IGameSystem
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CLIENT_DLL
|
||||
// On the client, OnRestore() is called before VScript is actually restored, so this has to be called manually from VScript save/restore instead
|
||||
void OnVMRestore()
|
||||
#else
|
||||
void OnRestore()
|
||||
#endif
|
||||
{
|
||||
if ( g_pScriptVM )
|
||||
{
|
||||
@@ -783,6 +788,13 @@ private:
|
||||
|
||||
} g_ScriptSaveRestoreUtil;
|
||||
|
||||
#ifdef CLIENT_DLL
|
||||
void VScriptSaveRestoreUtil_OnVMRestore()
|
||||
{
|
||||
g_ScriptSaveRestoreUtil.OnVMRestore();
|
||||
}
|
||||
#endif
|
||||
|
||||
CUtlMap< unsigned int, KeyValues* > CScriptSaveRestoreUtil::m_Lookup( DefLessFunc(unsigned int) );
|
||||
StringHashFunctor CScriptSaveRestoreUtil::Hash;
|
||||
|
||||
@@ -1164,6 +1176,13 @@ void CNetMsgScriptHelper::RecieveMessage( bf_read &msg )
|
||||
|
||||
word hash = m_MsgIn_()ReadWord();
|
||||
|
||||
// Don't do anything if there's no VM here. This can happen if a message from the server goes to a VM-less client, or vice versa.
|
||||
if ( !g_pScriptVM )
|
||||
{
|
||||
CGWarning( 0, CON_GROUP_VSCRIPT, "CNetMsgScriptHelper: No VM on receiving side\n" );
|
||||
return;
|
||||
}
|
||||
|
||||
ScriptVariant_t hfn;
|
||||
if ( g_pScriptVM->GetValue( m_Hooks, hash, &hfn ) )
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user