core/systems/PluginSys.cpp
changeset 525 d36c45088e36
parent 487 3410298035cb
child 536 164f7d3482ef
     1.1 --- a/core/systems/PluginSys.cpp	Wed Feb 21 22:09:05 2007 +0000
     1.2 +++ b/core/systems/PluginSys.cpp	Thu Feb 22 02:05:50 2007 +0000
     1.3 @@ -202,7 +202,6 @@
     1.4  	}
     1.5  
     1.6  	m_ctx.base = new BaseContext(m_ctx.ctx);
     1.7 -	m_ctx.base->SetRunnable(false);
     1.8  	m_ctx.ctx->user[SM_CONTEXTVAR_MYSELF] = (void *)this;
     1.9  
    1.10  	m_status = Plugin_Created;
    1.11 @@ -222,9 +221,9 @@
    1.12  	vsnprintf(m_errormsg, sizeof(m_errormsg), error_fmt, ap);
    1.13  	va_end(ap);
    1.14  
    1.15 -	if (m_ctx.base)
    1.16 +	if (m_ctx.ctx)
    1.17  	{
    1.18 -		m_ctx.base->SetRunnable(false);
    1.19 +		m_ctx.ctx->flags |= SPFLAG_PLUGIN_PAUSED;
    1.20  	}
    1.21  }
    1.22  
    1.23 @@ -310,7 +309,6 @@
    1.24  	}
    1.25  
    1.26  	m_status = Plugin_Loaded;
    1.27 -	m_ctx.base->SetRunnable(true);
    1.28  
    1.29  	int err;
    1.30  	cell_t result;
    1.31 @@ -397,8 +395,6 @@
    1.32  		return false;
    1.33  	}
    1.34  
    1.35 -	m_status = (paused) ? Plugin_Paused : Plugin_Running;
    1.36 -
    1.37  	IPluginFunction *pFunction = m_ctx.base->GetFunctionByName("OnPluginPauseChange");
    1.38  	if (pFunction)
    1.39  	{
    1.40 @@ -407,6 +403,15 @@
    1.41  		pFunction->Execute(&result);
    1.42  	}
    1.43  
    1.44 +	if (paused)
    1.45 +	{
    1.46 +		m_status = Plugin_Paused;
    1.47 +		m_ctx.ctx->flags |= SPFLAG_PLUGIN_PAUSED;
    1.48 +	} else {
    1.49 +		m_status = Plugin_Running;
    1.50 +		m_ctx.ctx->flags &= ~SPFLAG_PLUGIN_PAUSED;
    1.51 +	}
    1.52 +
    1.53  	g_PluginSys._SetPauseState(this, paused);
    1.54  
    1.55  	return true;