1
0
forked from mirrors/0ad

Change an Object into a Map, this should stop the deserializer of reordering the keys in some cases and stop an OOS on rejoining. Refs #3375

This was SVN commit r17935.
This commit is contained in:
sanderd17
2016-03-22 20:57:27 +00:00
parent c43ce2ca55
commit fc14e733bd
@@ -32,7 +32,7 @@ StatusBars.prototype.Sprites =
StatusBars.prototype.Init = function()
{
this.enabled = false;
this.auraSources = {};
this.auraSources = new Map();
};
/**
@@ -63,16 +63,16 @@ StatusBars.prototype.SetEnabled = function(enabled)
StatusBars.prototype.AddAuraSource = function(source, auraName)
{
if (this.auraSources[source])
this.auraSources[source].push(auraName);
if (this.auraSources.has(source))
this.auraSources.get(source).push(auraName);
else
this.auraSources[source] = [auraName];
this.auraSources.set(source, [auraName]);
this.RegenerateSprites();
};
StatusBars.prototype.RemoveAuraSource = function(source, auraName)
{
let names = this.auraSources[source];
let names = this.auraSources.get(source);
names.splice(names.indexOf(auraName), 1);
this.RegenerateSprites();
};
@@ -233,7 +233,7 @@ StatusBars.prototype.AddCaptureBar = function(cmpOverlayRenderer, yoffset)
StatusBars.prototype.AddAuraIcons = function(cmpOverlayRenderer, yoffset)
{
let cmpGuiInterface = Engine.QueryInterface(SYSTEM_ENTITY, IID_GuiInterface);
let sources = cmpGuiInterface.GetEntitiesWithStatusBars().filter(e => this.auraSources[e] && this.auraSources[e].length);
let sources = cmpGuiInterface.GetEntitiesWithStatusBars().filter(e => this.auraSources.has(e) && this.auraSources.get(e).length);
if (!sources.length)
return 0;
@@ -244,7 +244,7 @@ StatusBars.prototype.AddAuraIcons = function(cmpOverlayRenderer, yoffset)
let cmpAuras = Engine.QueryInterface(ent, IID_Auras);
if (!cmpAuras) // probably the ent just died
continue;
for (let name of this.auraSources[ent])
for (let name of this.auraSources.get(ent))
iconSet.add(cmpAuras.GetOverlayIcon(name));
}