diff options
author | peter1138 <peter1138@openttd.org> | 2007-05-07 11:24:23 +0000 |
---|---|---|
committer | peter1138 <peter1138@openttd.org> | 2007-05-07 11:24:23 +0000 |
commit | 0de85b7eb0375f3b857c10fc172f3894a906d758 (patch) | |
tree | 45872079a8d4c2bb43978e42bafd845484977201 | |
parent | 76ee6d1c8295c55ad7af89e43cbf5012847aba0f (diff) | |
download | openttd-0de85b7eb0375f3b857c10fc172f3894a906d758.tar.xz |
(svn r9805) -Codechange: Use HASBIT() et al for display options bits.
-rw-r--r-- | src/main_gui.cpp | 24 | ||||
-rw-r--r-- | src/openttd.cpp | 2 | ||||
-rw-r--r-- | src/openttd.h | 12 | ||||
-rw-r--r-- | src/rail_cmd.cpp | 2 | ||||
-rw-r--r-- | src/road_cmd.cpp | 2 | ||||
-rw-r--r-- | src/viewport.cpp | 16 |
6 files changed, 29 insertions, 29 deletions
diff --git a/src/main_gui.cpp b/src/main_gui.cpp index bfc470b6a..d6be058fd 100644 --- a/src/main_gui.cpp +++ b/src/main_gui.cpp @@ -171,12 +171,12 @@ static void MenuClickSettings(int index) case 2: ShowPatchesSelection(); return; case 3: ShowNewGRFSettings(!_networking, true, true, &_grfconfig); return; - case 5: _display_opt ^= DO_SHOW_TOWN_NAMES; break; - case 6: _display_opt ^= DO_SHOW_STATION_NAMES; break; - case 7: _display_opt ^= DO_SHOW_SIGNS; break; - case 8: _display_opt ^= DO_WAYPOINTS; break; - case 9: _display_opt ^= DO_FULL_ANIMATION; break; - case 10: _display_opt ^= DO_FULL_DETAIL; break; + case 5: TOGGLEBIT(_display_opt, DO_SHOW_TOWN_NAMES); break; + case 6: TOGGLEBIT(_display_opt, DO_SHOW_STATION_NAMES); break; + case 7: TOGGLEBIT(_display_opt, DO_SHOW_SIGNS); break; + case 8: TOGGLEBIT(_display_opt, DO_WAYPOINTS); break; + case 9: TOGGLEBIT(_display_opt, DO_FULL_ANIMATION); break; + case 10: TOGGLEBIT(_display_opt, DO_FULL_DETAIL); break; case 11: ToggleTransparency(); break; case 12: TOGGLEBIT(_transparent_opt, TO_SIGNS); break; } @@ -974,12 +974,12 @@ static void ToolbarOptionsClick(Window *w) w = PopupMainToolbMenu(w, 2, STR_02C3_GAME_OPTIONS, 13, 0); - if (_display_opt & DO_SHOW_TOWN_NAMES) SETBIT(x, 5); - if (_display_opt & DO_SHOW_STATION_NAMES) SETBIT(x, 6); - if (_display_opt & DO_SHOW_SIGNS) SETBIT(x, 7); - 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(_display_opt, DO_SHOW_TOWN_NAMES)) SETBIT(x, 5); + if (HASBIT(_display_opt, DO_SHOW_STATION_NAMES)) SETBIT(x, 6); + if (HASBIT(_display_opt, DO_SHOW_SIGNS)) SETBIT(x, 7); + if (HASBIT(_display_opt, DO_WAYPOINTS)) SETBIT(x, 8); + if (HASBIT(_display_opt, DO_FULL_ANIMATION)) SETBIT(x, 9); + if (HASBIT(_display_opt, DO_FULL_DETAIL)) SETBIT(x, 10); 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; diff --git a/src/openttd.cpp b/src/openttd.cpp index 44a3f0d53..79bf7eced 100644 --- a/src/openttd.cpp +++ b/src/openttd.cpp @@ -1076,7 +1076,7 @@ void GameLoop() StateGameLoop(); #endif /* ENABLE_NETWORK */ - if (!_pause_game && _display_opt & DO_FULL_ANIMATION) DoPaletteAnimations(); + if (!_pause_game && HASBIT(_display_opt, DO_FULL_ANIMATION)) DoPaletteAnimations(); if (!_pause_game || _cheats.build_in_pause.value) MoveAllTextEffects(); diff --git a/src/openttd.h b/src/openttd.h index 34c0af9d0..f4511ea92 100644 --- a/src/openttd.h +++ b/src/openttd.h @@ -171,12 +171,12 @@ struct TileInfo { /* Display Options */ enum { - DO_SHOW_TOWN_NAMES = 1 << 0, - DO_SHOW_STATION_NAMES = 1 << 1, - DO_SHOW_SIGNS = 1 << 2, - DO_FULL_ANIMATION = 1 << 3, - DO_FULL_DETAIL = 1 << 5, - DO_WAYPOINTS = 1 << 6, + DO_SHOW_TOWN_NAMES = 0, + DO_SHOW_STATION_NAMES = 1, + DO_SHOW_SIGNS = 2, + DO_FULL_ANIMATION = 3, + DO_FULL_DETAIL = 5, + DO_WAYPOINTS = 6, }; enum { diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index 8a44b10fc..be0bbd93a 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -1322,7 +1322,7 @@ static void DrawTile_Track(TileInfo *ti) DrawTrackBits(ti, rails); - if (_display_opt & DO_FULL_DETAIL) DrawTrackDetails(ti); + if (HASBIT(_display_opt, DO_FULL_DETAIL)) DrawTrackDetails(ti); if (HasSignals(ti->tile)) DrawSignals(ti->tile, rails); } else { diff --git a/src/road_cmd.cpp b/src/road_cmd.cpp index 2577e9b9c..3217f045f 100644 --- a/src/road_cmd.cpp +++ b/src/road_cmd.cpp @@ -725,7 +725,7 @@ static void DrawRoadBits(TileInfo* ti) } /* Return if full detail is disabled, or we are zoomed fully out. */ - if (!(_display_opt & DO_FULL_DETAIL) || _cur_dpi->zoom == 2) return; + if (!HASBIT(_display_opt, DO_FULL_DETAIL) || _cur_dpi->zoom == 2) return; /* Draw extra details. */ for (drts = _road_display_table[roadside][road]; drts->image != 0; drts++) { diff --git a/src/viewport.cpp b/src/viewport.cpp index 52d189e7d..23f5a5a31 100644 --- a/src/viewport.cpp +++ b/src/viewport.cpp @@ -799,7 +799,7 @@ static void ViewportAddTownNames(DrawPixelInfo *dpi) Town *t; int left, top, right, bottom; - if (!(_display_opt & DO_SHOW_TOWN_NAMES) || _game_mode == GM_MENU) + if (!HASBIT(_display_opt, DO_SHOW_TOWN_NAMES) || _game_mode == GM_MENU) return; left = dpi->left; @@ -873,7 +873,7 @@ static void ViewportAddStationNames(DrawPixelInfo *dpi) int left, top, right, bottom; const Station *st; - if (!(_display_opt & DO_SHOW_STATION_NAMES) || _game_mode == GM_MENU) + if (!HASBIT(_display_opt, DO_SHOW_STATION_NAMES) || _game_mode == GM_MENU) return; left = dpi->left; @@ -940,7 +940,7 @@ static void ViewportAddSigns(DrawPixelInfo *dpi) const Sign *si; int left, top, right, bottom; - if (!(_display_opt & DO_SHOW_SIGNS)) + if (!HASBIT(_display_opt, DO_SHOW_SIGNS)) return; left = dpi->left; @@ -1007,7 +1007,7 @@ static void ViewportAddWaypoints(DrawPixelInfo *dpi) const Waypoint *wp; int left, top, right, bottom; - if (!(_display_opt & DO_WAYPOINTS)) + if (!HASBIT(_display_opt, DO_WAYPOINTS)) return; left = dpi->left; @@ -1487,7 +1487,7 @@ static bool CheckClickOnTown(const ViewPort *vp, int x, int y) { const Town *t; - if (!(_display_opt & DO_SHOW_TOWN_NAMES)) return false; + if (!HASBIT(_display_opt, DO_SHOW_TOWN_NAMES)) return false; switch (vp->zoom) { case 0: @@ -1541,7 +1541,7 @@ static bool CheckClickOnStation(const ViewPort *vp, int x, int y) { const Station *st; - if (!(_display_opt & DO_SHOW_STATION_NAMES)) return false; + if (!HASBIT(_display_opt, DO_SHOW_STATION_NAMES)) return false; switch (vp->zoom) { case 0: @@ -1595,7 +1595,7 @@ static bool CheckClickOnSign(const ViewPort *vp, int x, int y) { const Sign *si; - if (!(_display_opt & DO_SHOW_SIGNS) || _current_player == PLAYER_SPECTATOR) return false; + if (!HASBIT(_display_opt, DO_SHOW_SIGNS) || _current_player == PLAYER_SPECTATOR) return false; switch (vp->zoom) { case 0: @@ -1649,7 +1649,7 @@ static bool CheckClickOnWaypoint(const ViewPort *vp, int x, int y) { const Waypoint *wp; - if (!(_display_opt & DO_WAYPOINTS)) return false; + if (!HASBIT(_display_opt, DO_WAYPOINTS)) return false; switch (vp->zoom) { case 0: |