src/vehicle_gui.cpp
branchNewGRF_ports
changeset 10184 fcf5fb2548eb
parent 6878 7d1ff2f621c7
child 10210 a2131f7a315d
--- a/src/vehicle_gui.cpp	Mon Apr 14 20:32:36 2008 +0000
+++ b/src/vehicle_gui.cpp	Tue Apr 15 00:47:19 2008 +0000
@@ -6,8 +6,6 @@
 #include "openttd.h"
 #include "debug.h"
 #include "player_func.h"
-#include "station.h"
-#include "engine.h"
 #include "gui.h"
 #include "window_gui.h"
 #include "textbuf_gui.h"
@@ -36,10 +34,20 @@
 #include "string_func.h"
 #include "settings_type.h"
 #include "widgets/dropdown_func.h"
+#include "order_func.h"
 
 #include "table/sprites.h"
 #include "table/strings.h"
 
+struct refit_d {
+	int sel;
+	struct RefitOption *cargo;
+	struct RefitList *list;
+	uint length;
+	VehicleOrderID order;
+};
+assert_compile(WINDOW_CUSTOM_SIZE >= sizeof(refit_d));
+
 struct Sorting {
 	Listing aircraft;
 	Listing roadveh;
@@ -909,10 +917,10 @@
 		if (sel == 0) DrawString(x - 6, y, STR_SMALL_RIGHT_ARROW, TC_BLACK);
 		sel--;
 
-		if (order->type == OT_GOTO_STATION) {
-			if (v->type == VEH_SHIP && GetStation(order->dest)->IsBuoy()) continue;
+		if (order->IsType(OT_GOTO_STATION)) {
+			if (v->type == VEH_SHIP && GetStation(order->GetDestination())->IsBuoy()) continue;
 
-			SetDParam(0, order->dest);
+			SetDParam(0, order->GetDestination());
 			DrawString(x, y, STR_A036, TC_FROMSTRING);
 
 			y += 6;
@@ -1944,9 +1952,9 @@
 			str = STR_8861_STOPPED;
 		}
 	} else { // vehicle is in a "normal" state, show current order
-		switch (v->current_order.type) {
+		switch (v->current_order.GetType()) {
 			case OT_GOTO_STATION: {
-				SetDParam(0, v->current_order.dest);
+				SetDParam(0, v->current_order.GetDestination());
 				SetDParam(1, v->GetDisplaySpeed());
 				str = STR_HEADING_FOR_STATION + _patches.vehicle_speed;
 			} break;
@@ -1954,14 +1962,14 @@
 			case OT_GOTO_DEPOT: {
 				if (v->type == VEH_AIRCRAFT) {
 					/* Aircrafts always go to a station, even if you say depot */
-					SetDParam(0, v->current_order.dest);
+					SetDParam(0, v->current_order.GetDestination());
 					SetDParam(1, v->GetDisplaySpeed());
 				} else {
-					Depot *depot = GetDepot(v->current_order.dest);
+					Depot *depot = GetDepot(v->current_order.GetDestination());
 					SetDParam(0, depot->town_index);
 					SetDParam(1, v->GetDisplaySpeed());
 				}
-				if (HasBit(v->current_order.flags, OF_HALT_IN_DEPOT) && !HasBit(v->current_order.flags, OF_PART_OF_ORDERS)) {
+				if ((v->current_order.GetDepotActionType() & ODATFB_HALT) && !(v->current_order.GetDepotOrderType() & ODTFB_PART_OF_ORDERS)) {
 					str = _heading_for_depot_strings[v->type] + _patches.vehicle_speed;
 				} else {
 					str = _heading_for_depot_service_strings[v->type] + _patches.vehicle_speed;
@@ -1974,7 +1982,7 @@
 
 			case OT_GOTO_WAYPOINT: {
 				assert(v->type == VEH_TRAIN);
-				SetDParam(0, v->current_order.dest);
+				SetDParam(0, v->current_order.GetDestination());
 				str = STR_HEADING_FOR_WAYPOINT + _patches.vehicle_speed;
 				SetDParam(1, v->GetDisplaySpeed());
 				break;
@@ -2079,7 +2087,11 @@
 					ShowVehicleRefitWindow(v, INVALID_VEH_ORDER_ID);
 					break;
 				case VVW_WIDGET_SHOW_ORDERS: /* show orders */
-					ShowOrdersWindow(v);
+					if (_ctrl_pressed) {
+						ShowTimetableWindow(v);
+					} else {
+						ShowOrdersWindow(v);
+					}
 					break;
 				case VVW_WIDGET_SHOW_DETAILS: /* show details */
 					ShowVehicleDetailsWindow(v);