Ticket #3208: structreeFix.patch

File structreeFix.patch, 1.5 KB (added by s0600204, 9 years ago)

The proposed change breaks the structree. This patch addresses that particular problem.

  • binaries/data/mods/public/gui/structree/load.js

     
    219219{
    220220    var template = loadTechData(phaseCode);
    221221    var phase = GetTechnologyDataHelper(template, g_SelectedCiv);
    222     phase.actualPhase = "";
    223222
     223    phase.actualPhase = phaseCode;
     224    if (template.replaces !== undefined)
     225        phase.actualPhase = template.replaces[0];
     226
    224227    return phase;
    225228}
    226229
  • binaries/data/mods/public/gui/structree/structree.js

     
    125125    // Establish phase order
    126126    g_ParsedData.phaseList = unravelPhases(g_ParsedData.techs);
    127127    for (let phasecode of g_ParsedData.phaseList)
    128     {
    129         let phaseInfo = loadTechData(phasecode);
    130128        g_ParsedData.phases[phasecode] = loadPhase(phasecode);
    131129
    132         if ("requirements" in phaseInfo)
    133             for (let op in phaseInfo.requirements)
    134             {
    135                 let val = phaseInfo.requirements[op];
    136                 if (op == "any")
    137                     for (let v of val)
    138                     {
    139                         let k = Object.keys(v);
    140                         k = k[0];
    141                         v = v[k];
    142                         if (k == "tech" && v in g_ParsedData.phases)
    143                             g_ParsedData.phases[v].actualPhase = phasecode;
    144                     }
    145             }
    146     }
    147 
    148130    // Group production lists of structures by phase
    149131    for (let structCode of g_Lists.structures)
    150132    {