diff options
author | rubidium <rubidium@openttd.org> | 2010-06-29 20:48:34 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-06-29 20:48:34 +0000 |
commit | b1400ab65e2e2a353b002c7dcee0488251d56e5d (patch) | |
tree | ae3859470289fa25003a1b489e2d450c1df19e00 | |
parent | 642b463dfd86723c4484ba45e7732ef4c4e7494a (diff) | |
download | openttd-b1400ab65e2e2a353b002c7dcee0488251d56e5d.tar.xz |
(svn r20034) -Fix [FS#3896] (r14869): road vehicles could get crashed twice in a tick
In RoadVehicleController at tick N a road vehicle gets a j of slightly less
than adv_speed. In tick N+1 RoadVehCheckTrainCrash is called, then the road
vehicle gets a j of slightly more than adv_speed. This causes a second call
of RoadVehCheckTrainCrash. If in tick N the road vehicle moved onto a level
crossing and a (maglev) entered that tile at the same tick, in tick N+1 the
road vehicle would be crashed twice.
-rw-r--r-- | src/roadveh_cmd.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 4c783519a..f0ce5d808 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -1569,13 +1569,13 @@ static bool RoadVehController(RoadVehicle *v) v->current_order_time++; if (v->reverse_ctr != 0) v->reverse_ctr--; + RoadVehCheckTrainCrash(v); + /* handle crashed */ if (v->vehstatus & VS_CRASHED) { return RoadVehIsCrashed(v); } - RoadVehCheckTrainCrash(v); - /* road vehicle has broken down? */ if (v->breakdown_ctr != 0) { if (v->breakdown_ctr <= 2) { |