Port of the programmable signals patch to recent trunk
Also add some additional changes from the SpringPP patch, and make some other minor changes/fixes.
This commit is contained in:

committed by
Jonathan G Rennison

parent
0b09a7ac61
commit
fc0efe599e
@@ -13,6 +13,8 @@
|
||||
#define SIGNAL_TYPE_H
|
||||
|
||||
#include "core/enum_type.hpp"
|
||||
#include "track_type.h"
|
||||
#include "tile_type.h"
|
||||
|
||||
/** Variant of the signal, i.e. how does the signal look? */
|
||||
enum SignalVariant {
|
||||
@@ -29,14 +31,28 @@ enum SignalType {
|
||||
SIGTYPE_COMBO = 3, ///< presignal inter-block
|
||||
SIGTYPE_PBS = 4, ///< normal pbs signal
|
||||
SIGTYPE_PBS_ONEWAY = 5, ///< no-entry signal
|
||||
SIGTYPE_PROG = 6, ///< programmable presignal
|
||||
|
||||
SIGTYPE_END,
|
||||
SIGTYPE_LAST = SIGTYPE_PBS_ONEWAY,
|
||||
SIGTYPE_LAST_NOPBS = SIGTYPE_COMBO,
|
||||
SIGTYPE_LAST = SIGTYPE_PROG,
|
||||
SIGTYPE_FIRST_PBS_SPRITE = SIGTYPE_PBS,
|
||||
};
|
||||
/** Helper information for extract tool. */
|
||||
template <> struct EnumPropsT<SignalType> : MakeEnumPropsT<SignalType, byte, SIGTYPE_NORMAL, SIGTYPE_END, SIGTYPE_END, 3> {};
|
||||
|
||||
/** Reference to a signal
|
||||
*
|
||||
* A reference to a signal by its tile and track
|
||||
*/
|
||||
struct SignalReference {
|
||||
inline SignalReference(TileIndex t, Track tr) : tile(t), track(tr) {}
|
||||
inline bool operator<(const SignalReference& o) const { return tile < o.tile || (tile == o.tile && track < o.track); }
|
||||
inline bool operator==(const SignalReference& o) const { return tile == o.tile && track == o.track; }
|
||||
inline bool operator!=(const SignalReference& o) const { return tile != o.tile || track != o.track; }
|
||||
|
||||
TileIndex tile;
|
||||
Track track;
|
||||
};
|
||||
|
||||
/**
|
||||
* These are states in which a signal can be. Currently these are only two, so
|
||||
@@ -46,6 +62,7 @@ template <> struct EnumPropsT<SignalType> : MakeEnumPropsT<SignalType, byte, SIG
|
||||
enum SignalState {
|
||||
SIGNAL_STATE_RED = 0, ///< The signal is red
|
||||
SIGNAL_STATE_GREEN = 1, ///< The signal is green
|
||||
SIGNAL_STATE_MAX = SIGNAL_STATE_GREEN,
|
||||
};
|
||||
|
||||
#endif /* SIGNAL_TYPE_H */
|
||||
|
Reference in New Issue
Block a user