(svn r9363) [NoAI] -Sync with trunk r9322:9362 noai
authortruelight
Tue, 20 Mar 2007 00:37:19 +0000
branchnoai
changeset 9493 b38bfff5f3a3
parent 9492 1aeee24046d8
child 9494 c8fad175831c
(svn r9363) [NoAI] -Sync with trunk r9322:9362
configure
src/aircraft_cmd.cpp
src/cargotype.h
src/order_cmd.cpp
src/settings.cpp
--- a/configure	Tue Mar 20 00:21:24 2007 +0000
+++ b/configure	Tue Mar 20 00:37:19 2007 +0000
@@ -3,7 +3,11 @@
 CONFIGURE_EXECUTABLE="$_"
 # On *nix systems those two are equal when ./configure is done
 if [ "$0" != "$CONFIGURE_EXECUTABLE" ]; then
-	CONFIGURE_EXECUTABLE="$CONFIGURE_EXECUTABLE $0"
+	if [ -z "`echo $CONFIGURE_EXECUTABLE | grep make`" ]; then
+		CONFIGURE_EXECUTABLE="$0"
+	else
+		CONFIGURE_EXECUTABLE="$CONFIGURE_EXECUTABLE $0"
+	fi
 fi
 # Find out where configure is (in what dir)
 ROOT_DIR="`dirname $0`"
--- a/src/aircraft_cmd.cpp	Tue Mar 20 00:21:24 2007 +0000
+++ b/src/aircraft_cmd.cpp	Tue Mar 20 00:37:19 2007 +0000
@@ -30,6 +30,7 @@
 #include "newgrf_sound.h"
 #include "date.h"
 #include "spritecache.h"
+#include "cargotype.h"
 
 /** this maps the terminal to its corresponding state and block flag
  *  currently set for 10 terms, 4 helipads */
@@ -647,7 +648,7 @@
 		v->cargo_cap = pass;
 
 		Vehicle *u = v->next;
-		uint mail = new_cid != CT_PASSENGERS ? 0 : avi->mail_capacity;
+		uint mail = IsCargoInClass(new_cid, CC_PASSENGERS) ? avi->mail_capacity : 0;
 		u->cargo_cap = mail;
 		if (v->cargo_type == new_cid) {
 			v->cargo_count = min(pass, v->cargo_count);
--- a/src/cargotype.h	Tue Mar 20 00:21:24 2007 +0000
+++ b/src/cargotype.h	Tue Mar 20 00:37:19 2007 +0000
@@ -59,7 +59,7 @@
 
 static inline bool IsCargoInClass(CargoID c, uint16 cc)
 {
-	return GetCargo(c)->classes & cc;
+	return (GetCargo(c)->classes & cc) != 0;
 }
 
 
--- a/src/order_cmd.cpp	Tue Mar 20 00:21:24 2007 +0000
+++ b/src/order_cmd.cpp	Tue Mar 20 00:37:19 2007 +0000
@@ -455,6 +455,24 @@
 	return 0;
 }
 
+/**
+ * Remove the VehicleList that shows all the vehicles with the same shared
+ *  orders.
+ */
+static void RemoveSharedOrderVehicleList(Vehicle *v)
+{
+	WindowClass window_class = WC_NONE;
+
+	switch (v->type) {
+		default: NOT_REACHED();
+		case VEH_TRAIN:    window_class = WC_TRAINS_LIST;   break;
+		case VEH_ROAD:     window_class = WC_ROADVEH_LIST;  break;
+		case VEH_SHIP:     window_class = WC_SHIPS_LIST;    break;
+		case VEH_AIRCRAFT: window_class = WC_AIRCRAFT_LIST; break;
+	}
+	DeleteWindowById(window_class, (v->orders->index << 16) | (v->type << 11) | VLW_SHARED_ORDERS | v->owner);
+}
+
 /** Delete an order from the orderlist of a vehicle.
  * @param tile unused
  * @param p1 the ID of the vehicle
@@ -489,6 +507,10 @@
 				order = GetVehicleOrder(v, sel_ord + 1);
 				SwapOrders(v->orders, order);
 			} else {
+				/* XXX -- The system currently can't handle a shared-order vehicle list
+				 *  open when there aren't any orders in the list, so close the window
+				 *  in this case. Of course it needs a better fix later */
+				RemoveSharedOrderVehicleList(v);
 				/* Last item, so clean the list */
 				v->orders = NULL;
 			}
