Ticket #1089: global.diff

File global.diff, 1.7 KB (added by mimo, 9 years ago)
  • binaries/data/mods/public/simulation/components/AIInterface.js

     
    2020    "TributeExchanged"
    2121];
    2222
     23var g_changedEntities = {};
     24
    2325AIInterface.prototype.Init = function()
    2426{
    2527    this.events = {};
     
    2628    for each (var i in this.EventNames)
    2729        this.events[i] = [];
    2830
    29     this.changedEntities = {};
    30 
    3131    // cache for technology changes;
    3232    // this one is PlayerID->TemplateName->{StringForTheValue, ActualValue}
    3333    this.changedTemplateInfo = {};
     
    6161    // Add entity representations
    6262    Engine.ProfileStart("proxy representations");
    6363    state.entities = {};
    64     for (var id in this.changedEntities)
     64    for (var id in g_changedEntities)
    6565    {
    6666        var aiProxy = Engine.QueryInterface(+id, IID_AIProxy);
    6767        if (aiProxy)
    6868            state.entities[id] = aiProxy.GetRepresentation();
    6969    }
    70     this.changedEntities = {};
     70    g_changedEntities = {};
    7171    Engine.ProfileStop();
    7272
    7373    state.changedTemplateInfo = this.changedTemplateInfo;
     
    9191    Engine.ProfileStart("proxy representations");
    9292    state.entities = {};
    9393    // all entities are changed in the initial state.
    94     for (var id in this.changedEntities)
     94    for (var id in g_changedEntities)
    9595    {
    9696        var aiProxy = Engine.QueryInterface(+id, IID_AIProxy);
    9797        if (aiProxy)
     
    109109
    110110AIInterface.prototype.ChangedEntity = function(ent)
    111111{
    112     this.changedEntities[ent] = 1;
     112    g_changedEntities[ent] = 1;
    113113};
    114114
    115115// AIProxy sets up a load of event handlers to capture interesting things going on