Remove CPluginManager direct use of CPlugin::NativeOwner::m_fakes.

This commit is contained in:
David Anderson 2015-09-19 17:50:30 -07:00
parent f765c8d436
commit c21b3a36fc
2 changed files with 14 additions and 4 deletions

View File

@ -717,6 +717,12 @@ bool CPlugin::AddFakeNative(IPluginFunction *pFunc, const char *name, SPVM_FAKEN
return true; return true;
} }
void CPlugin::BindFakeNativesTo(CPlugin *other)
{
for (size_t i = 0; i < m_fakes.length(); i++)
g_ShareSys.BindNativeToPlugin(other, m_fakes[i]);
}
/******************* /*******************
* PLUGIN ITERATOR * * PLUGIN ITERATOR *
*******************/ *******************/
@ -1274,7 +1280,7 @@ bool CPluginManager::RunSecondPass(CPlugin *pPlugin, char *error, size_t maxleng
pPlugin->Call_OnPluginStart(); pPlugin->Call_OnPluginStart();
/* Now, if we have fake natives, go through all plugins that might need rebinding */ /* Now, if we have fake natives, go through all plugins that might need rebinding */
if (pPlugin->GetStatus() <= Plugin_Paused && pPlugin->m_fakes.length()) if (pPlugin->GetStatus() <= Plugin_Paused && pPlugin->HasFakeNatives())
{ {
List<CPlugin *>::iterator pl_iter; List<CPlugin *>::iterator pl_iter;
for (pl_iter = m_plugins.begin(); for (pl_iter = m_plugins.begin();
@ -1293,8 +1299,7 @@ bool CPluginManager::RunSecondPass(CPlugin *pPlugin, char *error, size_t maxleng
&& pOther != pPlugin) && pOther != pPlugin)
{ {
g_ShareSys.BeginBindingFor(pPlugin); g_ShareSys.BeginBindingFor(pPlugin);
for (size_t i = 0; i < pPlugin->m_fakes.length(); i++) pPlugin->BindFakeNativesTo(pOther);
g_ShareSys.BindNativeToPlugin(pOther, pPlugin->m_fakes[i]);
} }
} }
} }

View File

@ -279,11 +279,16 @@ public:
bool HasMissingLibrary() const { bool HasMissingLibrary() const {
return m_LibraryMissing; return m_LibraryMissing;
} }
bool HasFakeNatives() const {
return m_fakes.length() > 0;
}
bool TryCompile();
void BindFakeNativesTo(CPlugin *other);
protected: protected:
bool ReadInfo(); bool ReadInfo();
void DependencyDropped(CPlugin *pOwner); void DependencyDropped(CPlugin *pOwner);
bool TryCompile();
private: private:
time_t GetFileTimeStamp(); time_t GetFileTimeStamp();