@@ -1116,7 +1138,7 @@
 	/* If we have a shared order-list, don't delete the list, but just
 	    remove our pointer */
 	if (IsOrderListShared(v)) {
-		const Vehicle *u = v;
+		Vehicle *u = v;
 
 		v->orders = NULL;
 		v->num_orders = 0;
@@ -1133,6 +1155,10 @@
 		v->prev_shared = NULL;
 		v->next_shared = NULL;
 
+		/* If we are the only one left in the Shared Order Vehicle List,
+		 *  remove it, as we are no longer a Shared Order Vehicle */
+		if (u->prev_shared == NULL && u->next_shared == NULL) RemoveSharedOrderVehicleList(u);
+
 		/* We only need to update this-one, because if there is a third
 		 *  vehicle which shares the same order-list, nothing will change. If
 		 *  this is the last vehicle, the last line of the order-window
@@ -1144,22 +1170,12 @@
 
 	/* Remove the orders */
 	Order *cur = v->orders;
+	/* Delete the vehicle list of shared orders, if any */
+	if (cur != NULL) RemoveSharedOrderVehicleList(v);
 	v->orders = NULL;
 	v->num_orders = 0;
 
 	if (cur != NULL) {
-		/* Delete the vehicle list of shared orders, if any */
-		WindowClass window_class = WC_NONE;
-
-		switch (v->type) {
-			default: NOT_REACHED();
-			case VEH_TRAIN:    window_class = WC_TRAINS_LIST;   break;
-			case VEH_ROAD:     window_class = WC_ROADVEH_LIST;  break;
-			case VEH_SHIP:     window_class = WC_SHIPS_LIST;    break;
-			case VEH_AIRCRAFT: window_class = WC_AIRCRAFT_LIST; break;
-		}
-		DeleteWindowById(window_class, (cur->index << 16) | (v->type << 11) | VLW_SHARED_ORDERS | v->owner);
-
 		cur->FreeChain(); // Free the orders.
 	}
 }
--- a/src/settings.cpp	Tue Mar 20 00:21:24 2007 +0000
+++ b/src/settings.cpp	Tue Mar 20 00:37:19 2007 +0000
@@ -1349,7 +1349,7 @@
 	 SDT_VAR(Patches, starting_year,    SLE_INT32, 0,NC,  1950, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_STARTING_YEAR,NULL),
 	 SDT_VAR(Patches, ending_year,      SLE_INT32,0,NC|NO,2051, MIN_YEAR, MAX_YEAR, 1, STR_CONFIG_PATCHES_ENDING_YEAR,  NULL),
 	SDT_BOOL(Patches, smooth_economy,             0, 0,  true,            STR_CONFIG_PATCHES_SMOOTH_ECONOMY,   NULL),
-	SDT_BOOL(Patches, allow_shares,               0, 0,  true,            STR_CONFIG_PATCHES_ALLOW_SHARES,     NULL),
+	SDT_BOOL(Patches, allow_shares,               0, 0, false,            STR_CONFIG_PATCHES_ALLOW_SHARES,     NULL),
 
 	/***************************************************************************/
 	/* AI section of the GUI-configure patches window */
@@ -1467,7 +1467,7 @@
 	/***************************************************************************/
 	/* Terrain genation related patch options */
 	SDT_CONDVAR(Patches,      land_generator,           SLE_UINT8,  30, SL_MAX_VERSION, 0, MS,   1,                   0,    1,               0, STR_CONFIG_PATCHES_LAND_GENERATOR,           NULL),
-	SDT_CONDVAR(Patches,      oil_refinery_limit,       SLE_UINT8,  30, SL_MAX_VERSION, 0, 0,   16,                  12,   48,               0, STR_CONFIG_PATCHES_OIL_REF_EDGE_DISTANCE,    NULL),
+	SDT_CONDVAR(Patches,      oil_refinery_limit,       SLE_UINT8,  30, SL_MAX_VERSION, 0, 0,   32,                  12,   48,               0, STR_CONFIG_PATCHES_OIL_REF_EDGE_DISTANCE,    NULL),
 	SDT_CONDVAR(Patches,      tgen_smoothness,          SLE_UINT8,  30, SL_MAX_VERSION, 0, MS,   1,                   0,    3,               0, STR_CONFIG_PATCHES_ROUGHNESS_OF_TERRAIN,     NULL),
 	SDT_CONDVAR(Patches,      generation_seed,          SLE_UINT32, 30, SL_MAX_VERSION, 0, 0,    GENERATE_NEW_SEED,   0, MAX_UVALUE(uint32), 0, STR_NULL,                                    NULL),
 	SDT_CONDVAR(Patches,      tree_placer,              SLE_UINT8,  30, SL_MAX_VERSION, 0, MS,   2,                   0,    2,               0, STR_CONFIG_PATCHES_TREE_PLACER,              NULL),