Fix the structure tree a second time, this should also work on Windows.
This was SVN commit r16542.
This commit is contained in:
parent
6aa99d762f
commit
120ff2c60c
@ -37,9 +37,9 @@ function getGatherRates(templateName)
|
||||
|
||||
function loadUnit(templateName)
|
||||
{
|
||||
var template = loadTemplate(templateName);
|
||||
if (!template)
|
||||
if (!Engine.TemplateExists(templateName))
|
||||
return null;
|
||||
var template = loadTemplate(templateName);
|
||||
|
||||
var unit = GetTemplateDataHelper(template);
|
||||
unit.phase = false;
|
||||
|
@ -402,10 +402,13 @@ void CGUIManager::UpdateResolution()
|
||||
it->gui->UpdateResolution();
|
||||
}
|
||||
|
||||
bool CGUIManager::TemplateExists(const std::string& templateName)
|
||||
{
|
||||
return m_TemplateLoader.TemplateExists(templateName);
|
||||
}
|
||||
|
||||
const CParamNode& CGUIManager::GetTemplate(const std::string& templateName)
|
||||
{
|
||||
if (!m_TemplateLoader.TemplateExists(templateName))
|
||||
return NULL;
|
||||
const CParamNode& templateRoot = m_TemplateLoader.GetTemplateFileData(templateName).GetChild("Entity");
|
||||
if (!templateRoot.IsOk())
|
||||
LOGERROR("Invalid template found for '%s'", templateName.c_str());
|
||||
|
@ -140,6 +140,11 @@ public:
|
||||
|
||||
void RestoreSavedGameData(std::string jsonData);
|
||||
|
||||
/**
|
||||
* Check if a template with this name exists
|
||||
*/
|
||||
bool TemplateExists(const std::string& templateName);
|
||||
|
||||
/**
|
||||
* Retrieve the requested template, used for displaying faction specificities.
|
||||
*/
|
||||
|
@ -825,6 +825,11 @@ void WriteJSONFile(ScriptInterface::CxPrivate* pCxPrivate, std::wstring filePath
|
||||
g_VFS->CreateFile(path, buf.Data(), buf.Size());
|
||||
}
|
||||
|
||||
bool TemplateExists(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), std::string templateName)
|
||||
{
|
||||
return g_GUI->TemplateExists(templateName);
|
||||
}
|
||||
|
||||
CParamNode GetTemplate(ScriptInterface::CxPrivate* UNUSED(pCxPrivate), std::string templateName)
|
||||
{
|
||||
return g_GUI->GetTemplate(templateName);
|
||||
@ -991,6 +996,7 @@ void GuiScriptingInit(ScriptInterface& scriptInterface)
|
||||
scriptInterface.RegisterFunction<std::wstring, int, &GetBuildTimestamp>("GetBuildTimestamp");
|
||||
scriptInterface.RegisterFunction<JS::Value, std::wstring, &ReadJSONFile>("ReadJSONFile");
|
||||
scriptInterface.RegisterFunction<void, std::wstring, JS::HandleValue, &WriteJSONFile>("WriteJSONFile");
|
||||
scriptInterface.RegisterFunction<bool, std::string, &TemplateExists>("TemplateExists");
|
||||
scriptInterface.RegisterFunction<CParamNode, std::string, &GetTemplate>("GetTemplate");
|
||||
|
||||
// User report functions
|
||||
|
Loading…
Reference in New Issue
Block a user