Show Population Cost in unit training buttons
Show Population Bonus in unit construction buttons This was SVN commit r8559.
This commit is contained in:
parent
6e74c53ee9
commit
dde2cd38be
@ -212,9 +212,10 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
|
||||
case CONSTRUCTION:
|
||||
var tooltip = getEntityNameWithGenericType(template);
|
||||
if (template.tooltip)
|
||||
tooltip += "\n[font=\"serif-13\"]" + template.tooltip + "[/font]";
|
||||
tooltip += "\n[font=\"serif-13\"]" + template.tooltip + " " + getPopulationBonus(template) + "[/font]";
|
||||
|
||||
tooltip += "\n" + getEntityCost(template);
|
||||
|
||||
break;
|
||||
|
||||
case COMMAND:
|
||||
|
@ -238,12 +238,22 @@ function getEntityCost(template)
|
||||
if (template.cost.wood) costs.push("[font=\"serif-bold-13\"]Wood:[/font] " + template.cost.wood);
|
||||
if (template.cost.metal) costs.push("[font=\"serif-bold-13\"]Metal:[/font] " + template.cost.metal);
|
||||
if (template.cost.stone) costs.push("[font=\"serif-bold-13\"]Stone:[/font] " + template.cost.stone);
|
||||
if (template.cost.population) costs.push("[font=\"serif-bold-13\"]Population:[/font] " + template.cost.population);
|
||||
|
||||
if (costs.length)
|
||||
return costs.join(", ");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
function getPopulationBonus(template)
|
||||
{
|
||||
var popBonus = "";
|
||||
if (template.cost.populationBonus)
|
||||
popBonus = "[font=\"serif-bold-13\"]Population Bonus:[/font] " + template.cost.populationBonus;
|
||||
return popBonus;
|
||||
}
|
||||
|
||||
function getEntityName(template)
|
||||
{
|
||||
return template.name.specific || template.name.generic || "???";
|
||||
|
@ -196,6 +196,8 @@ GuiInterface.prototype.GetTemplateData = function(player, name)
|
||||
if (template.Cost.Resources.wood) ret.cost.wood = +template.Cost.Resources.wood;
|
||||
if (template.Cost.Resources.stone) ret.cost.stone = +template.Cost.Resources.stone;
|
||||
if (template.Cost.Resources.metal) ret.cost.metal = +template.Cost.Resources.metal;
|
||||
if (template.Cost.Population) ret.cost.population = +template.Cost.Population;
|
||||
if (template.Cost.PopulationBonus) ret.cost.populationBonus = +template.Cost.PopulationBonus;
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
Loading…
Reference in New Issue
Block a user