Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#3838 closed defect (fixed)

Error in cmpUnitAI - cmpTrader

Reported by: sanderd17 Owned by: mimo
Priority: Release Blocker Milestone: Alpha 20
Component: UI & Simulation Keywords:
Cc: Patch:

Description

The two MP games from last evening caused a repeating error in UnitAI:

TypeError: cmpTrader.GetGoods(...).amount is null
  UnitAI.prototype.PerformTradeAndMoveToNextMarket@simulation/components/UnitAI.js:5247:6
  UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.TRADE.APPROACHINGMARKET.MoveCompleted@simulation/components/UnitAI.js:2614:7
  FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:274:29
  UnitAI.prototype.OnMotionChanged@simulation/components/UnitAI.js:3895:63

It eventually stopped (perhaps when the players re-assigned their traders).

There's a "rather long" commands.txt attached

Attachments (2)

fixMarket.patch (591 bytes ) - added by mimo 8 years ago.
commands.2.txt (1.3 MB ) - added by elexis 8 years ago.
turn 4199 and following

Download all attachments as: .zip

Change History (7)

by mimo, 8 years ago

Attachment: fixMarket.patch added

comment:1 by mimo, 8 years ago

This patch should fix the problem. But your commands.txt is incomplete (it starts only turn 261. Have you rejoined ? It would be useful to have a full commands.txt of this game to check the fix and understand how this variable became null.

comment:2 by sanderd17, 8 years ago

Right, I forgot I had to rejoin. With the metadata attached, you should be able to do a replay.

Elexis should also have the full commands.txt.

by elexis, 8 years ago

Attachment: commands.2.txt added

turn 4199 and following

comment:3 by elexis, 8 years ago

See commands.2.txt:

turn 4199 500
cmd 5 {"type":"setup-trade-route","entities":[11249,11252,11572,11573,11574,11575,12647,12649,12980,12981,12982,12983,12984,13535,17018,17019,17020,17021],"target":17645,"source":null,"route":null,"queued":true}

In particular "target":17645,"source":null,"route":null.

Played on r17916, log with entity IDs:

Turn 4199 (500)...
WARNING: 11575 is broken
ERROR: JavaScript error: simulation/components/UnitAI.js line 5251
TypeError: cmpTrader.GetGoods(...).amount is null
  UnitAI.prototype.PerformTradeAndMoveToNextMarket@simulation/components/UnitAI.js:5251:6
  UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.TRADE.APPROACHINGMARKET.MoveCompleted@simulation/components/UnitAI.js:2614:7
  FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:274:29
  UnitAI.prototype.OnMotionChanged@simulation/components/UnitAI.js:3895:63
ERROR: Script message handler OnMotionChanged failed
Turn 4200 (500)...
hash ok (fabd78d135d64cd6d6a6082a8e2c4bb7)
Turn 4201 (500)...
Turn 4202 (500)...
Turn 4203 (500)...
Turn 4204 (500)...
WARNING: 11249 is broken
ERROR: JavaScript error: simulation/components/UnitAI.js line 5251
TypeError: cmpTrader.GetGoods(...).amount is null
  UnitAI.prototype.PerformTradeAndMoveToNextMarket@simulation/components/UnitAI.js:5251:6
  UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.TRADE.APPROACHINGMARKET.MoveCompleted@simulation/components/UnitAI.js:2614:7
  FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:274:29
  UnitAI.prototype.OnMotionChanged@simulation/components/UnitAI.js:3895:63
ERROR: Script message handler OnMotionChanged failed
Turn 4205 (500)...
Turn 4206 (500)...
Turn 4207 (500)...
Turn 4208 (500)...
Turn 4209 (500)...
WARNING: 12982 is broken
ERROR: JavaScript error: simulation/components/UnitAI.js line 5251
TypeError: cmpTrader.GetGoods(...).amount is null
  UnitAI.prototype.PerformTradeAndMoveToNextMarket@simulation/components/UnitAI.js:5251:6
  UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.TRADE.APPROACHINGMARKET.MoveCompleted@simulation/components/UnitAI.js:2614:7
  FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:274:29
  UnitAI.prototype.OnMotionChanged@simulation/components/UnitAI.js:3895:63
ERROR: Script message handler OnMotionChanged failed
Turn 4210 (500)...
Turn 4211 (500)...
Turn 4212 (500)...
Turn 4213 (500)...
Turn 4214 (500)...
WARNING: 12983 is broken
ERROR: JavaScript error: simulation/components/UnitAI.js line 5251
TypeError: cmpTrader.GetGoods(...).amount is null
  UnitAI.prototype.PerformTradeAndMoveToNextMarket@simulation/components/UnitAI.js:5251:6
  UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.TRADE.APPROACHINGMARKET.MoveCompleted@simulation/components/UnitAI.js:2614:7
  FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:274:29
  UnitAI.prototype.OnMotionChanged@simulation/components/UnitAI.js:3895:63
ERROR: Script message handler OnMotionChanged failed
Turn 4215 (500)...
WARNING: 12981 is broken
ERROR: JavaScript error: simulation/components/UnitAI.js line 5251
TypeError: cmpTrader.GetGoods(...).amount is null
  UnitAI.prototype.PerformTradeAndMoveToNextMarket@simulation/components/UnitAI.js:5251:6
  UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.TRADE.APPROACHINGMARKET.MoveCompleted@simulation/components/UnitAI.js:2614:7
  FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:274:29
  UnitAI.prototype.OnMotionChanged@simulation/components/UnitAI.js:3895:63
ERROR: Script message handler OnMotionChanged failed
WARNING: 12984 is broken
ERROR: JavaScript error: simulation/components/UnitAI.js line 5251
TypeError: cmpTrader.GetGoods(...).amount is null
  UnitAI.prototype.PerformTradeAndMoveToNextMarket@simulation/components/UnitAI.js:5251:6
  UnitAI.prototype.UnitFsmSpec.INDIVIDUAL.TRADE.APPROACHINGMARKET.MoveCompleted@simulation/components/UnitAI.js:2614:7
  FSM.prototype.ProcessMessage@simulation/helpers/FSM.js:274:29
  UnitAI.prototype.OnMotionChanged@simulation/components/UnitAI.js:3895:63
ERROR: Script message handler OnMotionChanged failed
Turn 4216 (500)...

comment:4 by mimo, 8 years ago

Owner: set to mimo
Resolution: fixed
Status: newclosed

In 17918:

fix the test when changing markets, fixes #3838

comment:5 by mimo, 8 years ago

The problem occured when changing the market of a trade route on the same turn as the trade was performed. The patch also includes some cleaning of useless steps in the SetTargetMarket function.

Note: See TracTickets for help on using tickets.