OpenTTD
transparency.h
Go to the documentation of this file.
1 /* $Id: transparency.h 22506 2011-05-28 09:46:37Z frosch $ */
2 
3 /*
4  * This file is part of OpenTTD.
5  * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
6  * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
7  * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>.
8  */
9 
12 #ifndef TRANSPARENCY_H
13 #define TRANSPARENCY_H
14 
15 #include "gfx_func.h"
16 #include "openttd.h"
17 #include "core/bitmath_func.hpp"
18 
25  TO_SIGNS = 0,
34  TO_END,
36 };
37 
38 typedef uint TransparencyOptionBits;
42 extern byte _display_opt;
43 
50 static inline bool IsTransparencySet(TransparencyOption to)
51 {
52  return (HasBit(_transparency_opt, to) && _game_mode != GM_MENU);
53 }
54 
61 static inline bool IsInvisibilitySet(TransparencyOption to)
62 {
63  return (HasBit(_transparency_opt & _invisibility_opt, to) && _game_mode != GM_MENU);
64 }
65 
71 static inline void ToggleTransparency(TransparencyOption to)
72 {
74 }
75 
81 static inline void ToggleInvisibility(TransparencyOption to)
82 {
84 }
85 
94 {
95  if (IsInvisibilitySet(to)) {
98  } else {
101  }
102 }
103 
110 {
112 }
113 
115 static inline void ResetRestoreAllTransparency()
116 {
117  /* if none of the non-locked options are set */
118  if ((_transparency_opt & ~_transparency_lock) == 0) {
119  /* set all non-locked options */
120  _transparency_opt |= GB(~_transparency_lock, 0, TO_END);
121  } else {
122  /* clear all non-locked options */
124  }
125 
127 }
128 
129 #endif /* TRANSPARENCY_H */