summaryrefslogtreecommitdiff
path: root/src/signal.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-05-14 16:38:53 +0000
committersmatz <smatz@openttd.org>2008-05-14 16:38:53 +0000
commit08814d50ea9bbba1fbc1466f8203c052a1ad03ec (patch)
tree73fe802bb7f94ddb5fbfc6fc4c60f37761576126 /src/signal.cpp
parent6bfd695002a02ca1bcf0f4a083733c3f256b98a7 (diff)
downloadopenttd-08814d50ea9bbba1fbc1466f8203c052a1ad03ec.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.cpp11
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);