diff options
author | smatz <smatz@openttd.org> | 2008-05-14 16:38:53 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2008-05-14 16:38:53 +0000 |
commit | 9b8d16b7ff71d2599f91835332a9903fc2ba4bba (patch) | |
tree | 73fe802bb7f94ddb5fbfc6fc4c60f37761576126 /src/signal.cpp | |
parent | 2475959196ba9ccb0c9910680f3c7ebb5aa1082c (diff) | |
download | openttd-9b8d16b7ff71d2599f91835332a9903fc2ba4bba.tar.xz |
(svn r13088) -Codechange: use SigSegState enum instead of bool variable (michi_cc)
Diffstat (limited to 'src/signal.cpp')
-rw-r--r-- | src/signal.cpp | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/signal.cpp b/src/signal.cpp index 03747eefe..e64480a4d 100644 --- a/src/signal.cpp +++ b/src/signal.cpp @@ -468,12 +468,12 @@ static inline void ResetSets() * @return false iff presignal entry would be green (needed for trains leaving depot) * @pre IsValidPlayer(owner) */ -static bool UpdateSignalsInBuffer(Owner owner) +static SigSegState UpdateSignalsInBuffer(Owner owner) { assert(IsValidPlayer(owner)); bool first = true; // first block? - bool state = false; // value to return + SigSegState state = SIGSEG_FREE; // value to return TileIndex tile; DiagDirection dir; @@ -532,7 +532,10 @@ static bool UpdateSignalsInBuffer(Owner owner) if (first) { first = false; - state = (flags & SF_TRAIN) || (flags & SF_EXIT && !(flags & SF_GREEN)) || (flags & SF_FULL); // true iff train CAN'T leave the depot + if ((flags & SF_TRAIN) || (flags & SF_EXIT && !(flags & SF_GREEN)) || (flags & SF_FULL)) { + /* SIGSEG_FREE is set by default */ + state = SIGSEG_FULL; + } } /* do not do anything when some buffer was full */ @@ -629,7 +632,7 @@ void AddSideToSignalBuffer(TileIndex tile, DiagDirection side, Owner owner) * @param owner owner whose signals we will update * @return false iff train can leave depot */ -bool UpdateSignalsOnSegment(TileIndex tile, DiagDirection side, Owner owner) +SigSegState UpdateSignalsOnSegment(TileIndex tile, DiagDirection side, Owner owner) { assert(_globset.IsEmpty()); _globset.Add(tile, side); |