diff --git a/core/ForwardSys.cpp b/core/ForwardSys.cpp index 52a97f6e..3529dd7e 100644 --- a/core/ForwardSys.cpp +++ b/core/ForwardSys.cpp @@ -208,7 +208,23 @@ CForward *CForwardManager::ForwardMake() void CForwardManager::OnPluginPauseChange(IPlugin *plugin, bool paused) { - /* No longer used */ + if(paused) + return; + + /* Attach any globally managed forwards */ + List::iterator iter; + CForward *fwd; + + for (iter=m_managed.begin(); iter!=m_managed.end(); iter++) + { + fwd = (*iter); + IPluginFunction *pFunc = plugin->GetBaseContext()->GetFunctionByName(fwd->GetForwardName()); + // Only add functions, if they aren't registered yet! + if (pFunc && !fwd->IsFunctionRegistered(pFunc)) + { + fwd->AddFunction(pFunc); + } + } } /************************************* @@ -739,6 +755,28 @@ bool CForward::AddFunction(IPluginFunction *func) return true; } +bool CForward::IsFunctionRegistered(IPluginFunction *func) +{ + FuncIter iter; + List *lst; + + if (func->IsRunnable()) + { + lst = &m_functions; + } else { + lst = &m_paused; + } + + for (iter=m_functions.begin(); iter!=m_functions.end(); iter++) + { + if ((*iter) == func) + { + return true; + } + } + return false; +} + const char *CForward::GetForwardName() { return m_name; diff --git a/core/ForwardSys.h b/core/ForwardSys.h index 798e1588..cf622063 100644 --- a/core/ForwardSys.h +++ b/core/ForwardSys.h @@ -141,6 +141,7 @@ public: unsigned int num_params, const ParamType *types, va_list ap); + bool IsFunctionRegistered(IPluginFunction *func); private: void _Int_PushArray(cell_t *inarray, unsigned int cells, int flags); void _Int_PushString(cell_t *inarray, unsigned int cells, int sz_flags, int cp_flags);