Ticket #1918: garrisonBug.diff

File garrisonBug.diff, 938 bytes (added by mimo, 11 years ago)
  • binaries/data/mods/public/gui/session/selection.js

     
    5959                continue;
    6060
    6161            var templateName = entState.template;
    62             // Special handling for garrisoned units
    63             if (templateName && templateName.indexOf("&") != -1)
    64                 var key = templateName;
    65             else
    66                 var key = GetTemplateData(templateName).selectionGroupName || templateName;
     62            var template = GetTemplateData(templateName);
     63            var key = template.selectionGroupName || templateName;
    6764
     65            // Garrisoned units have an extended template
     66            var index = templateName.indexOf("&");
     67            if (index != -1 && key.indexOf("&") == -1)
     68                key = templateName.slice(0, index+1) + key;
     69
    6870            if (this.groups[key])
    6971                this.groups[key] += 1;
    7072            else