small cleaning

This was SVN commit r14669.
This commit is contained in:
mimo 2014-01-25 19:58:59 +00:00
parent 69991cd110
commit 28a707f98f
2 changed files with 9 additions and 7 deletions

View File

@ -724,7 +724,7 @@ GuiInterface.prototype.GetStartedResearch = function(player)
ret[tech].progress = 0; ret[tech].progress = 0;
} }
return ret; return ret;
} };
// Returns the battle state of the player. // Returns the battle state of the player.
GuiInterface.prototype.GetBattleState = function(player) GuiInterface.prototype.GetBattleState = function(player)
@ -1745,7 +1745,7 @@ function isIdleUnit(ent, idleClass)
// TODO: Do something with garrisoned idle units // TODO: Do something with garrisoned idle units
return (cmpUnitAI && cmpIdentity && cmpUnitAI.IsIdle() && !cmpUnitAI.IsGarrisoned() && idleClass && cmpIdentity.HasClass(idleClass)); return (cmpUnitAI && cmpIdentity && cmpUnitAI.IsIdle() && !cmpUnitAI.IsGarrisoned() && idleClass && cmpIdentity.HasClass(idleClass));
} };
GuiInterface.prototype.FindIdleUnits = function(player, data) GuiInterface.prototype.FindIdleUnits = function(player, data)
{ {
@ -1778,7 +1778,7 @@ GuiInterface.prototype.FindIdleUnits = function(player, data)
} }
return idleUnits; return idleUnits;
} };
GuiInterface.prototype.GetTradingRouteGain = function(player, data) GuiInterface.prototype.GetTradingRouteGain = function(player, data)
{ {
@ -1786,7 +1786,7 @@ GuiInterface.prototype.GetTradingRouteGain = function(player, data)
return null; return null;
return CalculateTraderGain(data.firstMarket, data.secondMarket, data.template); return CalculateTraderGain(data.firstMarket, data.secondMarket, data.template);
} };
GuiInterface.prototype.GetTradingDetails = function(player, data) GuiInterface.prototype.GetTradingDetails = function(player, data)
{ {
@ -1934,7 +1934,7 @@ GuiInterface.prototype.GetTradingGoods = function(player, tradingGoods)
GuiInterface.prototype.OnGlobalEntityRenamed = function(msg) GuiInterface.prototype.OnGlobalEntityRenamed = function(msg)
{ {
this.renamedEntities.push(msg); this.renamedEntities.push(msg);
} };
// List the GuiInterface functions that can be safely called by GUI scripts. // List the GuiInterface functions that can be safely called by GUI scripts.
// (GUI scripts are non-deterministic and untrusted, so these functions must be // (GUI scripts are non-deterministic and untrusted, so these functions must be

View File

@ -247,8 +247,10 @@ Trader.prototype.GetNextMarket = function()
{ {
if (this.goods.amount && this.goods.origin == this.firstMarket) if (this.goods.amount && this.goods.origin == this.firstMarket)
return this.secondMarket; return this.secondMarket;
else
return this.firstMarket; if (this.goods.amount && this.goods.origin != this.secondMarket)
this.goods.amount = null; // leftover from previous trading
return this.firstMarket;
}; };
Trader.prototype.StopTrading = function() Trader.prototype.StopTrading = function()