(svn r10546) -Fix [FS#1026]: you can now have both Available Train as Available Ship window open
authortruelight
Fri, 13 Jul 2007 14:51:55 +0000
changeset 7742 f40cca82d948
parent 7741 090a32ec04c1
child 7743 01f6ee416857
(svn r10546) -Fix [FS#1026]: you can now have both Available Train as Available Ship window open
src/build_vehicle_gui.cpp
--- a/src/build_vehicle_gui.cpp	Fri Jul 13 13:03:20 2007 +0000
+++ b/src/build_vehicle_gui.cpp	Fri Jul 13 14:51:55 2007 +0000
@@ -1055,12 +1055,17 @@
 {
 	buildvehicle_d *bv;
 	Window *w;
+	/* We want to be able to open both Available Train as Available Ships,
+	 *  so if tile == 0 (Available XXX Window), use 'type' as unique number.
+	 *  As it always is a low value, it won't collide with any real tile
+	 *  number. */
+	uint num = (tile == 0) ? (int)type : tile;
 
 	assert(IsPlayerBuildableVehicleType(type));
 
-	DeleteWindowById(WC_BUILD_VEHICLE, tile);
+	DeleteWindowById(WC_BUILD_VEHICLE, num);
 
-	w = AllocateWindowDescFront(&_build_vehicle_desc, tile);
+	w = AllocateWindowDescFront(&_build_vehicle_desc, num);
 
 	if (w == NULL) return;