src/timetable_gui.cpp
branchNewGRF_ports
changeset 6872 1c4a4a609f85
parent 6871 5a9dc001e1ad
child 6877 889301acc299
--- a/src/timetable_gui.cpp	Mon Dec 03 23:39:38 2007 +0000
+++ b/src/timetable_gui.cpp	Tue Jan 22 21:00:30 2008 +0000
@@ -4,19 +4,22 @@
 
 #include "stdafx.h"
 #include "openttd.h"
-#include "functions.h"
 #include "variables.h"
-#include "table/strings.h"
-#include "strings.h"
-#include "command.h"
-#include "date.h"
+#include "command_func.h"
 #include "engine.h"
 #include "gui.h"
-#include "string.h"
-#include "window.h"
-#include "vehicle.h"
+#include "window_gui.h"
+#include "textbuf_gui.h"
 #include "cargotype.h"
 #include "depot.h"
+#include "strings_func.h"
+#include "vehicle_base.h"
+#include "string_func.h"
+#include "gfx_func.h"
+#include "player_func.h"
+#include "settings_type.h"
+
+#include "table/strings.h"
 
 static int GetOrderFromTimetableWndPt(Window *w, int y, const Vehicle *v)
 {
@@ -48,7 +51,7 @@
 static void DrawTimetableWindow(Window *w)
 {
 	const Vehicle *v = GetVehicle(w->window_number);
-	int selected = WP(w,order_d).sel;
+	int selected = WP(w, order_d).sel;
 
 	SetVScrollCount(w, v->num_orders * 2);
 
@@ -61,7 +64,7 @@
 			w->EnableWidget(7);
 		} else {
 			const Order *order = GetVehicleOrder(v, (selected + 1) / 2);
-			bool disable = order == NULL || order->type != OT_GOTO_STATION || (_patches.new_nonstop && (order->flags & OF_NON_STOP));
+			bool disable = order == NULL || order->type != OT_GOTO_STATION || (_patches.new_nonstop && (order->flags & OFB_NON_STOP));
 
 			w->SetWidgetDisabledState(6, disable);
 			w->SetWidgetDisabledState(7, disable);
@@ -101,7 +104,7 @@
 					break;
 
 				case OT_GOTO_STATION:
-					SetDParam(0, (order->flags & OF_NON_STOP) ? STR_880C_GO_NON_STOP_TO : STR_8806_GO_TO);
+					SetDParam(0, (order->flags & OFB_NON_STOP) ? STR_880C_GO_NON_STOP_TO : STR_8806_GO_TO);
 					SetDParam(1, order->dest);
 
 					if (order->wait_time > 0) {
@@ -121,20 +124,20 @@
 						SetDParam(1, GetDepot(order->dest)->town_index);
 
 						switch (v->type) {
-							case VEH_TRAIN: string = (order->flags & OF_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
+							case VEH_TRAIN: string = (order->flags & OFB_NON_STOP) ? STR_880F_GO_NON_STOP_TO_TRAIN_DEPOT : STR_GO_TO_TRAIN_DEPOT; break;
 							case VEH_ROAD:  string = STR_9038_GO_TO_ROADVEH_DEPOT; break;
 							case VEH_SHIP:  string = STR_GO_TO_SHIP_DEPOT; break;
 							default: break;
 						}
 					}
 
-					if (order->flags & OF_FULL_LOAD) string++; // Service at orders
+					if (order->flags & OFB_FULL_LOAD) string++; // Service at orders
 
 					SetDParam(0, string);
 				} break;
 
 				case OT_GOTO_WAYPOINT:
-					SetDParam(0, (order->flags & OF_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
+					SetDParam(0, (order->flags & OFB_NON_STOP) ? STR_GO_NON_STOP_TO_WAYPOINT : STR_GO_TO_WAYPOINT);
 					SetDParam(1, order->dest);
 					break;
 
@@ -179,7 +182,7 @@
 		for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) {
 			total_time += order->travel_time + order->wait_time;
 			if (order->travel_time == 0) complete = false;
-			if (order->wait_time == 0 && order->type == OT_GOTO_STATION && !(_patches.new_nonstop && (order->flags & OF_NON_STOP))) complete = false;
+			if (order->wait_time == 0 && order->type == OT_GOTO_STATION && !(_patches.new_nonstop && (order->flags & OFB_NON_STOP))) complete = false;
 		}
 
 		if (total_time != 0) {
@@ -221,17 +224,17 @@
 				case 3: { /* Main panel. */
 					int selected = GetOrderFromTimetableWndPt(w, we->we.click.pt.y, v);
 
-					if (selected == INVALID_ORDER || selected == WP(w,order_d).sel) {
+					if (selected == INVALID_ORDER || selected == WP(w, order_d).sel) {
 						/* Deselect clicked order */
-						WP(w,order_d).sel = -1;
+						WP(w, order_d).sel = -1;
 					} else {
 						/* Select clicked order */
-						WP(w,order_d).sel = selected;
+						WP(w, order_d).sel = selected;
 					}
 				} break;
 
 				case 6: { /* "Wait For" button. */
-					int selected = WP(w,order_d).sel;
+					int selected = WP(w, order_d).sel;
 					VehicleOrderID real = (selected + 1) / 2;
 
 					if (real >= v->num_orders) real = 0;
@@ -253,7 +256,7 @@
 				} break;
 
 				case 7: { /* Clear waiting time button. */
-					uint32 p1 = PackTimetableArgs(v, WP(w,order_d).sel);
+					uint32 p1 = PackTimetableArgs(v, WP(w, order_d).sel);
 					DoCommandP(0, p1, 0, NULL, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE));
 				} break;
 
@@ -272,7 +275,7 @@
 		case WE_ON_EDIT_TEXT: {
 			const Vehicle *v = GetVehicle(w->window_number);
 
-			uint32 p1 = PackTimetableArgs(v, WP(w,order_d).sel);
+			uint32 p1 = PackTimetableArgs(v, WP(w, order_d).sel);
 
 			uint64 time = StrEmpty(we->we.edittext.str) ? 0 : strtoul(we->we.edittext.str, NULL, 10);
 			if (!_patches.timetable_in_ticks) time *= DAY_TICKS;
@@ -327,6 +330,6 @@
 		w->caption_color = v->owner;
 		w->vscroll.cap = 8;
 		w->resize.step_height = 10;
-		WP(w,order_d).sel = -1;
+		WP(w, order_d).sel = -1;
 	}
 }