author | celestar |
Tue, 02 Jan 2007 16:43:05 +0000 | |
branch | custombridgeheads |
changeset 5640 | ccd487181ed5 |
parent 5623 | ef2a8a524a95 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1820
diff
changeset
|
4 |
#include "openttd.h" |
3963
d7d284c2f1f7
(svn r5124) Add IsAircraftInHangar{Stopped,}(), which supersedes CheckStoppedInHangar()
tron
parents:
3948
diff
changeset
|
5 |
#include "aircraft.h" |
1299
0a6510cc889b
(svn r1803) Move debugging stuff into files of it's own
tron
parents:
1294
diff
changeset
|
6 |
#include "debug.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
7 |
#include "functions.h" |
1922
797081e56d13
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1907
diff
changeset
|
8 |
#include "table/sprites.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
382
diff
changeset
|
9 |
#include "table/strings.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
588
diff
changeset
|
10 |
#include "map.h" |
0 | 11 |
#include "window.h" |
12 |
#include "gui.h" |
|
13 |
#include "vehicle.h" |
|
14 |
#include "gfx.h" |
|
15 |
#include "command.h" |
|
16 |
#include "engine.h" |
|
17 |
#include "viewport.h" |
|
18 |
#include "player.h" |
|
1313
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1299
diff
changeset
|
19 |
#include "depot.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2113
diff
changeset
|
20 |
#include "vehicle_gui.h" |
2962
dbd168a4703a
(svn r3524) - Split newgrf features from engine.[ch] into newgrf_engine.[ch], and add the new files to project files.
peter1138
parents:
2958
diff
changeset
|
21 |
#include "newgrf_engine.h" |
4787
fbf6f00ba6c6
(svn r6708) -Feature: [build aircraft window] added sort options to the list
bjarni
parents:
4786
diff
changeset
|
22 |
|
0 | 23 |
|
3887
3e44ae3b1e7c
(svn r4943) uint tile -> TileIndex tile, byte player -> PlayerID player
tron
parents:
3884
diff
changeset
|
24 |
void CcCloneAircraft(bool success, TileIndex tile, uint32 p1, uint32 p2) |
2244 | 25 |
{ |
3948
95f9fa0ac551
(svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough.
tron
parents:
3887
diff
changeset
|
26 |
if (success) ShowAircraftViewWindow(GetVehicle(_new_vehicle_id)); |
2244 | 27 |
} |
0 | 28 |
|
29 |
static void AircraftDetailsWndProc(Window *w, WindowEvent *e) |
|
30 |
{ |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
31 |
switch (e->event) { |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
32 |
case WE_PAINT: { |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
33 |
const Vehicle *v = GetVehicle(w->window_number); |
0 | 34 |
|
4709
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
35 |
SetWindowWidgetDisabledState(w, 2, v->owner != _local_player); |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
36 |
|
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
37 |
/* Disable service-scroller when interval is set to disabled */ |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
38 |
SetWindowWidgetDisabledState(w, 5, !_patches.servint_aircraft); |
eff35edfb653
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
39 |
SetWindowWidgetDisabledState(w, 6, !_patches.servint_aircraft); |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
40 |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
41 |
SetDParam(0, v->string_id); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
42 |
SetDParam(1, v->unitnumber); |
0 | 43 |
DrawWindowWidgets(w); |
44 |
||
45 |
/* Draw running cost */ |
|
46 |
{ |
|
47 |
int year = v->age / 366; |
|
48 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
49 |
SetDParam(1, year); |
0 | 50 |
|
2252
37e3ca7014e0
(svn r2772) Simplify the age notice in the vehicle details window
tron
parents:
2244
diff
changeset
|
51 |
SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
52 |
SetDParam(2, v->max_age / 366); |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
534
diff
changeset
|
53 |
SetDParam(3, _price.aircraft_running * AircraftVehInfo(v->engine_type)->running_cost >> 8); |
0 | 54 |
DrawString(2, 15, STR_A00D_AGE_RUNNING_COST_YR, 0); |
55 |
} |
|
56 |
||
57 |
/* Draw max speed */ |
|
58 |
{ |
|
3477
80c3465b38ee
(svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again.
peter1138
parents:
3338
diff
changeset
|
59 |
SetDParam(0, v->max_speed * 128 / 10); |
0 | 60 |
DrawString(2, 25, STR_A00E_MAX_SPEED, 0); |
61 |
} |
|
62 |
||
63 |
/* Draw profit */ |
|
64 |
{ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
65 |
SetDParam(0, v->profit_this_year); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
66 |
SetDParam(1, v->profit_last_year); |
0 | 67 |
DrawString(2, 35, STR_A00F_PROFIT_THIS_YEAR_LAST_YEAR, 0); |
68 |
} |
|
69 |
||
70 |
/* Draw breakdown & reliability */ |
|
71 |
{ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
72 |
SetDParam(0, v->reliability * 100 >> 16); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
73 |
SetDParam(1, v->breakdowns_since_last_service); |
0 | 74 |
DrawString(2, 45, STR_A010_RELIABILITY_BREAKDOWNS, 0); |
75 |
} |
|
76 |
||
77 |
/* Draw service interval text */ |
|
78 |
{ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
79 |
SetDParam(0, v->service_interval); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
80 |
SetDParam(1, v->date_of_last_service); |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
81 |
DrawString(13, 103, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0); |
0 | 82 |
} |
83 |
||
84 |
DrawAircraftImage(v, 3, 57, INVALID_VEHICLE); |
|
85 |
||
86 |
{ |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
87 |
const Vehicle *u; |
0 | 88 |
int y = 57; |
89 |
||
90 |
do { |
|
91 |
if (v->subtype <= 2) { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
92 |
SetDParam(0, GetCustomEngineName(v->engine_type)); |
4329
9759d5c52010
(svn r6002) -Cleanup: remove the now redundant BASE_YEAR constant.
rubidium
parents:
4299
diff
changeset
|
93 |
SetDParam(1, v->build_year); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
94 |
SetDParam(2, v->value); |
0 | 95 |
DrawString(60, y, STR_A011_BUILT_VALUE, 0); |
96 |
y += 10; |
|
97 |
||
4896
72d7a8614580
(svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string.
peter1138
parents:
4800
diff
changeset
|
98 |
SetDParam(0, v->cargo_type); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
99 |
SetDParam(1, v->cargo_cap); |
0 | 100 |
u = v->next; |
4896
72d7a8614580
(svn r6855) - Codechange: When displaying a "quantity of cargo" string, use the {CARGO} command and supply the cargo type and quantity, instead of manually looking up the cargo type's string.
peter1138
parents:
4800
diff
changeset
|
101 |
SetDParam(2, u->cargo_type); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
102 |
SetDParam(3, u->cargo_cap); |
2260
3e97367f7cbc
(svn r2780) Remove some more unused strings and make the use of a few strings more explicit
tron
parents:
2252
diff
changeset
|
103 |
DrawString(60, y, (u->cargo_cap != 0) ? STR_A019_CAPACITY : STR_A01A_CAPACITY, 0); |
0 | 104 |
y += 14; |
105 |
} |
|
106 |
||
107 |
if (v->cargo_count != 0) { |
|
108 |
||
109 |
/* Cargo names (fix pluralness) */ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
110 |
SetDParam(0, v->cargo_type); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
111 |
SetDParam(1, v->cargo_count); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
112 |
SetDParam(2, v->cargo_source); |
0 | 113 |
DrawString(60, y, STR_8813_FROM, 0); |
114 |
||
115 |
y += 10; |
|
116 |
} |
|
117 |
} while ( (v=v->next) != NULL); |
|
118 |
} |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
119 |
} break; |
0 | 120 |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
121 |
case WE_CLICK: { |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
122 |
int mod; |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
123 |
const Vehicle *v; |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
124 |
switch (e->we.click.widget) { |
0 | 125 |
case 2: /* rename */ |
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
126 |
v = GetVehicle(w->window_number); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
127 |
SetDParam(0, v->unitnumber); |
5623
ef2a8a524a95
(svn r7721) [cbh] - Sync with 7607:7720 from trunk
celestar
parents:
5078
diff
changeset
|
128 |
ShowQueryString(v->string_id, STR_A030_NAME_AIRCRAFT, 31, 150, w, CS_ALPHANUMERAL); |
0 | 129 |
break; |
130 |
case 5: /* increase int */ |
|
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
131 |
mod = _ctrl_pressed? 5 : 10; |
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
132 |
goto do_change_service_int; |
0 | 133 |
case 6: /* decrease int */ |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
134 |
mod = _ctrl_pressed?- 5 : -10; |
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
135 |
do_change_service_int: |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
136 |
v = GetVehicle(w->window_number); |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
137 |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
138 |
mod = GetServiceIntervalClamped(mod + v->service_interval); |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
139 |
if (mod == v->service_interval) return; |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
140 |
|
2819
710436dd4288
(svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
tron
parents:
2806
diff
changeset
|
141 |
DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING)); |
0 | 142 |
break; |
143 |
} |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
144 |
} break; |
0 | 145 |
|
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2517
diff
changeset
|
146 |
case WE_ON_EDIT_TEXT: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
147 |
if (e->we.edittext.str[0] != '\0') { |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
148 |
_cmd_text = e->we.edittext.str; |
1820
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1802
diff
changeset
|
149 |
DoCommandP(0, w->window_number, 0, NULL, |
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1802
diff
changeset
|
150 |
CMD_NAME_VEHICLE | CMD_MSG(STR_A031_CAN_T_NAME_AIRCRAFT)); |
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1802
diff
changeset
|
151 |
} |
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2517
diff
changeset
|
152 |
break; |
0 | 153 |
} |
154 |
} |
|
155 |
||
156 |
||
157 |
static const Widget _aircraft_details_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
158 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
159 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 349, 0, 13, STR_A00C_DETAILS, STR_018C_WINDOW_TITLE_DRAG_THIS }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
160 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 350, 389, 0, 13, STR_01AA_NAME, STR_A032_NAME_AIRCRAFT }, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
161 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 389, 14, 55, 0x0, STR_NULL }, |
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
162 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 389, 56, 101, 0x0, STR_NULL }, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
163 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 10, 102, 107, STR_0188, STR_884D_INCREASE_SERVICING_INTERVAL }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
164 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 10, 108, 113, STR_0189, STR_884E_DECREASE_SERVICING_INTERVAL }, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
165 |
{ WWT_PANEL, RESIZE_NONE, 14, 11, 389, 102, 113, 0x0, STR_NULL }, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
166 |
{ WIDGETS_END}, |
0 | 167 |
}; |
168 |
||
169 |
static const WindowDesc _aircraft_details_desc = { |
|
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4939
diff
changeset
|
170 |
WDP_AUTO, WDP_AUTO, 390, 114, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
171 |
WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW, |
0 | 172 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
173 |
_aircraft_details_widgets, |
|
174 |
AircraftDetailsWndProc |
|
175 |
}; |
|
176 |
||
177 |
||
4171 | 178 |
static void ShowAircraftDetailsWindow(const Vehicle *v) |
0 | 179 |
{ |
180 |
Window *w; |
|
181 |
VehicleID veh = v->index; |
|
182 |
||
183 |
DeleteWindowById(WC_VEHICLE_ORDERS, veh); |
|
184 |
DeleteWindowById(WC_VEHICLE_DETAILS, veh); |
|
185 |
||
5071
14f432b47034
(svn r7129) -Codechange: Get rid of a global variable that only sets a window's number.
Darkvater
parents:
5070
diff
changeset
|
186 |
w = AllocateWindowDescFront(&_aircraft_details_desc, veh); |
0 | 187 |
w->caption_color = v->owner; |
188 |
// w->vscroll.cap = 6; |
|
189 |
// w->traindetails_d.tab = 0; |
|
190 |
} |
|
191 |
||
192 |
||
193 |
static const Widget _aircraft_view_widgets[] = { |
|
4937
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
194 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
195 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 237, 0, 13, STR_A00A, STR_018C_WINDOW_TITLE_DRAG_THIS }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
196 |
{ WWT_STICKYBOX, RESIZE_LR, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
197 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 231, 14, 103, 0x0, STR_NULL }, |
4939
ede0f6777b3c
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
198 |
{ WWT_INSET, RESIZE_RB, 14, 2, 229, 16, 101, 0x0, STR_NULL }, |
4938
074f734a91ca
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
199 |
{ WWT_PUSHBTN, RESIZE_RTB, 14, 0, 237, 104, 115, 0x0, STR_A027_CURRENT_AIRCRAFT_ACTION }, |
4937
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
200 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 14, 31, SPR_CENTRE_VIEW_VEHICLE, STR_A029_CENTER_MAIN_VIEW_ON_AIRCRAFT }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
201 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, SPR_SEND_AIRCRAFT_TODEPOT,STR_A02A_SEND_AIRCRAFT_TO_HANGAR }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
202 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 50, 67, SPR_REFIT_VEHICLE, STR_A03B_REFIT_AIRCRAFT_TO_CARRY }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
203 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 68, 85, SPR_SHOW_ORDERS, STR_A028_SHOW_AIRCRAFT_S_ORDERS }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
204 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 86, 103, SPR_SHOW_VEHICLE_DETAILS, STR_A02B_SHOW_AIRCRAFT_DETAILS }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
205 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, SPR_CLONE_AIRCRAFT, STR_CLONE_AIRCRAFT_INFO }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
206 |
{ WWT_PANEL, RESIZE_LRB, 14, 232, 249, 104, 103, 0x0, STR_NULL }, |
a525d56a8d40
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4896
diff
changeset
|
207 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 238, 249, 104, 115, 0x0, STR_NULL }, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
208 |
{ WIDGETS_END}, |
0 | 209 |
}; |
210 |
||
2244 | 211 |
|
0 | 212 |
static void AircraftViewWndProc(Window *w, WindowEvent *e) |
213 |
{ |
|
2952 | 214 |
switch (e->event) { |
0 | 215 |
case WE_PAINT: { |
4171 | 216 |
const Vehicle *v = GetVehicle(w->window_number); |
0 | 217 |
StringID str; |
5078
130939b8e39e
(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)
glx
parents:
5071
diff
changeset
|
218 |
bool is_localplayer = v->owner == _local_player; |
0 | 219 |
|
5078
130939b8e39e
(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)
glx
parents:
5071
diff
changeset
|
220 |
SetWindowWidgetDisabledState(w, 7, !is_localplayer); |
130939b8e39e
(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)
glx
parents:
5071
diff
changeset
|
221 |
SetWindowWidgetDisabledState(w, 8, !IsAircraftInHangarStopped(v) || !is_localplayer); |
130939b8e39e
(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)
glx
parents:
5071
diff
changeset
|
222 |
SetWindowWidgetDisabledState(w, 11, !is_localplayer); |
0 | 223 |
|
224 |
||
225 |
/* draw widgets & caption */ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
226 |
SetDParam(0, v->string_id); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
227 |
SetDParam(1, v->unitnumber); |
0 | 228 |
DrawWindowWidgets(w); |
229 |
||
230 |
if (v->vehstatus & VS_CRASHED) { |
|
231 |
str = STR_8863_CRASHED; |
|
232 |
} else if (v->vehstatus & VS_STOPPED) { |
|
233 |
str = STR_8861_STOPPED; |
|
234 |
} else { |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
543
diff
changeset
|
235 |
switch (v->current_order.type) { |
0 | 236 |
case OT_GOTO_STATION: { |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4524
diff
changeset
|
237 |
SetDParam(0, v->current_order.dest); |
3477
80c3465b38ee
(svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again.
peter1138
parents:
3338
diff
changeset
|
238 |
SetDParam(1, v->cur_speed * 128 / 10); |
0 | 239 |
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed; |
240 |
} break; |
|
241 |
||
242 |
case OT_GOTO_DEPOT: { |
|
4389
e4555522d257
(svn r6142) -Codechange: added WaypointID (sorry DV, couldn't splits it anymore)
truelight
parents:
4345
diff
changeset
|
243 |
/* Aircrafts always go to a station, even if you say depot */ |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4524
diff
changeset
|
244 |
SetDParam(0, v->current_order.dest); |
3477
80c3465b38ee
(svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again.
peter1138
parents:
3338
diff
changeset
|
245 |
SetDParam(1, v->cur_speed * 128 / 10); |
4633
fae5d85ef53d
(svn r6497) -Fix r6165: Vehicles heading for depots when their orders contained "service in depot" displayed the stopping in depot string
bjarni
parents:
4547
diff
changeset
|
246 |
if (HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT) && !HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS)) { |
4412
945e8a9bb89a
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
247 |
str = STR_HEADING_FOR_HANGAR + _patches.vehicle_speed; |
945e8a9bb89a
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
248 |
} else { |
945e8a9bb89a
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
249 |
str = STR_HEADING_FOR_HANGAR_SERVICE + _patches.vehicle_speed; |
945e8a9bb89a
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
250 |
} |
0 | 251 |
} break; |
252 |
||
253 |
case OT_LOADING: |
|
254 |
str = STR_882F_LOADING_UNLOADING; |
|
255 |
break; |
|
256 |
||
257 |
default: |
|
258 |
if (v->num_orders == 0) { |
|
259 |
str = STR_NO_ORDERS + _patches.vehicle_speed; |
|
3477
80c3465b38ee
(svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again.
peter1138
parents:
3338
diff
changeset
|
260 |
SetDParam(0, v->cur_speed * 128 / 10); |
2639 | 261 |
} else { |
0 | 262 |
str = STR_EMPTY; |
2639 | 263 |
} |
0 | 264 |
break; |
265 |
} |
|
266 |
} |
|
267 |
||
2103
9266bb2ac29d
(svn r2613) - Truncate savegames, and vehicle-texts in their window.
Darkvater
parents:
2084
diff
changeset
|
268 |
/* draw the flag plus orders */ |
2517
b90693227193
(svn r3046) Replace some numbers with sprite names and fix a typo in the sprite list
tron
parents:
2498
diff
changeset
|
269 |
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, 2, w->widget[5].top + 1); |
2113
f228b399da01
(svn r2623) - CodeChange: rework DrawStringCenteredTruncated() a bit. Instead of giving center + width you give the coordinates of the bounding box (left, right) it has to fit in (ludde)
Darkvater
parents:
2103
diff
changeset
|
270 |
DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0); |
0 | 271 |
DrawWindowViewport(w); |
272 |
} break; |
|
273 |
||
274 |
case WE_CLICK: { |
|
4171 | 275 |
const Vehicle *v = GetVehicle(w->window_number); |
0 | 276 |
|
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
277 |
switch (e->we.click.widget) { |
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
278 |
case 5: /* start stop */ |
0 | 279 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_AIRCRAFT | CMD_MSG(STR_A016_CAN_T_STOP_START_AIRCRAFT)); |
280 |
break; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
281 |
case 6: /* center main view */ |
0 | 282 |
ScrollMainWindowTo(v->x_pos, v->y_pos); |
283 |
break; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
284 |
case 7: /* goto hangar */ |
4506
0d8fcc0a4e49
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4456
diff
changeset
|
285 |
DoCommandP(v->tile, v->index, _ctrl_pressed ? DEPOT_SERVICE : 0, NULL, CMD_SEND_AIRCRAFT_TO_HANGAR | CMD_MSG(STR_A012_CAN_T_SEND_AIRCRAFT_TO)); |
0 | 286 |
break; |
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
287 |
case 8: /* refit */ |
4712
273ec3b182bf
(svn r6624) -Feature: added ability to add refit commands to vehicle orders (can only be done in goto depot orders)
bjarni
parents:
4709
diff
changeset
|
288 |
ShowVehicleRefitWindow(v, INVALID_VEH_ORDER_ID); |
0 | 289 |
break; |
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
290 |
case 9: /* show orders */ |
0 | 291 |
ShowOrdersWindow(v); |
292 |
break; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
293 |
case 10: /* show details */ |
0 | 294 |
ShowAircraftDetailsWindow(v); |
295 |
break; |
|
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
296 |
case 11: |
2244 | 297 |
/* clone vehicle */ |
298 |
DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneAircraft, CMD_CLONE_VEHICLE | CMD_MSG(STR_A008_CAN_T_BUILD_AIRCRAFT)); |
|
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
299 |
break; |
0 | 300 |
} |
301 |
} break; |
|
302 |
||
1485
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1323
diff
changeset
|
303 |
case WE_RESIZE: |
4634
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
304 |
w->viewport->width += e->we.sizing.diff.x; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
305 |
w->viewport->height += e->we.sizing.diff.y; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
306 |
w->viewport->virtual_width += e->we.sizing.diff.x; |
897461a3e9ca
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
307 |
w->viewport->virtual_height += e->we.sizing.diff.y; |
1485
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1323
diff
changeset
|
308 |
break; |
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1323
diff
changeset
|
309 |
|
0 | 310 |
case WE_DESTROY: |
311 |
DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number); |
|
312 |
DeleteWindowById(WC_VEHICLE_REFIT, w->window_number); |
|
313 |
DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number); |
|
314 |
break; |
|
2261
3f78323707bb
(svn r2781) Fix some of the issues with variables in .h files.
ludde
parents:
2260
diff
changeset
|
315 |
|
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
316 |
case WE_MOUSELOOP: { |
4171 | 317 |
const Vehicle *v = GetVehicle(w->window_number); |
4702
5179f9adc5b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
318 |
bool plane_stopped = IsAircraftInHangarStopped(v); |
2244 | 319 |
|
4702
5179f9adc5b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
320 |
/* Widget 7 (send to hangar) must be hidden if the plane is already stopped in hangar. |
5179f9adc5b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
321 |
* Widget 11 (clone) should then be shown, since cloning is allowed only while in hangar and stopped. |
5179f9adc5b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
322 |
* This sytem allows to have two buttons, on top of each other*/ |
5179f9adc5b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
323 |
if (plane_stopped != IsWindowWidgetHidden(w, 7) || plane_stopped == IsWindowWidgetHidden(w, 11)) { |
5179f9adc5b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
324 |
SetWindowWidgetHiddenState(w, 7, plane_stopped); // send to hangar |
5179f9adc5b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
325 |
SetWindowWidgetHiddenState(w, 11, !plane_stopped); // clone |
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
326 |
SetWindowDirty(w); |
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
327 |
} |
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
328 |
} break; |
0 | 329 |
} |
330 |
} |
|
331 |
||
332 |
||
333 |
static const WindowDesc _aircraft_view_desc = { |
|
5070
0bbf5264bfb7
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4939
diff
changeset
|
334 |
WDP_AUTO, WDP_AUTO, 250, 116, |
0 | 335 |
WC_VEHICLE_VIEW ,0, |
1485
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1323
diff
changeset
|
336 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
0 | 337 |
_aircraft_view_widgets, |
338 |
AircraftViewWndProc |
|
339 |
}; |
|
340 |
||
341 |
||
4171 | 342 |
void ShowAircraftViewWindow(const Vehicle *v) |
0 | 343 |
{ |
4171 | 344 |
Window *w = AllocateWindowDescFront(&_aircraft_view_desc, v->index); |
0 | 345 |
|
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
346 |
if (w != NULL) { |
0 | 347 |
w->caption_color = v->owner; |
348 |
AssignWindowViewport(w, 3, 17, 0xE2, 0x54, w->window_number | (1 << 31), 0); |
|
349 |
} |
|
350 |
} |