(svn r4868) - Codechange: in the train detail window, don't call DrawTrainImage() for each row, as we already loop to find the vehicles to
authorpeter1138
Sun, 14 May 2006 20:38:09 +0000
changeset 3844 85105d1abf48
parent 3843 03f39cd3dc56
child 3845 af6eb0103fed
(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.
train_gui.c
--- a/train_gui.c	Sun May 14 15:11:12 2006 +0000
+++ b/train_gui.c	Sun May 14 20:38:09 2006 +0000
@@ -1208,7 +1208,8 @@
 				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));