summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2011-01-15 09:53:21 +0000
committerrubidium <rubidium@openttd.org>2011-01-15 09:53:21 +0000
commit0c497dd113eb8f72cd87a6b48d7c0893542a10ac (patch)
tree328248e1f9c66ccb7062ffa9967be5e9e68ba645 /src/train_cmd.cpp
parent1b3e2309df848675adad2176db46c5136fb27c30 (diff)
downloadopenttd-0c497dd113eb8f72cd87a6b48d7c0893542a10ac.tar.xz
(svn r21800) -Fix [FS#3569]: under certain circumstances one could crash a competitor's train; take the lazy non-future proof version of the fix from the 1.0 branch as fixing the real bug is significantly more complex and might even break some backwards compatability if not done perfectly
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 46c804543..600deddca 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -2813,6 +2813,9 @@ static Vehicle *FindTrainCollideEnum(Vehicle *v, void *data)
/* not a train or in depot */
if (v->type != VEH_TRAIN || Train::From(v)->track == TRACK_BIT_DEPOT) return NULL;
+ /* do not crash into trains of another company. */
+ if (v->owner != tcc->v->owner) return NULL;
+
/* get first vehicle now to make most usual checks faster */
Train *coll = Train::From(v)->First();