diff options
author | belugas <belugas@openttd.org> | 2008-06-17 23:51:17 +0000 |
---|---|---|
committer | belugas <belugas@openttd.org> | 2008-06-17 23:51:17 +0000 |
commit | 5408e1a51bfc19064347c3ed4ef7ccc09fe73773 (patch) | |
tree | 471e9af65ce44912c6a9c80550102adf7e719701 /src | |
parent | 9da745b38110bc827ff6b5d5c9c3c9bf928c2335 (diff) | |
download | openttd-5408e1a51bfc19064347c3ed4ef7ccc09fe73773.tar.xz |
(svn r13559) -Codechange: Enumification of the Options menu items
Diffstat (limited to 'src')
-rw-r--r-- | src/toolbar_gui.cpp | 63 |
1 files changed, 40 insertions, 23 deletions
diff --git a/src/toolbar_gui.cpp b/src/toolbar_gui.cpp index 9813762e9..e5edd8344 100644 --- a/src/toolbar_gui.cpp +++ b/src/toolbar_gui.cpp @@ -177,38 +177,55 @@ static void ToolbarFastForwardClick(Window *w) /* --- Options button menu --- */ +enum OptionMenuEntries { + OME_GAMEOPTIONS = 0, + OME_DIFFICULTIES, + OME_PATCHES, + OME_NEWGRFSETTINGS, + OME_TRANSPARENCIES, + OME_SHOW_TOWNNAMES = 6, + OME_SHOW_STATIONNAMES, + OME_SHOW_SIGNS, + OME_SHOW_WAYPOINTNAMES, + OME_FULL_ANIMATION, + OME_FULL_DETAILS, + OME_TRANSPARENTBUILDINGS, + OME_SHOW_STATIONSIGNS, + OME_END, +}; + static void ToolbarOptionsClick(Window *w) { uint16 x = 0; - if (HasBit(_display_opt, DO_SHOW_TOWN_NAMES)) SetBit(x, 6); - if (HasBit(_display_opt, DO_SHOW_STATION_NAMES)) SetBit(x, 7); - if (HasBit(_display_opt, DO_SHOW_SIGNS)) SetBit(x, 8); - if (HasBit(_display_opt, DO_WAYPOINTS)) SetBit(x, 9); - if (HasBit(_display_opt, DO_FULL_ANIMATION)) SetBit(x, 10); - if (HasBit(_display_opt, DO_FULL_DETAIL)) SetBit(x, 11); - if (IsTransparencySet(TO_HOUSES)) SetBit(x, 12); - if (IsTransparencySet(TO_SIGNS)) SetBit(x, 13); + if (HasBit(_display_opt, DO_SHOW_TOWN_NAMES)) SetBit(x, OME_SHOW_TOWNNAMES); + if (HasBit(_display_opt, DO_SHOW_STATION_NAMES)) SetBit(x, OME_SHOW_STATIONNAMES); + if (HasBit(_display_opt, DO_SHOW_SIGNS)) SetBit(x, OME_SHOW_SIGNS); + if (HasBit(_display_opt, DO_WAYPOINTS)) SetBit(x, OME_SHOW_WAYPOINTNAMES); + if (HasBit(_display_opt, DO_FULL_ANIMATION)) SetBit(x, OME_FULL_ANIMATION); + if (HasBit(_display_opt, DO_FULL_DETAIL)) SetBit(x, OME_FULL_DETAILS); + if (IsTransparencySet(TO_HOUSES)) SetBit(x, OME_TRANSPARENTBUILDINGS); + if (IsTransparencySet(TO_SIGNS)) SetBit(x, OME_SHOW_STATIONSIGNS); - PopupMainToolbMenu(w, TBN_SETTINGS, STR_02C4_GAME_OPTIONS, 14, 0, 0, x); + PopupMainToolbMenu(w, TBN_SETTINGS, STR_02C4_GAME_OPTIONS, OME_END, 0, 0, x); } static void MenuClickSettings(int index) { switch (index) { - case 0: ShowGameOptions(); return; - case 1: ShowGameDifficulty(); return; - case 2: ShowPatchesSelection(); return; - case 3: ShowNewGRFSettings(!_networking, true, true, &_grfconfig); return; - case 4: ShowTransparencyToolbar(); break; - - case 6: ToggleBit(_display_opt, DO_SHOW_TOWN_NAMES); break; - case 7: ToggleBit(_display_opt, DO_SHOW_STATION_NAMES); break; - case 8: ToggleBit(_display_opt, DO_SHOW_SIGNS); break; - case 9: ToggleBit(_display_opt, DO_WAYPOINTS); break; - case 10: ToggleBit(_display_opt, DO_FULL_ANIMATION); break; - case 11: ToggleBit(_display_opt, DO_FULL_DETAIL); break; - case 12: ToggleTransparency(TO_HOUSES); break; - case 13: ToggleTransparency(TO_SIGNS); break; + case OME_GAMEOPTIONS: ShowGameOptions(); return; + case OME_DIFFICULTIES: ShowGameDifficulty(); return; + case OME_PATCHES: ShowPatchesSelection(); return; + case OME_NEWGRFSETTINGS: ShowNewGRFSettings(!_networking, true, true, &_grfconfig); return; + case OME_TRANSPARENCIES: ShowTransparencyToolbar(); break; + + case OME_SHOW_TOWNNAMES: ToggleBit(_display_opt, DO_SHOW_TOWN_NAMES); break; + case OME_SHOW_STATIONNAMES: ToggleBit(_display_opt, DO_SHOW_STATION_NAMES); break; + case OME_SHOW_SIGNS: ToggleBit(_display_opt, DO_SHOW_SIGNS); break; + case OME_SHOW_WAYPOINTNAMES: ToggleBit(_display_opt, DO_WAYPOINTS); break; + case OME_FULL_ANIMATION: ToggleBit(_display_opt, DO_FULL_ANIMATION); break; + case OME_FULL_DETAILS: ToggleBit(_display_opt, DO_FULL_DETAIL); break; + case OME_TRANSPARENTBUILDINGS: ToggleTransparency(TO_HOUSES); break; + case OME_SHOW_STATIONSIGNS: ToggleTransparency(TO_SIGNS); break; } MarkWholeScreenDirty(); } |