--- 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),