Make it possible to stop road vehicles from slowing down in curves so "diagonal"...
[openttd-joker.git] / src / overlay.h
blobf7d8e2d757c4f8cecab1440c2e3088c265a717fa
1 /* $Id$ */
3 /** @file overlay.h Functions related to overlays. */
5 #ifndef OVERLAY_H
6 #define OVERLAY_H
8 #include "stdafx.h"
9 #include "openttd.h"
10 #include "core/bitmath_func.hpp"
11 #include "gfx_func.h"
13 /**
14 * Transparency option bits: which position in _transparency_opt stands for which transparency.
15 * If you change the order, change the order of the ShowTransparencyToolbar() stuff in transparency_gui.cpp too.
16 * If you add or remove an option don't forget to change the transparency 'hot keys' in main_gui.cpp.
18 enum OverlayOption {
19 OO_COVERAGES = 0, ///< coverage
20 OO_END,
23 typedef uint OverlayOptionBits; ///< overlay option bits
24 extern OverlayOptionBits _overlay_opt;
25 extern OverlayOptionBits _overlay_lock;
27 /**
28 * Check if the overlay option bit is set
29 * and if we aren't in the game menu (there's no overlay)
31 * @param to the structure which overlay option is ask for
33 static inline bool IsOverlaySet(OverlayOption to)
35 return (HasBit(_overlay_opt, to) && _game_mode != GM_MENU);
38 /**
39 * Toggle the overlay option bit
41 * @param to the overlay option to be toggled
43 static inline void ToggleOverlay(OverlayOption to)
45 ToggleBit(_overlay_opt, to);
48 /**
49 * Toggle the overlay lock bit
51 * @param to the overlay option to be locked or unlocked
53 static inline void ToggleOverlayLock(OverlayOption to)
55 ToggleBit(_overlay_lock, to);
58 /** Set or clear all non-locked overlay options */
59 static inline void ResetRestoreAllOverlays()
61 /* if none of the non-locked options are set */
62 if ((_overlay_opt & ~_overlay_lock) == 0) {
63 /* set all non-locked options */
64 _overlay_opt |= GB(~_overlay_lock, 0, OO_END);
65 } else {
66 /* clear all non-locked options */
67 _overlay_opt &= _overlay_lock;
70 MarkWholeScreenDirty();
73 #endif /* OVERLAY_H */