Silence uninitialised variable warnings in SSE blitters
[openttd/fttd.git] / src / signal_type.h
blobe1d51cd731f97de0eb745dd6752c9f17d1e79eed
1 /* $Id$ */
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 */
10 /** @file signal_type.h Types and classes related to signals. */
12 #ifndef SIGNAL_TYPE_H
13 #define SIGNAL_TYPE_H
15 #include "core/enum_type.hpp"
17 /** Variant of the signal, i.e. how does the signal look? */
18 enum SignalVariant {
19 SIG_ELECTRIC = 0, ///< Light signal
20 SIG_SEMAPHORE = 1, ///< Old-fashioned semaphore signal
24 /** Type of signal, i.e. how does the signal behave? */
25 enum SignalType {
26 SIGTYPE_NORMAL = 0, ///< normal signal
27 SIGTYPE_ENTRY = 1, ///< presignal block entry
28 SIGTYPE_EXIT = 2, ///< presignal block exit
29 SIGTYPE_COMBO = 3, ///< presignal inter-block
30 SIGTYPE_PBS = 4, ///< normal pbs signal
31 SIGTYPE_PBS_ONEWAY = 5, ///< no-entry signal
33 SIGTYPE_END,
34 SIGTYPE_LAST = SIGTYPE_PBS_ONEWAY,
35 SIGTYPE_LAST_NOPBS = SIGTYPE_COMBO,
37 /** Helper information for extract tool. */
38 template <> struct EnumPropsT<SignalType> : MakeEnumPropsT<SignalType, byte, SIGTYPE_NORMAL, SIGTYPE_END, SIGTYPE_END, 3> {};
41 /**
42 * These are states in which a signal can be. Currently these are only two, so
43 * simple boolean logic will do. But do try to compare to this enum instead of
44 * normal boolean evaluation, since that will make future additions easier.
46 enum SignalState {
47 SIGNAL_STATE_RED = 0, ///< The signal is red
48 SIGNAL_STATE_GREEN = 1, ///< The signal is green
52 static inline bool IsPbsSignal(SignalType s)
54 return s == SIGTYPE_PBS || s == SIGTYPE_PBS_ONEWAY;
57 static inline bool IsPresignalEntry(SignalType s)
59 return s == SIGTYPE_ENTRY || s == SIGTYPE_COMBO;
62 static inline bool IsPresignalExit(SignalType s)
64 return s == SIGTYPE_EXIT || s == SIGTYPE_COMBO;
67 /** One-way signals can't be passed the 'wrong' way. */
68 static inline bool IsOnewaySignal(SignalType s)
70 return s != SIGTYPE_PBS;
73 #endif /* SIGNAL_TYPE_H */