diff options
author | alberth <alberth@openttd.org> | 2010-03-07 16:10:40 +0000 |
---|---|---|
committer | alberth <alberth@openttd.org> | 2010-03-07 16:10:40 +0000 |
commit | 6eac50bc16dd37f4c5f564485a4df3bd04639043 (patch) | |
tree | a3968977c2d779ae9d996f10451b5abda7cba673 | |
parent | 29b79e03e80f0e57f9af5ec4eeedc6de205f201b (diff) | |
download | openttd-6eac50bc16dd37f4c5f564485a4df3bd04639043.tar.xz |
(svn r19366) -Codechange: Move setting of _error_message from the callback check routine to the caller.
-rw-r--r-- | src/vehicle.cpp | 9 |
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) |