core/systems/PluginSys.cpp
changeset 2042 4a2faafca477
parent 1952 b7aa2b626807
child 2086 debb2ab2c782
     1.1 --- a/core/systems/PluginSys.cpp	Fri May 09 08:22:39 2008 +0000
     1.2 +++ b/core/systems/PluginSys.cpp	Sat May 10 09:23:55 2008 +0000
     1.3 @@ -67,6 +67,7 @@
     1.4  	m_FakeNativesMissing = false;
     1.5  	m_LibraryMissing = false;
     1.6  	m_bGotAllLoaded = false;
     1.7 +	m_pPhrases = g_Translator.CreatePhraseCollection();
     1.8  }
     1.9  
    1.10  CPlugin::~CPlugin()
    1.11 @@ -111,6 +112,11 @@
    1.12  		delete m_configs[i];
    1.13  	}
    1.14  	m_configs.clear();
    1.15 +	if (m_pPhrases != NULL)
    1.16 +	{
    1.17 +		m_pPhrases->Destroy();
    1.18 +		m_pPhrases = NULL;
    1.19 +	}
    1.20  }
    1.21  
    1.22  void CPlugin::InitIdentity()
    1.23 @@ -128,7 +134,6 @@
    1.24  	unsigned int base_size = 
    1.25  		sizeof(CPlugin) 
    1.26  		+ sizeof(IdentityToken_t)
    1.27 -		+ (m_PhraseFiles.size() * sizeof(unsigned int))
    1.28  		+ (m_dependents.size() * sizeof(CPlugin *))
    1.29  		+ (m_dependsOn.size() * sizeof(CPlugin *))
    1.30  		+ (m_fakeNatives.size() * (sizeof(FakeNative *) + sizeof(FakeNative)))
    1.31 @@ -710,19 +715,9 @@
    1.32  	m_LastAccess = t;
    1.33  }
    1.34  
    1.35 -void CPlugin::AddLangFile(unsigned int index)
    1.36 -{
    1.37 -	m_PhraseFiles.push_back(index);
    1.38 -}
    1.39 -
    1.40 -size_t CPlugin::GetLangFileCount()
    1.41 +IPhraseCollection *CPlugin::GetPhrases()
    1.42  {
    1.43 -	return m_PhraseFiles.size();
    1.44 -}
    1.45 -
    1.46 -unsigned int CPlugin::GetLangFileByIndex(unsigned int index)
    1.47 -{
    1.48 -	return m_PhraseFiles.at(index);
    1.49 +	return m_pPhrases;
    1.50  }
    1.51  
    1.52  void CPlugin::DependencyDropped(CPlugin *pOwner)
    1.53 @@ -1488,8 +1483,8 @@
    1.54  		OnLibraryAction((*s_iter).c_str(), true, false);
    1.55  	}
    1.56  
    1.57 -	/* Finally, add the core language file */
    1.58 -	pPlugin->AddLangFile(g_pCorePhraseID);
    1.59 +	/* :TODO: optimize? does this even matter? */
    1.60 +	pPlugin->GetPhrases()->AddPhraseFile("core.phrases");
    1.61  
    1.62  	return true;
    1.63  }