diff --git a/binaries/data/mods/public/gui/session_new/input.js b/binaries/data/mods/public/gui/session_new/input.js
index c5469f48bc..1ebe23e381 100644
--- a/binaries/data/mods/public/gui/session_new/input.js
+++ b/binaries/data/mods/public/gui/session_new/input.js
@@ -4,7 +4,7 @@ const SDL_BUTTON_RIGHT = 3;
const SDLK_RSHIFT = 303;
const SDLK_LSHIFT = 304;
-const MAX_SELECTION_SIZE = 32;
+const MAX_SELECTION_SIZE = 32; // Limits selection size and ensures that there will not be too many selection items in the GUI
// TODO: these constants should be defined somewhere else instead, in
// case any other code wants to use them too
@@ -623,15 +623,18 @@ function changePrimarySelectionGroup(index)
g_Selection.makePrimarySelection(index, false);
}
-// Performs the specified command
+// Performs the specified command (delete, town bell, repair, etc.)
function performCommand(entity, commandName)
{
- switch (commandName)
+ if (entity)
{
- case "delete":
- Engine.PostNetworkCommand({"type": "delete-entity", "entity": entity});
- break;
- default:
- break;
+ switch (commandName)
+ {
+ case "delete":
+ Engine.PostNetworkCommand({"type": "delete-entity", "entity": entity});
+ break;
+ default:
+ break;
+ }
}
-}
+}
\ No newline at end of file
diff --git a/binaries/data/mods/public/gui/session_new/selection.js b/binaries/data/mods/public/gui/session_new/selection.js
index 9c32fabc9e..1ace87cf9a 100644
--- a/binaries/data/mods/public/gui/session_new/selection.js
+++ b/binaries/data/mods/public/gui/session_new/selection.js
@@ -52,7 +52,6 @@ EntitySelection.prototype.makePrimarySelection = function(primaryIndex, modifier
var entState = Engine.GuiInterfaceCall("GetEntityState", selection[i]);
if (!entState)
return;
-
if (entState.template == primaryEntState.template)
ents.push(selection[i]);
}
@@ -61,7 +60,6 @@ EntitySelection.prototype.makePrimarySelection = function(primaryIndex, modifier
{
ents.push(selection[primaryIndex]);
}
-
this.reset();
this.addList(ents);
}
@@ -78,29 +76,22 @@ EntitySelection.prototype.getTemplateNames = function()
if (entState)
templateNames.push(entState.template);
}
-
return templateNames;
}
// Update the selection to take care of changes (like units that have been killed)
-EntitySelection.prototype.updateSelection = function()
+EntitySelection.prototype.update = function()
{
var numberRemoved = 0;
- var i = 0;
-
for each (var ent in this.selected)
{
var entState = Engine.GuiInterfaceCall("GetEntityState", ent);
-
if (!entState)
{
delete this.selected[ent];
numberRemoved++;
}
-
- i++;
}
-
if (numberRemoved > 0)
this.dirty = true;
};
diff --git a/binaries/data/mods/public/gui/session_new/selection_details.js b/binaries/data/mods/public/gui/session_new/selection_details.js
index 707eb6af7b..c7111e804a 100644
--- a/binaries/data/mods/public/gui/session_new/selection_details.js
+++ b/binaries/data/mods/public/gui/session_new/selection_details.js
@@ -37,14 +37,15 @@ function displayGeneralInfo(playerState, entState, template)
var iconTooltip = "";
// Rank Icon
- var rankId = getRankCellId(entState.template);
- getGUIObjectByName("sdRankIcon").cell_id = rankId;
+// var rankId = getRankCellId(entState.template);
+// getGUIObjectByName("sdRankIcon").cell_id = rankId;
- var rankText = getRankTitle(rankId);
- rankText = (rankText? " (" + rankText + ")" : "");
+ // Rank Title
+// var rankText = getRankTitle(getRankCellId(entState.template));
+// rankText = (rankText? rankText : "");
// Specific Name
- var name = template.name.specific + rankText;
+ var name = template.name.specific + getRankTitle(getRankCellId(entState.template));
getGUIObjectByName("sdSpecific").caption = name;
iconTooltip += "[font=\"serif-bold-16\"]" + name + "[/font]";
@@ -126,7 +127,7 @@ function updateSelectionDetails(simState)
var detailsPanel = getGUIObjectByName("selectionDetails");
var commandsPanel = getGUIObjectByName("unitCommands");
- g_Selection.updateSelection();
+ g_Selection.update();
var selection = g_Selection.toList();
if (selection.length == 0)
diff --git a/binaries/data/mods/public/gui/session_new/session.js b/binaries/data/mods/public/gui/session_new/session.js
index 7ae7ceb863..d0eb5f968d 100644
--- a/binaries/data/mods/public/gui/session_new/session.js
+++ b/binaries/data/mods/public/gui/session_new/session.js
@@ -219,17 +219,15 @@ function getRankCellId(templateName)
else if (endsWith == "_a")
return 1;
}
-
return -1;
}
function getRankTitle(cellId)
{
if (cellId == 0)
- return "Elite";
+ return " (Elite)";
else if (cellId == 1)
- return "Advanced";
-
+ return " (Advanced)";
return "";
}
@@ -253,7 +251,7 @@ function getEntityName(template)
return "[font=\"serif-bold-16\"]" + (template.name.specific || template.name.generic || "???") + "[/font]";
}
-function getEntityNameWithGeneric(template)
+function getEntityNameWithGenericType(template)
{
var name;
diff --git a/binaries/data/mods/public/gui/session_new/session.xml b/binaries/data/mods/public/gui/session_new/session.xml
index 0750f937e9..4d61d00662 100644
--- a/binaries/data/mods/public/gui/session_new/session.xml
+++ b/binaries/data/mods/public/gui/session_new/session.xml
@@ -50,6 +50,11 @@
]]>
+
+
+
@@ -311,26 +316,26 @@
-