summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2008-01-14 14:46:09 +0000
committersmatz <smatz@openttd.org>2008-01-14 14:46:09 +0000
commit7beb63a93bf48b38cbd1e6a258968acf50099a2c (patch)
tree32365e328fa1e2c1d183eba460c51c780896e755 /src
parent027112e1fe08eb3cbc240cacba21c1c3a3350731 (diff)
downloadopenttd-7beb63a93bf48b38cbd1e6a258968acf50099a2c.tar.xz
(svn r11847) -Fix: do not affect the speed a train is entering a depot by trackbits behind it
Diffstat (limited to 'src')
-rw-r--r--src/train_cmd.cpp16
1 files changed, 11 insertions, 5 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 8d21a029b..e64dea0e3 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -3243,10 +3243,17 @@ static void HandleBrokenTrain(Vehicle *v)
}
}
+/** Maximum speeds for train that is broken down or approaching line end */
static const byte _breakdown_speeds[16] = {
225, 210, 195, 180, 165, 150, 135, 120, 105, 90, 75, 60, 45, 30, 15, 15
};
+/**
+ * Checks for line end. Also, bars crossing at next tile if needed
+ *
+ * @param v vehicle we are checking
+ * @return true iff we do NOT have to reverse
+ */
static bool TrainCheckIfLineEnds(Vehicle *v)
{
int t = v->breakdown_ctr;
@@ -3269,11 +3276,10 @@ static bool TrainCheckIfLineEnds(Vehicle *v)
if (DiagDirToDir(dir) == v->direction) return true;
}
- // depot?
- /* XXX -- When enabled, this makes it possible to crash trains of others
- (by building a depot right against a station) */
-/* if (IsTileType(tile, MP_RAILWAY) && GetRailTileType(tile) == RAIL_TILE_DEPOT_WAYPOINT)
- return true;*/
+ if (IsTileType(tile, MP_RAILWAY) && GetRailTileType(tile) == RAIL_TILE_DEPOT) {
+ DiagDirection dir = ReverseDiagDir(GetRailDepotDirection(tile));
+ if (DiagDirToDir(dir) == v->direction) return true;
+ }
/* Determine the non-diagonal direction in which we will exit this tile */
DiagDirection dir = TrainExitDir(v->direction, v->u.rail.track);