Index: train_cmd.c
===================================================================
--- train_cmd.c	(revision 775)
+++ train_cmd.c	(working copy)
@@ -10,6 +10,13 @@
 #include "engine.h"
 #include "player.h"
 
+
+#define is_firsthead_sprite(spritenum) \
+	(is_custom_sprite(spritenum) \
+		? is_custom_firsthead_sprite(spritenum) \
+		: _engine_sprite_add[spritenum] == 0)
+
+
 static const byte _vehicle_initial_x_fract[4] = {10,8,4,8};
 static const byte _vehicle_initial_y_fract[4] = {8,4,8,10};
 static const byte _state_dir_table[4] = { 0x20, 8, 0x10, 4 };
@@ -588,8 +595,7 @@
 	if (src->type != VEH_Train) return CMD_ERROR;
 
 	is_loco = !(_rail_vehicle_info[src->engine_type].flags & RVI_WAGON)
-	            && (is_custom_firsthead_sprite(src->spritenum)
-	                || _engine_sprite_add[src->spritenum] == 0);
+	          && is_firsthead_sprite(src->spritenum);
 
 	// if nothing is selected as destination, try and find a matching vehicle to drag to.
 	if (((int32)p1 >> 16) == -1) {	
@@ -771,8 +777,7 @@
 		if (p2 != 1) {
 			// sell last part of multiheaded?
 			last = GetLastVehicleInChain(v);
-			if (is_custom_firsthead_sprite(last->spritenum)
-			    || _engine_sprite_add[last->spritenum] == 0)
+			if (is_firsthead_sprite(last->spritenum))
 				last = NULL;
 		} else {
 			last = NULL;
