summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2010-11-20 09:09:57 +0000
committerrubidium <rubidium@openttd.org>2010-11-20 09:09:57 +0000
commit097880c5e221fc3d6f59383e30753ac728c9439f (patch)
treef6b551c4503df8c3407b1c4a0c6e3055d47b204e /src/roadveh_cmd.cpp
parentf80af8f8c8c2cbb3ce97d801f45959b855d2abdc (diff)
downloadopenttd-097880c5e221fc3d6f59383e30753ac728c9439f.tar.xz
(svn r21263) -Fix [FS#3935]: under some circumstances two vehicles could leave a non-drive through road stop at once
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp14
1 files changed, 4 insertions, 10 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index c1ad847dc..3889e2fa9 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -933,13 +933,6 @@ struct RoadDriveEntry {
#include "table/roadveh_movement.h"
-static const byte _road_veh_data_1[] = {
- 20, 20, 16, 16, 0, 0, 0, 0,
- 19, 19, 15, 15, 0, 0, 0, 0,
- 16, 16, 12, 12, 0, 0, 0, 0,
- 15, 15, 11, 11
-};
-
static bool RoadVehLeaveDepot(RoadVehicle *v, bool first)
{
/* Don't leave if not all the wagons are in the depot. */
@@ -1382,7 +1375,7 @@ again:
* (the station test and stop type test ensure that other vehicles, using the road stop as
* a through route, do not stop) */
if (v->IsRoadVehFront() && ((IsInsideMM(v->state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END) &&
- _road_veh_data_1[v->state - RVSB_IN_ROAD_STOP + (_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)] == v->frame) ||
+ _road_stop_stop_frame[v->state - RVSB_IN_ROAD_STOP + (_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)] == v->frame) ||
(IsInsideMM(v->state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile)) &&
v->owner == GetTileOwner(v->tile) &&
@@ -1395,7 +1388,7 @@ again:
/* Vehicle is at the stop position (at a bay) in a road stop.
* Note, if vehicle is loading/unloading it has already been handled,
* so if we get here the vehicle has just arrived or is just ready to leave. */
- if (!v->current_order.IsType(OT_LEAVESTATION)) {
+ if (!HasBit(v->state, RVS_ENTERED_STOP)) {
/* Vehicle has arrived at a bay in a road stop */
if (IsDriveThroughStopTile(v->tile)) {
@@ -1412,6 +1405,7 @@ again:
}
rs->SetEntranceBusy(false);
+ SetBit(v->state, RVS_ENTERED_STOP);
v->last_station_visited = st->index;
@@ -1427,7 +1421,7 @@ again:
v->cur_speed = 0;
return false;
}
- v->current_order.Free();
+ if (v->current_order.IsType(OT_LEAVESTATION)) v->current_order.Free();
}
if (IsStandardRoadStopTile(v->tile)) rs->SetEntranceBusy(true);