Ticket #1404: output2.diff

File output2.diff, 4.2 KB (added by Idanwin, 10 years ago)

crude s/d tech solution

  • binaries/data/mods/public/maps/skirmishes/Acropolis

    diff --git a/binaries/data/mods/public/maps/skirmishes/Acropolis Bay (2).xml b/binaries/data/mods/public/maps/skirmishes/Acropolis Bay (2).xml
    index 05500c3..f164040 100644
    a b  
    2778827788        </Entity>
    2778927789    </Entities>
    2779027790    <Paths/>
    27791 </Scenario>
    27792  No newline at end of file
     27791</Scenario>
  • binaries/data/mods/public/simulation/components/Player.js

    diff --git a/binaries/data/mods/public/simulation/components/Player.js b/binaries/data/mods/public/simulation/components/Player.js
    index 6533801..045d0af 100644
    a b Player.prototype.Init = function()  
    2323        { "goods":  "wood", "proba": 30 },
    2424        { "goods": "stone", "proba": 35 },
    2525        { "goods": "metal", "proba": 35 } ];
     26    this.startingTech = [];
     27    this.disabledTech = [];
    2628    this.team = -1; // team number of the player, players on the same team will always have ally diplomatic status - also this is useful for team emblems, scoring, etc.
    2729    this.teamsLocked = false;
    2830    this.state = "active"; // game state - one of "active", "defeated", "won"
    Player.prototype.SetTradingGoods = function(tradingGoods)  
    319321        this.tradingGoods.push( {"goods": resource, "proba": tradingGoods[resource]} );
    320322};
    321323
     324Player.prototype.SetStartingTech = function(tech)
     325{
     326    this.startingTech = tech;
     327};
     328
     329Player.prototype.SetDisabledTech = function(tech)
     330{
     331    this.disabledTech = tech;
     332};
     333
     334Player.prototype.GetStartingTech = function(tech)
     335{
     336    return this.startingTech;
     337};
     338
     339Player.prototype.GetDisabledTech = function(tech)
     340{
     341    return this.disabledTech;
     342};
     343
    322344Player.prototype.GetState = function()
    323345{
    324346    return this.state;
  • binaries/data/mods/public/simulation/components/ProductionQueue.js

    diff --git a/binaries/data/mods/public/simulation/components/ProductionQueue.js b/binaries/data/mods/public/simulation/components/ProductionQueue.js
    index 6cc47d6..e12e268 100644
    a b ProductionQueue.prototype.GetTechnologiesList = function()  
    146146    if (!cmpTechnologyManager)
    147147        return [];
    148148   
     149    var cmpPlayer = QueryOwnerInterface(this.entity, IID_Player);
     150    var disabledTech = cmpPlayer.GetDisabledTech();
     151   
    149152    var techs = string.split(/\s+/);
    150153    var techList = [];
    151154    var superseded = {}; // Stores the tech which supersedes the key
    ProductionQueue.prototype.GetTechnologiesList = function()  
    155158    for (var i in techs)
    156159    {
    157160        var tech = techs[i];
    158         var template = cmpTechnologyManager.GetTechnologyTemplate(tech);
    159         if (!template.supersedes || techs.indexOf(template.supersedes) === -1)
    160             techList.push(tech);
    161         else
    162             superseded[template.supersedes] = tech;
     161        if(disabledTech.indexOf(tech)==-1){
     162            var template = cmpTechnologyManager.GetTechnologyTemplate(tech);
     163            if (!template.supersedes || techs.indexOf(template.supersedes) === -1)
     164                techList.push(tech);
     165            else
     166                superseded[template.supersedes] = tech;
     167        }
    163168    }
    164169   
    165170    // Now make researched/in progress techs invisible
  • binaries/data/mods/public/simulation/helpers/Player.js

    diff --git a/binaries/data/mods/public/simulation/helpers/Player.js b/binaries/data/mods/public/simulation/helpers/Player.js
    index 22207ce..9c41f9f 100644
    a b function LoadPlayerSettings(settings, newPlayers)  
    9090
    9191            if (getSetting(pData, pDefs, "Resources") !== undefined)
    9292                cmpPlayer.SetResourceCounts(getSetting(pData, pDefs, "Resources"));
     93           
     94            if (getSetting(pData, pDefs, "StartingTech") !== undefined)
     95                cmpPlayer.SetStartingTech(getSetting(pData, pDefs, "StartingTech"));
     96           
     97            var startingTech = cmpPlayer.GetStartingTech();
     98            var cmpTechnologyManager = Engine.QueryInterface(cmpPlayerManager.GetPlayerByID(i), IID_TechnologyManager);
     99            for(var j in startingTech){
     100                cmpTechnologyManager.ResearchTechnology(startingTech[j]);
     101            }
     102           
     103            if (getSetting(pData, pDefs, "DisabledTech") !== undefined)
     104                cmpPlayer.SetDisabledTech(getSetting(pData, pDefs, "DisabledTech"));
    93105
    94106            // If diplomacy explicitly defined, use that; otherwise use teams
    95107            if (getSetting(pData, pDefs, "Diplomacy") !== undefined)