Re-rig global forwards when plugin pause state changes (bug 5582, r=psychonic).
This commit is contained in:
parent
d05feabcd6
commit
b8c61f89fa
@ -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<CForward *>::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<IPluginFunction *> *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;
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user