Reference group count by name instead of templateName

This was SVN commit r8347.
This commit is contained in:
WhiteTreePaladin 2010-10-13 20:16:03 +00:00
parent bd3ffd2c6a
commit 0c61f34db1
3 changed files with 5 additions and 13 deletions

View File

@ -92,10 +92,8 @@ EntityGroups.prototype.removeEnt = function(ent)
delete this.groups[name];
};
EntityGroups.prototype.getCount = function(templateName)
EntityGroups.prototype.getCount = function(name)
{
var template = GetTemplateData(templateName);
var name = template.name.specific || template.name.generic || "???";
return this.groups[name].count;
};

View File

@ -156,8 +156,9 @@ function setupUnitPanel(guiName, usedPanels, unitEntState, items, callback)
switch (guiName)
{
case SELECTION:
var tooltip = getEntityName(template);
var count = g_Selection.groups.getCount(item);
var name = getEntityName(template);
var tooltip = name;
var count = g_Selection.groups.getCount(name);
getGUIObjectByName("unit"+guiName+"Count["+i+"]").caption = (count > 1 ? count : "");
break;

View File

@ -185,16 +185,9 @@ function getEntityFormationsList(entState)
return formations;
}
function getEntityCommandsList(entState)
{
var commands = [];
commands.push("Stop");
commands.push("Stop that!");
commands.push("Really stop now, OK?!");
// commands.push("command4");
// commands.push("command5");
// commands.push("command6");
commands.push("delete");
return commands;
}
@ -216,7 +209,7 @@ function getEntityCost(template)
function getEntityName(template)
{
return (template.name.specific || template.name.generic || "???");
return template.name.specific || template.name.generic || "???";
}
function getEntityNameWithGenericType(template)