From 6eac50bc16dd37f4c5f564485a4df3bd04639043 Mon Sep 17 00:00:00 2001 From: alberth Date: Sun, 7 Mar 2010 16:10:40 +0000 Subject: (svn r19366) -Codechange: Move setting of _error_message from the callback check routine to the caller. --- src/vehicle.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src') 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) -- cgit v1.2.3-70-g09d2