diff options
author | peter1138 <peter1138@openttd.org> | 2007-04-19 17:54:45 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-04-19 17:54:45 +0000 |
commit | 0552b192250e5b2ef579613988638b4cbab761fc (patch) | |
tree | 1db6908f243133f62bf6276986674ec8b7155508 | |
parent | 95ae29b47065c5d16636ff56677067bc32e05c5c (diff) | |
download | openttd-0552b192250e5b2ef579613988638b4cbab761fc.tar.xz |
(svn r9677) -Codechange: Make the 'transparent buildings' menu item toggle all transparency, to keep its old behaviour.
-rw-r--r-- | src/main_gui.cpp | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp index 4cf2c5a42..bfc470b6a 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -147,6 +147,22 @@ static void ToolbarFastForwardClick(Window *w) } +/** Toggle all transparency options, except for signs */ +static void ToggleTransparency() +{ + static byte trans_opt = ~0; + + if (GB(_transparent_opt, 1, 7) == 0) { + SB(_transparent_opt, 1, 7, GB(trans_opt, 1, 7)); + } else { + trans_opt = _transparent_opt; + SB(_transparent_opt, 1, 7, 0); + } + + MarkWholeScreenDirty(); +} + + static void MenuClickSettings(int index) { switch (index) { @@ -161,8 +177,8 @@ static void MenuClickSettings(int index) case 8: _display_opt ^= DO_WAYPOINTS; break; case 9: _display_opt ^= DO_FULL_ANIMATION; break; case 10: _display_opt ^= DO_FULL_DETAIL; break; - case 11: TOGGLEBIT(_transparent_opt, TO_BUILDINGS); break; - case 12: TOGGLEBIT(_transparent_opt, TO_SIGNS); break; + case 11: ToggleTransparency(); break; + case 12: TOGGLEBIT(_transparent_opt, TO_SIGNS); break; } MarkWholeScreenDirty(); } @@ -964,8 +980,8 @@ static void ToolbarOptionsClick(Window *w) if (_display_opt & DO_WAYPOINTS) SETBIT(x, 8); if (_display_opt & DO_FULL_ANIMATION) SETBIT(x, 9); if (_display_opt & DO_FULL_DETAIL) SETBIT(x, 10); - if (HASBIT(_transparent_opt, TO_BUILDINGS)) SETBIT(x, 11); - if (HASBIT(_transparent_opt, TO_SIGNS)) SETBIT(x, 12); + if (GB(_transparent_opt, 1, 7) != 0) SETBIT(x, 11); + if (HASBIT(_transparent_opt, TO_SIGNS)) SETBIT(x, 12); WP(w,menu_d).checked_items = x; } @@ -2355,18 +2371,9 @@ static void MainWindowWndProc(Window *w, WindowEvent *e) ShowTransparencyToolbar(); break; - case 'X': { - /* Toggle all transparency options except for signs */ - static byte trans_opt = ~0; - if (GB(_transparent_opt, 1, 7) == 0) { - SB(_transparent_opt, 1, 7, GB(trans_opt, 1, 7)); - } else { - trans_opt = _transparent_opt; - SB(_transparent_opt, 1, 7, 0); - } - MarkWholeScreenDirty(); + case 'X': + ToggleTransparency(); break; - } #ifdef ENABLE_NETWORK case WKC_RETURN: case 'T': // smart chat; send to team if any, otherwise to all |