summaryrefslogtreecommitdiff
path: root/src/vehicle.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/vehicle.cpp')
-rw-r--r--src/vehicle.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 440f59bf8..312813c36 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -461,7 +461,6 @@ static Vehicle *EnsureNoTrainOnTrackProc(Vehicle *v, void *data)
Train *t = Train::From(v);
if ((t->track != rail_bits) && !TracksOverlap(t->track | rail_bits)) return NULL;
- _error_message = STR_ERROR_TRAIN_IN_THE_WAY + v->type;
return v;
}
@@ -475,7 +474,13 @@ static Vehicle *EnsureNoTrainOnTrackProc(Vehicle *v, void *data)
*/
bool EnsureNoTrainOnTrackBits(TileIndex tile, TrackBits track_bits)
{
- return !HasVehicleOnPos(tile, &track_bits, &EnsureNoTrainOnTrackProc);
+ /* Value v is not safe in MP games, however, it is used to generate a local
+ * error message only (which may be different for different machines).
+ * Such a message does not affect MP synchronisation.
+ */
+ Vehicle *v = VehicleFromPos(tile, &track_bits, &EnsureNoTrainOnTrackProc, true);
+ if (v != NULL) _error_message = STR_ERROR_TRAIN_IN_THE_WAY + v->type;
+ return v == NULL;
}
static void UpdateNewVehiclePosHash(Vehicle *v, bool remove)