Ticket #3277: GuiInterface_js.patch

File GuiInterface_js.patch, 1.2 KB (added by otero, 8 years ago)
  • binaries/data/mods/public/simulation/components/GuiInterface.js

     
    16601660    let firstMarket = cmpEntityTrader.GetFirstMarket();
    16611661    let secondMarket = cmpEntityTrader.GetSecondMarket();
    16621662    let result = null;
    1663     if (data.target === firstMarket)
     1663    if (!firstMarket)
    16641664    {
     1665        result = { "type": "set first" };
     1666    }
     1667    else if (!secondMarket)
     1668    {
    16651669        result = {
     1670            "type": "set second",
     1671            "gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
     1672        };
     1673    }
     1674    else if (data.target === firstMarket)
     1675    {
     1676        result = {
    16661677            "type": "is first",
    16671678            "hasBothMarkets": cmpEntityTrader.HasBothMarkets()
    16681679        };
     
    16761687            "gain": cmpEntityTrader.GetGain(),
    16771688        };
    16781689    }
    1679     else if (!firstMarket)
    1680     {
    1681         result = { "type": "set first" };
    1682     }
    1683     else if (!secondMarket)
    1684     {
    1685         result = {
    1686             "type": "set second",
    1687             "gain": cmpEntityTrader.CalculateGain(firstMarket, data.target),
    1688         };
    1689     }
    16901690    else
    16911691    {
    16921692        // Else both markets are not null and target is different from them