fix selection when owner change, ref #3645

This was SVN commit r17306.
This commit is contained in:
mimo 2015-11-28 11:16:13 +00:00
parent 2d4ec03019
commit 2548187474
3 changed files with 7 additions and 2 deletions

View File

@ -229,6 +229,8 @@ EntitySelection.prototype.update = function()
{ {
var changed = false; var changed = false;
this.checkRenamedEntities(); this.checkRenamedEntities();
var removeOwnerChanges = !g_DevSettings.controlAll && this.toList().length > 1;
var playerID = Engine.GetPlayerID();
for each (var ent in this.selected) for each (var ent in this.selected)
{ {
var entState = GetEntityState(ent); var entState = GetEntityState(ent);
@ -245,7 +247,9 @@ EntitySelection.prototype.update = function()
// Remove non-visible units (e.g. moved back into fog-of-war) // Remove non-visible units (e.g. moved back into fog-of-war)
// At the next update, mirages will be renamed to the real // At the next update, mirages will be renamed to the real
// entity they replace, so just ignore them now // entity they replace, so just ignore them now
if (entState.visibility == "hidden" && !entState.mirage) // Futhermore, when multiple selection, remove units which have changed ownership
if ((entState.visibility == "hidden" && !entState.mirage)
|| (removeOwnerChanges && entState.player != playerID))
{ {
// Disable any highlighting of the disappeared unit // Disable any highlighting of the disappeared unit
_setHighlight([ent], 0, false); _setHighlight([ent], 0, false);

View File

@ -374,7 +374,6 @@ function updateSelectionDetails()
var detailsPanel = Engine.GetGUIObjectByName("selectionDetails"); var detailsPanel = Engine.GetGUIObjectByName("selectionDetails");
var commandsPanel = Engine.GetGUIObjectByName("unitCommands"); var commandsPanel = Engine.GetGUIObjectByName("unitCommands");
g_Selection.update();
var selection = g_Selection.toList(); var selection = g_Selection.toList();
if (selection.length == 0) if (selection.length == 0)

View File

@ -536,6 +536,8 @@ function onSimulationUpdate()
handleNotifications(); handleNotifications();
g_Selection.update();
if (g_ShowAllStatusBars) if (g_ShowAllStatusBars)
recalculateStatusBarDisplay(); recalculateStatusBarDisplay();