summaryrefslogtreecommitdiff
path: root/src/train_gui.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/train_gui.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/train_gui.cpp')
-rw-r--r--src/train_gui.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/train_gui.cpp b/src/train_gui.cpp
index 8dc526c56..2ef9e786c 100644
--- a/src/train_gui.cpp
+++ b/src/train_gui.cpp
@@ -80,7 +80,7 @@ void DrawTrainImage(const Vehicle *v, int x, int y, VehicleID selection, int cou
_cur_dpi = &tmp_dpi;
do {
- int width = ((const Train *)v)->tcache.cached_veh_length;
+ int width = Train::From(v)->tcache.cached_veh_length;
if (dx + width > 0) {
if (dx <= count) {
@@ -236,7 +236,7 @@ void DrawTrainDetails(const Vehicle *v, int left, int right, int y, int vscroll_
do {
SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
DrawSprite(u->GetImage(DIR_W), pal, x + WagonLengthToPixels(4 + dx), y + 6 + (is_custom_sprite(RailVehInfo(u->engine_type)->image_index) ? _traininfo_vehicle_pitch : 0));
- dx += ((const Train *)u)->tcache.cached_veh_length;
+ dx += Train::From(u)->tcache.cached_veh_length;
u = u->Next();
} while (u != NULL && IsArticulatedPart(u) && u->cargo_cap == 0);