diff options
author | smatz <smatz@openttd.org> | 2009-06-06 16:54:22 +0000 |
---|---|---|
committer | smatz <smatz@openttd.org> | 2009-06-06 16:54:22 +0000 |
commit | 0c10006907b7d149f91d277a0c28a79b40eaa4c0 (patch) | |
tree | dc8cb6a7a9315a10688af00187db94be8911acef /src/rail_cmd.cpp | |
parent | c90819ff6d8d49ac25aa9194bdf04e8dfd7149ea (diff) | |
download | openttd-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/rail_cmd.cpp')
-rw-r--r-- | src/rail_cmd.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/rail_cmd.cpp b/src/rail_cmd.cpp index a17dbb6c6..64be2e900 100644 --- a/src/rail_cmd.cpp +++ b/src/rail_cmd.cpp @@ -92,7 +92,7 @@ Vehicle *EnsureNoTrainOnTrackProc(Vehicle *v, void *data) if (v->type != VEH_TRAIN) return NULL; - Train *t = (Train *)v; + Train *t = Train::From(v); if ((t->track != rail_bits) && !TracksOverlap(t->track | rail_bits)) return NULL; _error_message = VehicleInTheWayErrMsg(v); @@ -1235,7 +1235,7 @@ Vehicle *UpdateTrainPowerProc(Vehicle *v, void *data) if (v->type == VEH_TRAIN && !IsArticulatedPart(v)) { const RailVehicleInfo *rvi = RailVehInfo(v->engine_type); - if (GetVehicleProperty(v, 0x0B, rvi->power) != 0) TrainPowerChanged((Train *)v->First()); + if (GetVehicleProperty(v, 0x0B, rvi->power) != 0) TrainPowerChanged(Train::From(v)->First()); } return NULL; @@ -2461,7 +2461,7 @@ static VehicleEnterTileStatus VehicleEnter_Track(Vehicle *u, TileIndex tile, int /* this routine applies only to trains in depot tiles */ if (u->type != VEH_TRAIN || !IsRailDepotTile(tile)) return VETSB_CONTINUE; - Train *v = (Train *)u; + Train *v = Train::From(u); /* depot direction */ dir = GetRailDepotDirection(tile); |