Opened 11 months ago

Last modified 5 days ago

#5322 new defect

Object orientation gamesetup rewrite

Reported by: elexis Owned by:
Priority: Must Have Milestone: Backlog
Component: UI – Game setup Keywords:
Cc: Krinkle Patch:

Description

#3994 / r19504 / Phab:D322 has unified all gamesetup dropdowns, checkboxes and some miscellaneous GUI objects.

There are still about 1900 lines of code that are in procedural style and use global variables where they could use local variables.

This will be the precondition for future work on the gamesetup, for intsance:

  • sliders in the gamesetup (for example ceasefire duration)
  • map specific gamesetup options #4838 (for example day/night variant on danubius or water-level-rise-time on extinct volcano)
  • anything

It will also make it more obvious to gamesetup developer that procedural code is not the right way to keep this massive GUI page grouped by logic.

Change History (9)

comment:1 Changed 11 months ago by elexis

In r21882:

Gamesetup cleanup.

Move civInfo press event handling from XML to the JS GUI object data from rP19504 / D322. Equally move civInfo tooltip from init (which should remain agnostic of content) following rP21339 / D846, refs #4970.

comment:2 Changed 6 months ago by Imarok

Component: UI & SimulationGame setup

Seems like that flew under my radar.

comment:3 Changed 2 months ago by Krinkle

Cc: Krinkle added

comment:4 Changed 4 weeks ago by elexis

In 22676:

PushGuiPage? support for passing a function instead of a function name.
Allows coding the GUI without global functions which break prototype-oriented coding, refs #5322, fixing the concern in rP14496.

Supports stacked message boxes and removes the according workaround.
Change structree / civinfo switch-dialog code from rP21339 to perform the callback for page that actually registered the callback.
Ensure the parent that the callbackhandler is always called if the page is closed.
Merge PopGuiPage? and PopGuiPageCB following that choice, incidentally leaving cleaner code.

Differential Revision: https://code.wildfiregames.com/D1684
Comments by: Yves, Vladislav, wraitii, leper

comment:5 Changed 2 weeks ago by elexis

In 22826:

Gamesetup OOP cleanup, refs #5322.

Move procedural updateGameDescription and getMapPreview to OOP g_MiscControls from rP19504/D322.
Delete unused variable childSize following rP20945.
Remove host check in launchGame from rP7653 needless since rP15006.

comment:6 Changed 2 weeks ago by elexis

In 22827:

Gamesetup OOP refactoring, refs #5322.

Move rightAlignCancelButton from rP18701 to g_MiscControls from D322 / rP19504.
Move civResetButton from rP18239 and teamResetButton from rP18459 to g_MiscControls, refs #3805.
The constant string and constant function value assignment can be reverted if performance is valued over code structuring.

comment:7 Changed 2 weeks ago by elexis

In 22828:

Gamesetup cleanup, refs #5322.

Inline toggleReady from rP15006 which became a oneline proxy to setReady in rP18299 used only in one place.
Inline senderFont and use setStringTags using rP20697 from Freagarachs patch in D2151.

comment:8 Changed 2 weeks ago by elexis

In 22831:

Gamesetup OOP cleanup, refs #5322.

Move updateAutocompleteEntries to g_MiscControls from rP19504/D322 to remove a global variable, a global procedure, reduce updateGUIObjects logic and increase logical grouping.
Rename autoCompleteNick to autoCompleteText since it's not only used for nicknames following rP19504.

comment:9 Changed 5 days ago by elexis

The XmppClient? and NetClient? GUI message handlers can be called from C++ rather than by pulling in onTick: #5585.

Note: See TracTickets for help on using tickets.