vehicle_gui.c
changeset 2676 59b65b4fb480
parent 2639 eeaefdabfdfd
child 2697 97fc22baf3da
--- a/vehicle_gui.c	Fri Nov 18 20:28:55 2005 +0000
+++ b/vehicle_gui.c	Fri Nov 18 23:41:03 2005 +0000
@@ -18,6 +18,7 @@
 #include "variables.h"
 #include "vehicle_gui.h"
 #include "viewport.h"
+#include "train.h"
 
 Sorting _sorting;
 
@@ -105,7 +106,7 @@
 
 void BuildVehicleList(vehiclelist_d* vl, int type, PlayerID owner, StationID station)
 {
-	uint subtype = (type != VEH_Aircraft) ? TS_Front_Engine : 2;
+	uint subtype = (type != VEH_Aircraft) ? Train_Front : 2;
 	uint n = 0;
 	uint i;
 
@@ -122,7 +123,9 @@
 	if (station != INVALID_STATION) {
 		const Vehicle *v;
 		FOR_ALL_VEHICLES(v) {
-			if (v->type == type && v->subtype <= subtype) {
+			if (v->type == type && (
+				(type == VEH_Train && IsFrontEngine(v)) ||
+				(type != VEH_Train && v->subtype <= subtype))) {
 				const Order *order;
 
 				FOR_VEHICLE_ORDERS(v, order) {
@@ -138,7 +141,9 @@
 	} else {
 		const Vehicle *v;
 		FOR_ALL_VEHICLES(v) {
-			if (v->type == type && v->subtype <= subtype && v->owner == owner) {
+			if (v->type == type && v->owner == owner && (
+				(type == VEH_Train && IsFrontEngine(v)) ||
+				(type != VEH_Train && v->subtype <= subtype))) {
 				_vehicle_sort[n].index = v->index;
 				_vehicle_sort[n].owner = v->owner;
 				++n;