summaryrefslogtreecommitdiff
path: root/train_gui.c
diff options
context:
space:
mode:
authorpeter1138 <peter1138@openttd.org>2006-05-14 20:38:09 +0000
committerpeter1138 <peter1138@openttd.org>2006-05-14 20:38:09 +0000
commit77a3900d5d1bb8fe24cf584d3be6e7f6f423a252 (patch)
tree6e8ebebab5789f3ae81c6151f0483802e85ae05d /train_gui.c
parent3f28a8cd42dfaeaac1f0531fc3e6e8f7491237ed (diff)
downloadopenttd-77a3900d5d1bb8fe24cf584d3be6e7f6f423a252.tar.xz
(svn r4868) - Codechange: in the train detail window, don't call DrawTrainImage() for each row, as we already loop to find the vehicles to
draw. Fixes a potential issue of extraneous wagons being drawn, if they are very short.
Diffstat (limited to 'train_gui.c')
-rw-r--r--train_gui.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/train_gui.c b/train_gui.c
index bf03979c1..b8bb9f2bd 100644
--- a/train_gui.c
+++ b/train_gui.c
@@ -1208,7 +1208,8 @@ static void DrawTrainDetailsWindow(Window *w)
int dx = 0;
u = v;
do {
- DrawTrainImage(u, x + WagonLengthToPixels(dx), y, 1, 0, INVALID_VEHICLE);
+ PalSpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v);
+ DrawSprite(GetTrainImage(u, DIR_W) | pal, x + 14 + WagonLengthToPixels(dx), y + 6 + (is_custom_sprite(RailVehInfo(u->engine_type)->image_index) ? _traininfo_vehicle_pitch : 0));
dx += u->u.rail.cached_veh_length;
u = u->next;
} while (u != NULL && IsArticulatedPart(u));