author | rubidium |
Thu, 18 Dec 2008 12:23:08 +0000 | |
changeset 10436 | 8d3a9fbe8f19 |
parent 10341 | 840daea3d9a2 |
permissions | -rw-r--r-- |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
1 |
/* $Id$ */ |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
2 |
|
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
8962
diff
changeset
|
3 |
/** @file timetable_gui.cpp GUI for time tabling. */ |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
4 |
|
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
5 |
#include "stdafx.h" |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
6 |
#include "openttd.h" |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
7 |
#include "variables.h" |
8116
8da76dcb3287
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8114
diff
changeset
|
8 |
#include "command_func.h" |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
9 |
#include "gui.h" |
8107
bb7deea89175
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8106
diff
changeset
|
10 |
#include "window_gui.h" |
bb7deea89175
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8106
diff
changeset
|
11 |
#include "textbuf_gui.h" |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
12 |
#include "cargotype.h" |
8114
dd6d21dc99c1
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8107
diff
changeset
|
13 |
#include "strings_func.h" |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8140
diff
changeset
|
14 |
#include "vehicle_base.h" |
8214
971f861d5543
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8144
diff
changeset
|
15 |
#include "string_func.h" |
8224
c5a64d87cc54
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8214
diff
changeset
|
16 |
#include "gfx_func.h" |
10208
72c00af5c95d
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium
parents:
10207
diff
changeset
|
17 |
#include "company_func.h" |
8929
ebb6e864b545
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros
parents:
8903
diff
changeset
|
18 |
#include "order_func.h" |
8270
e7c342f6b14c
(svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents:
8264
diff
changeset
|
19 |
#include "settings_type.h" |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
20 |
|
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
21 |
#include "table/strings.h" |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
22 |
|
8722
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
23 |
enum TimetableViewWindowWidgets { |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
24 |
TTV_WIDGET_CLOSEBOX = 0, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
25 |
TTV_CAPTION, |
8745
5bfa77abab47
(svn r12441) -Feature: open the time table when pressing the order button while pressing the CTRL key. Patch by Phil Sophus.
rubidium
parents:
8722
diff
changeset
|
26 |
TTV_ORDER_VIEW, |
8722
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
27 |
TTV_STICKY, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
28 |
TTV_TIMETABLE_PANEL, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
29 |
TTV_SCROLLBAR, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
30 |
TTV_SUMMARY_PANEL, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
31 |
TTV_CHANGE_TIME, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
32 |
TTV_CLEAR_TIME, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
33 |
TTV_RESET_LATENESS, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
34 |
TTV_AUTOFILL, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
35 |
TTV_EMPTY, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
36 |
TTV_RESIZE, |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
37 |
}; |
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
38 |
|
8929
ebb6e864b545
(svn r12699) -Codechange: Unify the order drawing code for orders and timetables.
maedhros
parents:
8903
diff
changeset
|
39 |
void SetTimetableParams(int param1, int param2, uint32 time) |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
40 |
{ |
9413
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9354
diff
changeset
|
41 |
if (_settings_client.gui.timetable_in_ticks) { |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
42 |
SetDParam(param1, STR_TIMETABLE_TICKS); |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
43 |
SetDParam(param2, time); |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
44 |
} else { |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
45 |
SetDParam(param1, STR_TIMETABLE_DAYS); |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
46 |
SetDParam(param2, time / DAY_TICKS); |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
47 |
} |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
48 |
} |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
49 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
50 |
struct TimetableWindow : Window { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
51 |
int sel_index; |
10184
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
52 |
const Vehicle *vehicle; |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
53 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
54 |
TimetableWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
55 |
{ |
10184
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
56 |
this->vehicle = GetVehicle(window_number); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
57 |
this->caption_color = this->vehicle->owner; |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
58 |
this->vscroll.cap = 8; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
59 |
this->resize.step_height = 10; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
60 |
this->sel_index = -1; |
9333
2da01b3b71d8
(svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138
parents:
9317
diff
changeset
|
61 |
|
2da01b3b71d8
(svn r13225) -Fix (r13041): Missing calls to FindWindowPlacementAndResize() from lots
peter1138
parents:
9317
diff
changeset
|
62 |
this->FindWindowPlacementAndResize(desc); |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
63 |
} |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
64 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
65 |
int GetOrderFromTimetableWndPt(int y, const Vehicle *v) |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
66 |
{ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
67 |
/* |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
68 |
* Calculation description: |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
69 |
* 15 = 14 (this->widget[TTV_ORDER_VIEW].top) + 1 (frame-line) |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
70 |
* 10 = order text hight |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
71 |
*/ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
72 |
int sel = (y - 15) / 10; |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
73 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
74 |
if ((uint)sel >= this->vscroll.cap) return INVALID_ORDER; |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
75 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
76 |
sel += this->vscroll.pos; |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
77 |
|
10093
687ec810f0a1
(svn r14274) -Fix (r10237): nonexistant order could be selected in the timetable window (causing SIGFPE)
smatz
parents:
9778
diff
changeset
|
78 |
return (sel < v->num_orders * 2 && sel >= 0) ? sel : INVALID_ORDER; |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
79 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
80 |
|
10184
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
81 |
virtual void OnInvalidateData(int data) |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
82 |
{ |
10184
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
83 |
switch (data) { |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
84 |
case 0: |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
85 |
/* Autoreplace replaced the vehicle */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
86 |
this->vehicle = GetVehicle(this->window_number); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
87 |
break; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
88 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
89 |
case -1: |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
90 |
/* Removed / replaced all orders (after deleting / sharing) */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
91 |
if (this->sel_index == -1) break; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
92 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
93 |
this->DeleteChildWindows(); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
94 |
this->sel_index = -1; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
95 |
break; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
96 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
97 |
default: { |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
98 |
/* Moving an order. If one of these is INVALID_VEH_ORDER_ID, then |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
99 |
* the order is being created / removed */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
100 |
if (this->sel_index == -1) break; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
101 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
102 |
VehicleOrderID from = GB(data, 0, 8); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
103 |
VehicleOrderID to = GB(data, 8, 8); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
104 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
105 |
if (from == to) break; // no need to change anything |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
106 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
107 |
/* if from == INVALID_VEH_ORDER_ID, one order was added; if to == INVALID_VEH_ORDER_ID, one order was removed */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
108 |
uint old_num_orders = this->vehicle->num_orders - (uint)(from == INVALID_VEH_ORDER_ID) + (uint)(to == INVALID_VEH_ORDER_ID); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
109 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
110 |
VehicleOrderID selected_order = (this->sel_index + 1) / 2; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
111 |
if (selected_order == old_num_orders) selected_order = 0; // when last travel time is selected, it belongs to order 0 |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
112 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
113 |
bool travel = HasBit(this->sel_index, 0); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
114 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
115 |
if (from != selected_order) { |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
116 |
/* Moving from preceeding order? */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
117 |
selected_order -= (int)(from <= selected_order); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
118 |
/* Moving to preceeding order? */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
119 |
selected_order += (int)(to <= selected_order); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
120 |
} else { |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
121 |
/* Now we are modifying the selected order */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
122 |
if (to == INVALID_VEH_ORDER_ID) { |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
123 |
/* Deleting selected order */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
124 |
this->DeleteChildWindows(); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
125 |
this->sel_index = -1; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
126 |
break; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
127 |
} else { |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
128 |
/* Moving selected order */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
129 |
selected_order = to; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
130 |
} |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
131 |
} |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
132 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
133 |
/* recompute new sel_index */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
134 |
this->sel_index = 2 * selected_order - (int)travel; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
135 |
/* travel time of first order needs special handling */ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
136 |
if (this->sel_index == -1) this->sel_index = this->vehicle->num_orders * 2 - 1; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
137 |
} break; |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
138 |
} |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
139 |
} |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
140 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
141 |
|
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
142 |
virtual void OnPaint() |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
143 |
{ |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
144 |
const Vehicle *v = this->vehicle; |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
145 |
int selected = this->sel_index; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
146 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
147 |
SetVScrollCount(this, v->num_orders * 2); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
148 |
|
10207
c291a21b304e
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents:
10184
diff
changeset
|
149 |
if (v->owner == _local_company) { |
9641
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
150 |
bool disable = true; |
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
151 |
if (selected != -1) { |
9665
dd6c07db9d32
(svn r13752) -Fix [FS#2130]: correctly restore conditional orders when they are put 'into' backup.
rubidium
parents:
9641
diff
changeset
|
152 |
const Order *order = GetVehicleOrder(v, ((selected + 1) / 2) % v->num_orders); |
9641
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
153 |
if (selected % 2 == 1) { |
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
154 |
disable = order != NULL && order->IsType(OT_CONDITIONAL); |
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
155 |
} else { |
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
156 |
disable = order == NULL || ((!order->IsType(OT_GOTO_STATION) || (order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) && !order->IsType(OT_CONDITIONAL)); |
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
157 |
} |
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
158 |
} |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
159 |
|
9641
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
160 |
this->SetWidgetDisabledState(TTV_CHANGE_TIME, disable); |
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
161 |
this->SetWidgetDisabledState(TTV_CLEAR_TIME, disable); |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
162 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
163 |
this->EnableWidget(TTV_RESET_LATENESS); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
164 |
this->EnableWidget(TTV_AUTOFILL); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
165 |
} else { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
166 |
this->DisableWidget(TTV_CHANGE_TIME); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
167 |
this->DisableWidget(TTV_CLEAR_TIME); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
168 |
this->DisableWidget(TTV_RESET_LATENESS); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
169 |
this->DisableWidget(TTV_AUTOFILL); |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
170 |
} |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
171 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
172 |
this->SetWidgetLoweredState(TTV_AUTOFILL, HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)); |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
173 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
174 |
SetDParam(0, v->index); |
9273
35e0224ea8f1
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
9253
diff
changeset
|
175 |
this->DrawWidgets(); |
7073
ca7cb4b5c5e2
(svn r10338) -Codechange: Show the total time that the timetable will take.
maedhros
parents:
7066
diff
changeset
|
176 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
177 |
int y = 15; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
178 |
int i = this->vscroll.pos; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
179 |
VehicleOrderID order_id = (i + 1) / 2; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
180 |
bool final_order = false; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
181 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
182 |
const Order *order = GetVehicleOrder(v, order_id); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
183 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
184 |
while (order != NULL) { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
185 |
/* Don't draw anything if it extends past the end of the window. */ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
186 |
if (i - this->vscroll.pos >= this->vscroll.cap) break; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
187 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
188 |
if (i % 2 == 0) { |
9639
58530f2b5fdc
(svn r13702) -Fix: do not overflow the order/timetable window when 'long' orders are displayed.
rubidium
parents:
9605
diff
changeset
|
189 |
DrawOrderString(v, order, order_id, y, i == selected, true, this->widget[TTV_TIMETABLE_PANEL].right - 4); |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
190 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
191 |
order_id++; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
192 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
193 |
if (order_id >= v->num_orders) { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
194 |
order = GetVehicleOrder(v, 0); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
195 |
final_order = true; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
196 |
} else { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
197 |
order = order->next; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
198 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
199 |
} else { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
200 |
StringID string; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
201 |
|
9641
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
202 |
if (order->IsType(OT_CONDITIONAL)) { |
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
203 |
string = STR_TIMETABLE_NO_TRAVEL; |
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
204 |
} else if (order->travel_time == 0) { |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
205 |
string = STR_TIMETABLE_TRAVEL_NOT_TIMETABLED; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
206 |
} else { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
207 |
SetTimetableParams(0, 1, order->travel_time); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
208 |
string = STR_TIMETABLE_TRAVEL_FOR; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
209 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
210 |
|
9639
58530f2b5fdc
(svn r13702) -Fix: do not overflow the order/timetable window when 'long' orders are displayed.
rubidium
parents:
9605
diff
changeset
|
211 |
DrawStringTruncated(2, y, string, (i == selected) ? TC_WHITE : TC_BLACK, this->widget[TTV_TIMETABLE_PANEL].right - 4); |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
212 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
213 |
if (final_order) break; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
214 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
215 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
216 |
i++; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
217 |
y += 10; |
7073
ca7cb4b5c5e2
(svn r10338) -Codechange: Show the total time that the timetable will take.
maedhros
parents:
7066
diff
changeset
|
218 |
} |
ca7cb4b5c5e2
(svn r10338) -Codechange: Show the total time that the timetable will take.
maedhros
parents:
7066
diff
changeset
|
219 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
220 |
y = this->widget[TTV_SUMMARY_PANEL].top + 1; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
221 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
222 |
{ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
223 |
uint total_time = 0; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
224 |
bool complete = true; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
225 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
226 |
for (const Order *order = GetVehicleOrder(v, 0); order != NULL; order = order->next) { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
227 |
total_time += order->travel_time + order->wait_time; |
9641
a854c7cf6af5
(svn r13704) -Fix: make timetables work more sensible when used in conjunction with conditional orders, i.e. make it possibly to tell how long to travel to the next destination if you jump.
rubidium
parents:
9639
diff
changeset
|
228 |
if (order->travel_time == 0 && !order->IsType(OT_CONDITIONAL)) complete = false; |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
229 |
if (order->wait_time == 0 && order->IsType(OT_GOTO_STATION) && !(order->GetNonStopType() & ONSF_NO_STOP_AT_DESTINATION_STATION)) complete = false; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
230 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
231 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
232 |
if (total_time != 0) { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
233 |
SetTimetableParams(0, 1, total_time); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
234 |
DrawString(2, y, complete ? STR_TIMETABLE_TOTAL_TIME : STR_TIMETABLE_TOTAL_TIME_INCOMPLETE, TC_BLACK); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
235 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
236 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
237 |
y += 10; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
238 |
|
9413
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9354
diff
changeset
|
239 |
if (v->lateness_counter == 0 || (!_settings_client.gui.timetable_in_ticks && v->lateness_counter / DAY_TICKS == 0)) { |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
240 |
DrawString(2, y, STR_TIMETABLE_STATUS_ON_TIME, TC_BLACK); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
241 |
} else { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
242 |
SetTimetableParams(0, 1, abs(v->lateness_counter)); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
243 |
DrawString(2, y, v->lateness_counter < 0 ? STR_TIMETABLE_STATUS_EARLY : STR_TIMETABLE_STATUS_LATE, TC_BLACK); |
7073
ca7cb4b5c5e2
(svn r10338) -Codechange: Show the total time that the timetable will take.
maedhros
parents:
7066
diff
changeset
|
244 |
} |
ca7cb4b5c5e2
(svn r10338) -Codechange: Show the total time that the timetable will take.
maedhros
parents:
7066
diff
changeset
|
245 |
} |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
246 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
247 |
static inline uint32 PackTimetableArgs(const Vehicle *v, uint selected) |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
248 |
{ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
249 |
uint order_number = (selected + 1) / 2; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
250 |
uint is_journey = (selected % 2 == 1) ? 1 : 0; |
7066
e5d16aa8d6ca
(svn r10331) -Feature: Add the possibility of automatically filling in timetables based on
maedhros
parents:
7057
diff
changeset
|
251 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
252 |
if (order_number >= v->num_orders) order_number = 0; |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
253 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
254 |
return v->index | (order_number << 16) | (is_journey << 24); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
255 |
} |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
256 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
257 |
virtual void OnClick(Point pt, int widget) |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
258 |
{ |
10184
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
259 |
const Vehicle *v = this->vehicle; |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
260 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
261 |
switch (widget) { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
262 |
case TTV_ORDER_VIEW: /* Order view button */ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
263 |
ShowOrdersWindow(v); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
264 |
break; |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
265 |
|
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
266 |
case TTV_TIMETABLE_PANEL: { /* Main panel. */ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
267 |
int selected = GetOrderFromTimetableWndPt(pt.y, v); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
268 |
|
10184
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
269 |
this->DeleteChildWindows(); |
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
270 |
this->sel_index = (selected == INVALID_ORDER || selected == this->sel_index) ? -1 : selected; |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
271 |
} break; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
272 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
273 |
case TTV_CHANGE_TIME: { /* "Wait For" button. */ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
274 |
int selected = this->sel_index; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
275 |
VehicleOrderID real = (selected + 1) / 2; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
276 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
277 |
if (real >= v->num_orders) real = 0; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
278 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
279 |
const Order *order = GetVehicleOrder(v, real); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
280 |
StringID current = STR_EMPTY; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
281 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
282 |
if (order != NULL) { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
283 |
uint time = (selected % 2 == 1) ? order->travel_time : order->wait_time; |
9413
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9354
diff
changeset
|
284 |
if (!_settings_client.gui.timetable_in_ticks) time /= DAY_TICKS; |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
285 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
286 |
if (time != 0) { |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
287 |
SetDParam(0, time); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
288 |
current = STR_CONFIG_PATCHES_INT32; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
289 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
290 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
291 |
|
10145
849ba8b8626b
(svn r14331) -Codechange: use an enum as additional parameter for ShowQueryString()
smatz
parents:
10093
diff
changeset
|
292 |
ShowQueryString(current, STR_TIMETABLE_CHANGE_TIME, 31, 150, this, CS_NUMERAL, QSF_NONE); |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
293 |
} break; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
294 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
295 |
case TTV_CLEAR_TIME: { /* Clear waiting time button. */ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
296 |
uint32 p1 = PackTimetableArgs(v, this->sel_index); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
297 |
DoCommandP(0, p1, 0, NULL, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE)); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
298 |
} break; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
299 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
300 |
case TTV_RESET_LATENESS: /* Reset the vehicle's late counter. */ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
301 |
DoCommandP(0, v->index, 0, NULL, CMD_SET_VEHICLE_ON_TIME | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE)); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
302 |
break; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
303 |
|
10341
840daea3d9a2
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium
parents:
10208
diff
changeset
|
304 |
case TTV_AUTOFILL: { /* Autofill the timetable. */ |
840daea3d9a2
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium
parents:
10208
diff
changeset
|
305 |
uint32 p2 = 0; |
840daea3d9a2
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium
parents:
10208
diff
changeset
|
306 |
if (!HasBit(v->vehicle_flags, VF_AUTOFILL_TIMETABLE)) SetBit(p2, 0); |
840daea3d9a2
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium
parents:
10208
diff
changeset
|
307 |
if (_ctrl_pressed) SetBit(p2, 1); |
840daea3d9a2
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium
parents:
10208
diff
changeset
|
308 |
DoCommandP(0, v->index, p2, NULL, CMD_AUTOFILL_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE)); |
840daea3d9a2
(svn r14592) -Feature [FS#1124]: non-destructive autofill with option to keep waiting times (PhilSophus)
rubidium
parents:
10208
diff
changeset
|
309 |
} break; |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
310 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
311 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
312 |
this->SetDirty(); |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
313 |
} |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
314 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
315 |
virtual void OnQueryTextFinished(char *str) |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
316 |
{ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
317 |
if (str == NULL) return; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
318 |
|
10184
bf4e3ff4cf16
(svn r14395) -Fix [FS#2285]: crashes and GUI desyncs when order is deleted/modified while the timetable window is open
smatz
parents:
10145
diff
changeset
|
319 |
const Vehicle *v = this->vehicle; |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
320 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
321 |
uint32 p1 = PackTimetableArgs(v, this->sel_index); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
322 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
323 |
uint64 time = StrEmpty(str) ? 0 : strtoul(str, NULL, 10); |
9413
7042a8ec3fa8
(svn r13325) -Codechange: split the client-side only settings from the settings stored in the savegame so there is no need to have a duplicate copy of it for new games.
rubidium
parents:
9354
diff
changeset
|
324 |
if (!_settings_client.gui.timetable_in_ticks) time *= DAY_TICKS; |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
325 |
|
9605
5a1897abd925
(svn r13647) -Codechange: replace MAX_UVALUE() for std types with the equivalent constant
skidd13
parents:
9413
diff
changeset
|
326 |
uint32 p2 = minu(time, UINT16_MAX); |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
327 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
328 |
DoCommandP(0, p1, p2, NULL, CMD_CHANGE_TIMETABLE | CMD_MSG(STR_CAN_T_TIMETABLE_VEHICLE)); |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
329 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
330 |
|
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
331 |
virtual void OnResize(Point new_size, Point delta) |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
332 |
{ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
333 |
/* Update the scroll + matrix */ |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
334 |
this->vscroll.cap = (this->widget[TTV_TIMETABLE_PANEL].bottom - this->widget[TTV_TIMETABLE_PANEL].top) / 10; |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
335 |
} |
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
336 |
}; |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
337 |
|
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
338 |
static const Widget _timetable_widgets[] = { |
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
339 |
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // TTV_WIDGET_CLOSEBOX |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
340 |
{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 326, 0, 13, STR_TIMETABLE_TITLE, STR_018C_WINDOW_TITLE_DRAG_THIS}, // TTV_CAPTION |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
341 |
{ WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_GREY, 327, 387, 0, 13, STR_ORDER_VIEW, STR_ORDER_VIEW_TOOLTIP}, // TTV_ORDER_VIEW |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
342 |
{ WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 388, 399, 0, 13, STR_NULL, STR_STICKY_BUTTON}, // TTV_STICKY |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
343 |
|
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
344 |
{ WWT_PANEL, RESIZE_RB, COLOUR_GREY, 0, 387, 14, 95, STR_NULL, STR_TIMETABLE_TOOLTIP}, // TTV_TIMETABLE_PANEL |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
345 |
{ WWT_SCROLLBAR, RESIZE_LRB, COLOUR_GREY, 388, 399, 14, 95, STR_NULL, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // TTV_SCROLLBAR |
7057
01a2a637716d
(svn r10322) -Codechange: Make the timetable window smaller by default so it doesn't take up so much space on small resolutions.
maedhros
parents:
7049
diff
changeset
|
346 |
|
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
347 |
{ WWT_PANEL, RESIZE_RTB, COLOUR_GREY, 0, 399, 96, 117, STR_NULL, STR_NULL}, // TTV_SUMMARY_PANEL |
8722
6c3a3816bff5
(svn r12397) -Codechange [FS#1856]: enumify widget number for time tables. Patch by Phil Sophus.
rubidium
parents:
8424
diff
changeset
|
348 |
|
9778
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
349 |
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 0, 109, 118, 129, STR_TIMETABLE_CHANGE_TIME, STR_TIMETABLE_WAIT_TIME_TOOLTIP}, // TTV_CHANGE_TIME |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
350 |
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 110, 219, 118, 129, STR_CLEAR_TIME, STR_TIMETABLE_CLEAR_TIME_TOOLTIP}, // TTV_CLEAR_TIME |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
351 |
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 220, 337, 118, 129, STR_RESET_LATENESS, STR_TIMETABLE_RESET_LATENESS_TOOLTIP}, // TTV_RESET_LATENESS |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
352 |
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 338, 387, 118, 129, STR_TIMETABLE_AUTOFILL, STR_TIMETABLE_AUTOFILL_TOOLTIP}, // TTV_AUTOFILL |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
353 |
|
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
354 |
{ WWT_PANEL, RESIZE_RTB, COLOUR_GREY, 388, 387, 118, 129, STR_NULL, STR_NULL}, // TTV_EMPTY |
c5dd94ed7c16
(svn r13919) -Codechange: Replace numbers with Colours enum on osk(forgot 2 assignations), statusbar, subsidy, terraform, timetable, toolbar, town, tree and vehicle guis.
belugas
parents:
9665
diff
changeset
|
355 |
{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_GREY, 388, 399, 118, 129, STR_NULL, STR_RESIZE_BUTTON}, // TTV_RESIZE |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
356 |
|
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
357 |
{ WIDGETS_END } |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
358 |
}; |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
359 |
|
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
360 |
static const WindowDesc _timetable_desc = { |
7341
02515d0d4ced
(svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents:
7312
diff
changeset
|
361 |
WDP_AUTO, WDP_AUTO, 400, 130, 400, 130, |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
362 |
WC_VEHICLE_TIMETABLE, WC_VEHICLE_VIEW, |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
363 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
364 |
_timetable_widgets, |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
365 |
}; |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
366 |
|
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
367 |
void ShowTimetableWindow(const Vehicle *v) |
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
368 |
{ |
9253
fb3bf727fc75
(svn r13119) -Codechange: make a class of the timetable window.
rubidium
parents:
9164
diff
changeset
|
369 |
AllocateWindowDescFront<TimetableWindow>(&_timetable_desc, v->index); |
6981
9af49f50fe33
(svn r10237) -Fix (r10236): It helps if you use svn add with new files...
maedhros
parents:
diff
changeset
|
370 |
} |