Ticket #2475: map_replacement.diff
File map_replacement.diff, 2.5 KB (added by , 10 years ago) |
---|
-
binaries/data/mods/public/simulation/ai/common-api/entity.js
8 8 _init: function(template) 9 9 { 10 10 this._template = template; 11 this._tpCache = {};11 this._tpCache = new Map(); 12 12 }, 13 13 14 14 // helper function to return a template value, optionally adjusting for tech. … … 18 18 var value = this._template; 19 19 if (this._auraTemplateModif && this._auraTemplateModif[string]) { 20 20 return this._auraTemplateModif[string]; 21 } else if (this._techModif && this._techModif [string]) {22 return this._techModif [string];21 } else if (this._techModif && this._techModif.has(string)) { 22 return this._techModif.get(string); 23 23 } else { 24 if ( this._tpCache[string] == null)24 if (!this._tpCache.has(string)) 25 25 { 26 26 var args = string.split("/"); 27 27 for (var i = 0; i < args.length; ++i) … … 32 32 value = undefined; 33 33 break; 34 34 } 35 this._tpCache [string] = value;35 this._tpCache.set(string, value); 36 36 } 37 return this._tpCache[string]; 38 } 37 return this._tpCache.get(string); 38 } 39 39 40 }, 40 41 41 42 genericName: function() { … … 513 514 this._auraTemplateModif = {}; // template modification from auras. this is only for this entity. 514 515 this._ai = sharedAI; 515 516 if (!sharedAI._techModifications[entity.owner][this._templateName]) 516 sharedAI._techModifications[entity.owner][this._templateName] = {};517 sharedAI._techModifications[entity.owner][this._templateName] = new Map(); 517 518 this._techModif = sharedAI._techModifications[entity.owner][this._templateName]; // save a reference to the template tech modifications 518 519 }, 519 520 -
binaries/data/mods/public/simulation/ai/common-api/shared.js
340 340 { 341 341 var changes = playerDiff[template]; 342 342 if (!this._techModifications[player][template]) 343 this._techModifications[player][template] = {};343 this._techModifications[player][template] = new Map(); 344 344 for each (var change in changes) 345 this._techModifications[player][template] [change.variable] = change.value;345 this._techModifications[player][template].set(change.variable, change.value); 346 346 } 347 347 } 348 348 Engine.ProfileStop();