Opened 6 years ago

Closed 4 years ago

Last modified 4 years ago

#5282 closed defect (fixed)

Petra serialization error when ceasefire ends

Reported by: elexis Owned by: Silier
Priority: Must Have Milestone: Alpha 24
Component: AI Keywords:
Cc: Patch: Phab:D2695

Description

As reported by DangerousI on https://wildfiregames.com/forum/index.php?/topic/24727-javascript-error-petrabot-typeerror/&tab=comments#comment-360274

In multiplayermode there occurs this error when ceasefire runs out:

ERROR: JavaScript error: simulation/ai/petra/_petrabot.js line 140
TypeError: savedEvents[key][ i] is undefined 

Change History (4)

comment:1 by smiley, 6 years ago

AIInterface.prototype.OnCeasefireEnded = function(msg) {

  this.events.CeasefireEnded.push(msg);

};

That's the offending code. msg would be empty while the AI expects all the events to be objects. Not sure, but I don't think this code is even needed. AI's onUpdate recieves the state which contains a boolean called ceasefireActive. Quick and easy fix would be to push {} instead of msg I guess.

comment:2 by Silier, 4 years ago

Milestone: BacklogWork In Progress
Patch: Phab:D2695

comment:3 by Silier, 4 years ago

Owner: set to Silier
Resolution: fixed
Status: newclosed

In 23583:

Fix handling events with undefined message in _petrabot Serialization [Petra]

Check for undefined messages when Serializing events.

Differential Revision: https://code.wildfiregames.com/D2695
Reported by: DangerousI ( https://wildfiregames.com/forum/index.php?/topic/24727-javascript-error-petrabot-typeerror/)
Reviewed by: Freagarach
Tested by: gameboy
Fixes: #5282

comment:4 by Silier, 4 years ago

Milestone: Work In ProgressAlpha 24
Note: See TracTickets for help on using tickets.