Jump to content

ERRORs on svn


fabio
 Share

Recommended Posts

I get this error on current svn, default map:

WARNING: JavaScript warning: simulation/ai/common-api-v2/entity.js line 125
reference to undefined property this._template.Builder.Entities._string
ERROR: JavaScript error: simulation/ai/common-api-v2/entity.js line 125
TypeError: this._template.Builder.Entities._string is undefined
()@simulation/ai/common-api-v2/entity.js:125
([object Object],"4623",[object Object])@simulation/ai/qbot/gamestate.js:283
([object Object])@simulation/ai/common-api-v2/entitycollection.js:79
("structures/maur_house")@simulation/ai/qbot/gamestate.js:281
([object Object])@simulation/ai/qbot/plan-building.js:23
([object Object])@simulation/ai/qbot/queue-manager.js:282
()@simulation/ai/qbot/qbot.js:108
([object Object])@simulation/ai/common-api-v2/base.js:122
@:0

Link to comment
Share on other sites

I wonder if that could be the Mauryan support elephant, I changed it to be able to repair but not place new foundations, so likely the AI must be updated to handle this case (I didn't know the AI even supported that unit!)

Reading from the log error, this happens because of a call to the common-api and the function "buildableEntities()". This function handles the case where "this._template.Builder" is undefined, but on the support elephant, it's defined, and it expects "this._template.Builder.Entities._string" to be defined too, when it's in fact not.

A simple fix would be to replace this function by this:

buildableEntities: function() {
if (!this._template.Builder || !this._template.Builder.Entities._string)
return undefined;
var civ = this.civ();
var templates = this._template.Builder.Entities._string.replace(/\{civ\}/g, civ).split(/\s+/);
return templates; // TODO: map to Entity?
},

Another possibility would be to change the mauryan support elephant template to this, but I'm not sure that'd work:

<Builder>
<Rate>1.0</Rate>
<Entities datatype="tokens"></Entities>
</Builder>

I'm not sure how qbot would handle the Mauryans anyway, but that would be fixed.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...