summaryrefslogtreecommitdiff
path: root/src/station_cmd.cpp
diff options
context:
space:
mode:
authorsmatz <smatz@openttd.org>2009-06-06 16:54:22 +0000
committersmatz <smatz@openttd.org>2009-06-06 16:54:22 +0000
commit0c10006907b7d149f91d277a0c28a79b40eaa4c0 (patch)
treedc8cb6a7a9315a10688af00187db94be8911acef /src/station_cmd.cpp
parentc90819ff6d8d49ac25aa9194bdf04e8dfd7149ea (diff)
downloadopenttd-0c10006907b7d149f91d277a0c28a79b40eaa4c0.tar.xz
(svn r16527) -Codechange: use static member functions instead of simple casts when converting Vehicle to specialised vehicle types. Includes safety check
Diffstat (limited to 'src/station_cmd.cpp')
-rw-r--r--src/station_cmd.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index a4f9df11a..0c4ee2de4 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -1488,7 +1488,7 @@ CommandCost CmdBuildRoadStop(TileIndex tile, DoCommandFlag flags, uint32 p1, uin
static Vehicle *ClearRoadStopStatusEnum(Vehicle *v, void *)
{
- if (v->type == VEH_ROAD) ((RoadVehicle *)v)->state &= RVSB_ROAD_STOP_TRACKDIR_MASK;
+ if (v->type == VEH_ROAD) RoadVehicle::From(v)->state &= RVSB_ROAD_STOP_TRACKDIR_MASK;
return NULL;
}
@@ -2617,7 +2617,7 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i
int station_ahead;
int station_length;
- int stop = GetTrainStopLocation(station_id, tile, (Train *)v, &station_ahead, &station_length);
+ int stop = GetTrainStopLocation(station_id, tile, Train::From(v), &station_ahead, &station_length);
/* Stop whenever that amount of station ahead + the distance from the
* begin of the platform to the stop location is longer than the length
@@ -2645,7 +2645,7 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i
}
}
} else if (v->type == VEH_ROAD) {
- RoadVehicle *rv = (RoadVehicle *)v;
+ RoadVehicle *rv = RoadVehicle::From(v);
if (rv->state < RVSB_IN_ROAD_STOP && !IsReversingRoadTrackdir((Trackdir)rv->state) && rv->frame == 0) {
if (IsRoadStop(tile) && IsRoadVehFront(v)) {
/* Attempt to allocate a parking bay in a road stop */