forked from mirrors/0ad
190d6e7cf5
Instead of loading information about heroes, special buildings, et al.,
from the
`{civ}.json` files, load the information desired from templates.
Determination of "specialness" works as follows:
* Heroes are detected via the `Hero` class.
* Special Structures are detected via the `SpecialBuilding` or `Wonder`
class.
* Technologies are determined to be "special" when they can be
researched by
the currently selected civ, but are not open to be researched by
every civ.
* Team Bonuses are any applicable aura that reside in the appropriate
folder.
Accepted by: Freagarach
Comments by: Stan
Differential Revision: https://code.wildfiregames.com/D759
This was SVN commit r24492.
34 lines
1.0 KiB
JavaScript
34 lines
1.0 KiB
JavaScript
/**
|
|
* This needs to stay in the global scope, as it is used by various functions
|
|
* within gui/common/tooltip.js
|
|
*/
|
|
var g_ResourceData = new Resources();
|
|
|
|
var g_Page;
|
|
|
|
/**
|
|
* This is needed because getEntityCostTooltip in tooltip.js needs to get
|
|
* the template data of the different wallSet pieces. In the session this
|
|
* function does some caching, but here we do that in the TemplateLoader
|
|
* class already.
|
|
*/
|
|
function GetTemplateData(templateName)
|
|
{
|
|
let template = g_Page.TemplateLoader.loadEntityTemplate(templateName, g_Page.activeCiv);
|
|
return GetTemplateDataHelper(template, null, g_Page.TemplateLoader.auraData, g_Page.TemplateParser.getModifiers(g_Page.activeCiv));
|
|
}
|
|
|
|
/**
|
|
* This would ideally be an Engine method.
|
|
* Or part of globalscripts. Either would be better than here.
|
|
*/
|
|
function TechnologyTemplateExists(templateName)
|
|
{
|
|
return Engine.FileExists(g_Page.TemplateLoader.TechnologyPath + templateName + ".json");
|
|
}
|
|
|
|
function AuraTemplateExists(templateName)
|
|
{
|
|
return Engine.FileExists(g_Page.TemplateLoader.AuraPath + templateName + ".json");
|
|
}
|