Ticket #4870: ticket4870.patch

File ticket4870.patch, 3.1 KB (added by mimo, 6 years ago)
  • binaries/data/mods/public/maps/random/rmgen/player.js

     
    77 */
    88function getStartingEntities(playerID)
    99{
    10     return g_CivData[getCivCode(playerID)].StartEntities;
     10    return g_CivData.brit.StartEntities;
    1111}
    1212
    1313/**
  • binaries/data/mods/public/simulation/ai/common-api/gamestate.js

     
    810810 */
    811811m.GameState.prototype.findBuilder = function(template)
    812812{
     813    let civ = this.getPlayerCiv();
    813814    for (let ent of this.getOwnUnits().values())
    814815    {
    815         let buildable = ent.buildableEntities();
     816        let buildable = ent.buildableEntities(civ);
    816817        if (buildable && buildable.indexOf(template) !== -1)
    817818            return ent;
    818819    }
  • binaries/data/mods/public/simulation/ai/petra/queueplanBuilding.js

     
    3838{
    3939    Engine.ProfileStart("Building construction start");
    4040
    41     // We don't care which builder we assign, since they won't actually
    42     // do the building themselves - all we care about is that there is
    43     // at least one unit that can start the foundation
     41    // We don't care which builder we assign, since they won't actually do
     42    // the building themselves - all we care about is that there is at least
     43    // one unit that can start the foundation (should always be the case here).
    4444    let builder = gameState.findBuilder(this.type);
     45    if (!builder)
     46    {
     47            API3.warn("petra error: builder not found when starting construction.");
     48            Engine.ProfileStop();
     49            return;
     50    }
    4551
    4652    let pos = this.findGoodPosition(gameState);
    4753    if (!pos)
  • binaries/data/mods/public/simulation/components/Builder.js

     
    2727Builder.prototype.GetEntitiesList = function()
    2828{
    2929    let string = this.template.Entities._string;
    30 
    3130    if (!string)
    3231        return [];
    3332
    34     let cmpIdentity = Engine.QueryInterface(this.entity, IID_Identity);
    35     if (cmpIdentity)
    36         string = string.replace(/\{civ\}/g, cmpIdentity.GetCiv());
    37 
    38     let entities = string.split(/\s+/);
    39 
    4033    let cmpPlayer = QueryOwnerInterface(this.entity);
    4134    if (!cmpPlayer)
    42         return entities;
     35        return [];
    4336
     37    let entities = string.replace(/\{civ\}/g, cmpPlayer.GetCiv()).split(/\s+/);
     38
    4439    let disabledTemplates = cmpPlayer.GetDisabledTemplates();
    4540
    4641    let cmpTemplateManager = Engine.QueryInterface(SYSTEM_ENTITY, IID_TemplateManager);