id summary reporter owner description type status priority milestone component resolution keywords cc phab_field 3994 [PATCH] Gamesetup GUI handling rewrite elexis elexis "'''Aim of the ticket:''' In order to reduce code complexity (making things independent from each other) and to get maintainable code, it is required to (1) '''unify duplicated''' functions in the gamesetup that initialize and update '''GUI objects''' and (2) '''separate''' the GUI methods (initializing GUI objects with userchoices, deciding when GUI obejcts are `hidden/enabled/checked/selected`) from the business logic (when and how settings can be changed). Due to most gameattributes having their own peculiarities, code had been copy & pasted vastly, was changed slightly and then copied and changed again. This feedback loop resulted in several layers (orders of magnitude) of doing it wrong. '''Why it is needed:''' Every addition to the gamesetup has to go through pain of reading hundreds of lines of unrelated code and in worst-case trial-n-error to come up with a patch. This is true regardless of the size of change. Recent examples include #3234 and ticket:2676#comment:4. #3049 and #3806 also directly require these changes. Some peculiarities: * The `initFoo` functions called from `initGUIObjects` are nearly identical, but some set defaults, others don't. * the selectable items of all dropdowns are fixed, except the `mapSelection` dropdown which is reinitialized after changing `mapType` or `mapFilter`. * the rating setting is shown only for lobbied games * cheats can only be set in multiplayer * teams locked is only enabled if the rating setting is unchecked * some options (ceasefire, population capacity) can only be set on some ""random"" and ""skirmish"" maps. Others can only be set on ""random"" maps only (number of players, mapsize). Others can be set on all maps (gamespeed). * sometimes settings which can't be configured on the current maptype are shown but read-only (mapsize shows ""Default"" for non-random maps) while others are completely hidden (cheats) * the victory condition also updates the scripts variable * some GUI controls are set only once (`initMultiplayerSettings`), while others are updated regularly * changing the mapfilter, maptype or mapselections means nuking prior settings, loading the mapchoice and setting defaults otherwise * Don't get me started on the persistmatchsettings... #3883 " task closed Must Have Alpha 22 UI & Simulation fixed patch Imarok