Ticket #3411: 3411.patch

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

Proposed fix.

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

     
    131131    for (let structCode of g_Lists.structures)
    132132    {
    133133        let structInfo = g_ParsedData.structures[structCode];
     134        let structPhaseIdx = g_ParsedData.phaseList.indexOf(structInfo.phase);
    134135
    135136        // If this building is shared with another civ,
    136137        // it may have already gone through the grouping process already
     
    170171                        phase = req;
    171172            }
    172173
    173             if (depath(phase).slice(0,5) !== "phase")
    174             {
    175                 warn(prod+" doesn't have a specific phase set ("+structCode+")");
    176                 phase = structInfo.phase;
    177             }
     174            if (depath(phase).slice(0,5) !== "phase" || g_ParsedData.phaseList.indexOf(phase) < structPhaseIdx)
     175                if (structInfo.phase !== false)
     176                    phase = structInfo.phase;
     177                else
     178                    phase = g_ParsedData.phaseList[0];
    178179
    179180            if (!(phase in newProdTech))
    180181                newProdTech[phase] = [];
     
    202203                else
    203204                    phase = reqs.generic[0];
    204205            }
    205             else if (structInfo.phase !== false)
    206                 phase = structInfo.phase;
    207             else
    208                 phase = g_ParsedData.phaseList[0];
    209206
     207            if (depath(phase).slice(0,5) !== "phase" || g_ParsedData.phaseList.indexOf(phase) < structPhaseIdx)
     208                if (structInfo.phase !== false)
     209                    phase = structInfo.phase;
     210                else
     211                    phase = g_ParsedData.phaseList[0];
     212
    210213            if (!(phase in newProdUnits))
    211214                newProdUnits[phase] = [];
    212215