summaryrefslogtreecommitdiff
path: root/src/roadveh_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2009-12-02 23:53:15 +0000
committerrubidium <rubidium@openttd.org>2009-12-02 23:53:15 +0000
commitaa40d8e3adf23556810c2e6f975a514fac66ac62 (patch)
tree9f4aeabe164869f700cadf5dcc30fa55ed0b6092 /src/roadveh_cmd.cpp
parentedc7de7936ef56250199ce924c8f496675a5b8e1 (diff)
downloadopenttd-aa40d8e3adf23556810c2e6f975a514fac66ac62.tar.xz
(svn r18388) -Codechange: move entering/leaving of road stops to functions of RoadStop
Diffstat (limited to 'src/roadveh_cmd.cpp')
-rw-r--r--src/roadveh_cmd.cpp20
1 files changed, 2 insertions, 18 deletions
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 92b10b5ff..ab9982b87 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -465,13 +465,7 @@ void RoadVehicle::UpdateDeltaXY(Direction direction)
static void ClearCrashedStation(RoadVehicle *v)
{
- RoadStop *rs = RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile));
-
- /* Mark the station entrance as not busy */
- rs->SetEntranceBusy(false);
-
- /* Free the parking bay */
- rs->FreeBay(HasBit(v->state, RVS_USING_SECOND_BAY));
+ RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile))->Leave(v);
}
static void DeleteLastRoadVeh(RoadVehicle *v)
@@ -1317,17 +1311,7 @@ again:
v->cur_speed = 0;
return false;
}
- if (IsRoadStop(v->tile)) {
- RoadStop *rs = RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile));
-
- /* Vehicle is leaving a road stop tile, mark bay as free
- * For drive-through stops, only do it if the vehicle stopped here */
- if (IsStandardRoadStopTile(v->tile) || HasBit(v->state, RVS_IS_STOPPING)) {
- rs->FreeBay(HasBit(v->state, RVS_USING_SECOND_BAY));
- ClrBit(v->state, RVS_IS_STOPPING);
- }
- if (IsStandardRoadStopTile(v->tile)) rs->SetEntranceBusy(false);
- }
+ if (IsRoadStop(v->tile)) RoadStop::GetByTile(v->tile, GetRoadStopType(v->tile))->Leave(v);
}
if (!HasBit(r, VETS_ENTERED_WORMHOLE)) {