Ticket #2340: AlertRaiser.js.patch

File AlertRaiser.js.patch, 839 bytes (added by Michael, 10 years ago)

Checks, if a unit is already on its way to the garrison and if, don't send it again.

  • binaries/data/mods/public/simulation/components/AlertRaiser.js

     
    5959    for each(var unit in units)
    6060    {
    6161        var cmpUnitAI = Engine.QueryInterface(unit, IID_UnitAI);
     62       
     63        // check, if unit is already going into Garrison and only then make the call for that unit; see #2340
     64        var orders = cmpUnitAI.GetOrders();
     65        if(orders && orders.length > 0 && orders[0].type == "Garrison")
     66            continue;
     67           
     68        // send the request, if unit is not alreay on its way
    6269        cmpUnitAI.ReplaceOrder("Alert", {"raiser": this.entity, "force": true});
    6370        this.walkingUnits.push(unit);
    6471    }