Opened 10 years ago

Closed 10 years ago

#2372 closed task (fixed)

Fix Javascript warnings showing up with the new SpiderMonkey

Reported by: Yves Owned by:
Priority: Should Have Milestone: Alpha 17
Component: UI & Simulation Keywords:
Cc: Patch:

Description (last modified by Adrián Chaves)

The new SpiderMonkey (#1886) prints more warnings and errors about potentially buggy code. The idea is to have a close look at all these warnings and fix them in a sensible way instead of just trying to get rid of them somehow. If you know any of the affected files especially well or if you're otherwise interested to help, feel free! :) I'll focus on other TODOs for the upgrade first, but if a contributor without commit access proposes a fix, I'll review it quickly (you don't have to fix all warnings at once).

WARNING: JavaScript warning: simulation/helpers/InitGame.js line 31 reference to undefined property settings.mapType
WARNING: JavaScript warning: simulation/components/TechnologyManager.js line 123 reference to undefined property template.requirements
WARNING: JavaScript warning: simulation/components/ProductionQueue.js line 111 reference to undefined property template.Promotion
WARNING: JavaScript warning: simulation/components/Player.js line 479 reference to undefined property this.diplomacy[id]
WARNING: JavaScript warning: simulation/components/Player.js line 386 reference to undefined property this.diplomacy[idx]
WARNING: JavaScript warning: simulation/components/GuiInterface.js line 931 reference to undefined property this.entsRallyPointsDisplayed
WARNING: JavaScript warning: simulation/components/GuiInterface.js line 928 reference to undefined property this.entsRallyPointsDisplayed
WARNING: JavaScript warning: simulation/components/GuiInterface.js line 664 reference to undefined property template.icon
WARNING: JavaScript warning: simulation/components/GuiInterface.js line 1757 reference to undefined property waterPoints[start]
WARNING: JavaScript warning: simulation/components/Attack.js line 490 reference to undefined property missileDirection.y
WARNING: JavaScript warning: simulation/ai/common-api/map-module.js line 78 reference to undefined property this.map[(x + (y * this.width))]
WARNING: JavaScript warning: simulation/ai/common-api/map-module.js line 40 reference to undefined property this.map[(q[0] + (this.width * q[1]))]
WARNING: JavaScript warning: simulation/ai/common-api/terrain-analysis-pathfinder.js line 207 reference to undefined property this.widthMap[index]
WARNING: JavaScript warning: simulation/ai/aegis/worker.js line 148 reference to undefined property this.ent.unitAIState(...).split(...)[2]
WARNING: JavaScript warning: simulation/ai/aegis/defence.js line 146 reference to undefined property this.armyMergeSize
WARNING: JavaScript warning: simulation/ai/aegis/base-manager.js line 118 reference to undefined property HQ.basesMap.map[((x + xi) + ((y + yi) * width))]
WARNING: JavaScript warning: simulation/ai/petra/baseManager.js line 248 reference to undefined property supply.dropsite

Change History (23)

comment:1 by wraitii, 10 years ago

Description: modified (diff)

comment:2 by wraitii, 10 years ago

In 14578:

Should fix AI warnings (refs #2372).
Slight configuration changes to improve the early-game slightly, WIP.

comment:3 by Yves, 10 years ago

Description: modified (diff)

These warnings didn't appear anymore in another game after r14578:

WARNING: JavaScript warning: simulation/ai/aegis/aegis.js line 48 reference to undefined property sharedScript.events
WARNING: JavaScript warning: simulation/ai/aegis/base-manager.js line 904 reference to undefined property this.targetNumBuilders
WARNING: JavaScript warning: simulation/ai/aegis/base-manager.js line 587 reference to undefined property gameState.playedTurn
WARNING: JavaScript warning: simulation/ai/aegis/headquarters.js line 450 reference to undefined property this.wantedRates
WARNING: JavaScript warning: simulation/ai/common-api/terrain-analysis-pathfinder.js line 208 reference to undefined property this.index

I've tested a longer game and there still some warnings in the AI. I've updated the list in the ticket description (removed solved warnings and added new ones).

comment:4 by leper, 10 years ago

In 14579:

Fix a bug in TestAllMemberFunction and initialize a variable in cmpBattleDetection. Refs #2372.

comment:5 by leper, 10 years ago

Description: modified (diff)

comment:6 by wraitii, 10 years ago

In 14582:

Various improvements to AI's early game. Simplify some code and improve on other. Add a few different strategies (Rush/normal/boom, quite basic for now, refs #2344).
Aegis should mostly respect tech limitations so I'll ref #1964.
I'm going to go with #2364 is fixed, the AI should be more efficient in early-game, and late-game is a known problem.
Fixes #2274 and fixes #2379.
Refs #2372 as it should fix several of those warnings for AIs.
Fixes #2256 with a new bartering system, in parts taken from mimo's patch.

comment:7 by Yves, 10 years ago

In 14802:

Fixes warnings printed by the new SpiderMonkey.
Sets SelectableInGameSetup to true in all civ json files that didn't have it set.
Having this value set to undefined (not set) was interpreted as true, which is quite arbitrary.
With the new SpiderMonkey a warning will be printed if the value is undefined.
This avoids ambiguity but makes the setting mandatory.

Refs #2372

comment:8 by Yves, 10 years ago

Description: modified (diff)

comment:9 by Yves, 10 years ago

In 14862:

Silences some warnings that show up on the gamesetup screen with the new SpiderMonkey without changing any behaviour.

Refs #2372

comment:10 by Yves, 10 years ago

Description: modified (diff)

comment:11 by Yves, 10 years ago

In 14863:

Fixes warning showing up with the new SpiderMonkey.
The changed return value isn't related but returning false makes more sense there IMO.

Refs #2372

comment:12 by Yves, 10 years ago

Description: modified (diff)

comment:13 by scythetwirler, 10 years ago

In 14923:

Fixes SpiderMonkey warnings in the lobby.

Refs #2372

Last edited 10 years ago by scythetwirler (previous) (diff)

comment:14 by leper, 10 years ago

In 14933:

Fix some JS warnings. Refs #2372.

comment:15 by leper, 10 years ago

Description: modified (diff)

comment:16 by scythetwirler, 10 years ago

Description: modified (diff)

comment:17 by Stan, 10 years ago

there is a warning with cmd.metadata being undefined line 223 in command.js when shift + recruiting units. I tried setting cmd.metadata to 0; but i guess i did it in the wrong file.

comment:18 by Adrián Chaves, 10 years ago

Description: modified (diff)

comment:19 by gallaecio, 10 years ago

In 15030:

Fixed warnings in ‘gui’ due to the new SpiderMonkey

Refs #2372

comment:20 by Adrián Chaves, 10 years ago

Description: modified (diff)

comment:21 by scythetwirler, 10 years ago

Milestone: Alpha 16Alpha 17

Pushed (r15127).

comment:22 by leper, 10 years ago

Some of the warnings in the description have probably been fixed, while others could be missing. It would be nice to get an updated listing of warnings.

comment:23 by leper, 10 years ago

Keywords: simple removed
Resolution: fixed
Status: newclosed

Closing this as most of those are fixed and if there are some remaining we can open new tickets for them.

Note: See TracTickets for help on using tickets.