Revert an unoptimized GUI update from f7e591c9f2
. Instead, notify directly the GUI in case of miraged entities, and treat them the same way we treat renamed entities.
Fixes #2778 This was SVN commit r15703.
This commit is contained in:
parent
001e6f6ca3
commit
2b1efa5035
@ -235,10 +235,8 @@ EntitySelection.prototype.getTemplateNames = function()
|
|||||||
*/
|
*/
|
||||||
EntitySelection.prototype.update = function()
|
EntitySelection.prototype.update = function()
|
||||||
{
|
{
|
||||||
this.checkRenamedEntities();
|
|
||||||
|
|
||||||
var miraged = {};
|
|
||||||
var changed = false;
|
var changed = false;
|
||||||
|
this.checkRenamedEntities();
|
||||||
for each (var ent in this.selected)
|
for each (var ent in this.selected)
|
||||||
{
|
{
|
||||||
var entState = GetEntityState(ent);
|
var entState = GetEntityState(ent);
|
||||||
@ -252,13 +250,6 @@ EntitySelection.prototype.update = function()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Manually replace newly miraged entities by their mirages
|
|
||||||
if (entState.fogging && entState.fogging.mirage)
|
|
||||||
{
|
|
||||||
miraged[ent] = entState.fogging.mirage;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Remove non-visible units (e.g. moved back into fog-of-war)
|
// Remove non-visible units (e.g. moved back into fog-of-war)
|
||||||
if (entState.visibility == "hidden")
|
if (entState.visibility == "hidden")
|
||||||
{
|
{
|
||||||
@ -273,9 +264,6 @@ EntitySelection.prototype.update = function()
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
this.rebuildSelection(miraged);
|
|
||||||
|
|
||||||
if (changed)
|
if (changed)
|
||||||
this.onChange();
|
this.onChange();
|
||||||
};
|
};
|
||||||
|
@ -104,6 +104,10 @@ Fogging.prototype.LoadMirage = function(player)
|
|||||||
cmpResourceSupply.GetType(),
|
cmpResourceSupply.GetType(),
|
||||||
cmpResourceSupply.IsInfinite()
|
cmpResourceSupply.IsInfinite()
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Notify the GUI the entity has been replaced by a mirage, in case it is selected at this moment
|
||||||
|
var cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
|
||||||
|
cmpGuiInterface.AddMiragedEntity(player, this.entity, this.mirages[player]);
|
||||||
};
|
};
|
||||||
|
|
||||||
Fogging.prototype.ForceMiraging = function(player)
|
Fogging.prototype.ForceMiraging = function(player)
|
||||||
|
@ -22,6 +22,7 @@ GuiInterface.prototype.Init = function()
|
|||||||
this.placementWallLastAngle = 0;
|
this.placementWallLastAngle = 0;
|
||||||
this.notifications = [];
|
this.notifications = [];
|
||||||
this.renamedEntities = [];
|
this.renamedEntities = [];
|
||||||
|
this.miragedEntities = [];
|
||||||
this.timeNotificationID = 1;
|
this.timeNotificationID = 1;
|
||||||
this.timeNotifications = [];
|
this.timeNotifications = [];
|
||||||
this.entsRallyPointsDisplayed = [];
|
this.entsRallyPointsDisplayed = [];
|
||||||
@ -148,12 +149,24 @@ GuiInterface.prototype.GetExtendedSimulationState = function(player)
|
|||||||
|
|
||||||
GuiInterface.prototype.GetRenamedEntities = function(player)
|
GuiInterface.prototype.GetRenamedEntities = function(player)
|
||||||
{
|
{
|
||||||
return this.renamedEntities;
|
if (this.miragedEntities[player])
|
||||||
|
return this.renamedEntities.concat(this.miragedEntities[player]);
|
||||||
|
else
|
||||||
|
return this.renamedEntities;
|
||||||
};
|
};
|
||||||
|
|
||||||
GuiInterface.prototype.ClearRenamedEntities = function(player)
|
GuiInterface.prototype.ClearRenamedEntities = function(player)
|
||||||
{
|
{
|
||||||
this.renamedEntities = [];
|
this.renamedEntities = [];
|
||||||
|
this.miragedEntities = [];
|
||||||
|
};
|
||||||
|
|
||||||
|
GuiInterface.prototype.AddMiragedEntity = function(player, entity, mirage)
|
||||||
|
{
|
||||||
|
if (player >= this.miragedEntities.length)
|
||||||
|
this.miragedEntities[player] = [];
|
||||||
|
|
||||||
|
this.miragedEntities[player].push({"entity": entity, "newentity": mirage});
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user