Opened 7 years ago

Closed 7 years ago

Last modified 6 years ago

#4772 closed defect (fixed)

Move ScriptFunctions to separate JS Interface files

Reported by: elexis Owned by: elexis
Priority: Should Have Milestone: Alpha 23
Component: Core engine Keywords:
Cc: Patch:

Description

ScriptFunctions.cpp defines C++ functions that can be called from the JS GUI. The file is crowded and functions are not always logically grouped which is the contrary of good practice.

In May 2013, Yves and stwf started planning the SpiderMonkey Upgrade from 1.8.5 to v24 (#1886) in https://wildfiregames.com/forum/index.php?/topic/17289-discussion-spidermonkey-upgrade/ and designed the JS Interfaces to be split the way we see them currently committed. leper recommended on irc on 2015-07-27 to split the VisualReplay code to a separate JS Interface too.

Revision history of our current JSInterface functions:

Date commit author JS Interface
2004-07-08 r666 Philip GUITypes, IGUIObject
2004-08-03 r887 markt Camera, Console
2005-05-02 r2212 janwas VFS
2013-06-06 r13455 stwf Sound
2013-09-12 r13826 Yves Gameview
2013-09-21 r13877 Yves Renderer
2013-11-16 r14199 Yves Lobby
2013-09-29 r13914 Yves ConfigDB
2014-04-20 r14953 gallaecio Internationalization
2014-08-25 r15677 leper Mod
2015-09-21 r17055 elexis Visual Replay

The project to compartmentalize ScriptFunctions.cpp should be finished, so that the ScriptFunctions are more transparent and easier to extend.

Change History (14)

comment:1 by elexis, 7 years ago

In r20133:
Move VFS GUI script function registration to its interface file.

comment:2 by elexis, 7 years ago

In 20163:

Remove unused clumsy JS GUI ScriptFunctions debug timer from rP4095.
GetMicroseconds from rP19603 provides microsecond precise timing.

Refs #4772.

comment:3 by elexis, 7 years ago

In r20164:

Move ReadJSONFile and WriteJSONFile GUI ScriptFunctions that only handle VFS paths to the VFS JS Interface.

comment:4 by elexis, 7 years ago

In 20165:

Move GameView ScriptFunctions to its JS Interface, refs #4772.
Use early returns as initialization checks.

comment:5 by elexis, 7 years ago

In 20166:

Move SavedGame ScriptFunctions to a new JS Interface, refs #4772.

comment:6 by elexis, 7 years ago

In 20167:

Move networking ScriptFunctions to a new JS Interface, refs #4772.

comment:7 by elexis, 7 years ago

In 20168:

Move GUI Manager ScriptFunctions to a new JS Interface, refs #4772.

comment:8 by elexis, 7 years ago

In 20169:

Move Game ScriptFunctions to a new JS Interface, refs #4772.

comment:9 by elexis, 7 years ago

In 20170:

Move Simulation GUI ScriptFunctions to a new JS Interface, refs #4772.

comment:10 by elexis, 7 years ago

In 20171:

Move Debugging ScriptFunctions to a new JS Interface, refs #4772.

comment:11 by elexis, 7 years ago

In 20172:

Move Main ScriptFunctions to a new JS Interface, refs #4772.

comment:12 by elexis, 7 years ago

Resolution: fixed
Status: assignedclosed

comment:13 by elexis, 6 years ago

In 21789:

Add missing ScriptInterface includes to
JSInterface_L10n.cpp from rP14953,
JSInterface_Renderer.cpp and JSInterface_GUITypes.cpp from rP14496,
JSInterface_VisualReplay.cpp from rP17055,
JSInterface_Game.cpp from rP20169,
JSInterface_Simulation.cpp from rP20170,
JSInterface_Debug.cpp from rP20171,
JSInterface_Main.cpp from rPr20172, refs #4772,
JSInterface_Mod.cpp where it was incorrectly removed in rP20591.

Refs D1470.
Sort includes alphabetically, add recent Coding Convention macro comments.

comment:14 by elexis, 6 years ago

In 21866:

Move UserReporter C++/JS functions from JSInterface_Debug.cpp to JSInterface_UserReport.cpp, refs #4772.
This way it stands out more as a separate feature that can be more easily exchanged, extended, maintained or conditionally removed from the build and leaves more transparent includes, refs #5257.

Add missing string includes following rP7259 and rP20171.
Remove unused Profile include following rP1841 and rP20171.
Remove unused CLogger include, add missing debug include following rP20171.
Remove unused CConsole include following rP20572 / D1073.
Remove unused ProfilerViewer include following rP21858.

Note: See TracTickets for help on using tickets.