author | rubidium |
Wed, 11 Jul 2007 15:03:29 +0000 | |
changeset 7229 | a5f262f6df1b |
parent 7219 | 46fcc725cad3 |
child 7266 | b16e67e992b4 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6198
diff
changeset
|
3 |
/** @file ship_gui.cpp */ |
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6198
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1820
diff
changeset
|
6 |
#include "openttd.h" |
1299
39c06aba09aa
(svn r1803) Move debugging stuff into files of it's own
tron
parents:
1294
diff
changeset
|
7 |
#include "debug.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
8 |
#include "functions.h" |
3961
9868b766fda7
(svn r5120) Add IsShipInDepot{Stopped,}() and remove some redundant checks
tron
parents:
3948
diff
changeset
|
9 |
#include "ship.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
243
diff
changeset
|
10 |
#include "table/strings.h" |
2187
a0e206ce9fbf
(svn r2702) -Codechange: Cleaned up the sprite code and replaced many magic numbers
celestar
parents:
2186
diff
changeset
|
11 |
#include "table/sprites.h" |
0 | 12 |
#include "gui.h" |
13 |
#include "vehicle.h" |
|
14 |
#include "viewport.h" |
|
15 |
#include "command.h" |
|
1313
f1013ec3d318
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1299
diff
changeset
|
16 |
#include "depot.h" |
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2113
diff
changeset
|
17 |
#include "vehicle_gui.h" |
2962
f0a49b646c48
(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
|
18 |
#include "newgrf_engine.h" |
0 | 19 |
|
4442
9f8bb348d58f
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4436
diff
changeset
|
20 |
void DrawShipImage(const Vehicle *v, int x, int y, VehicleID selection) |
1790
47963a0cfca3
(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:
1751
diff
changeset
|
21 |
{ |
7134
5b2d47128d05
(svn r10408) -Codechange: make GetImage a class method of Vehicle instead of Get(Aircraft|RoadVeh|Ship|Train)Image.
rubidium
parents:
7063
diff
changeset
|
22 |
DrawSprite(v->GetImage(DIR_W), GetVehiclePalette(v), x + 32, y + 10); |
0 | 23 |
|
1790
47963a0cfca3
(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:
1751
diff
changeset
|
24 |
if (v->index == selection) { |
2639 | 25 |
DrawFrameRect(x - 5, y - 1, x + 67, y + 21, 15, FR_BORDERONLY); |
1790
47963a0cfca3
(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:
1751
diff
changeset
|
26 |
} |
47963a0cfca3
(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:
1751
diff
changeset
|
27 |
} |
0 | 28 |
|
29 |
static void ShipDetailsWndProc(Window *w, WindowEvent *e) |
|
30 |
{ |
|
1790
47963a0cfca3
(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:
1751
diff
changeset
|
31 |
switch (e->event) { |
47963a0cfca3
(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:
1751
diff
changeset
|
32 |
case WE_PAINT: { |
47963a0cfca3
(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:
1751
diff
changeset
|
33 |
const Vehicle *v = GetVehicle(w->window_number); |
47963a0cfca3
(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:
1751
diff
changeset
|
34 |
StringID str; |
0 | 35 |
|
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
36 |
SetWindowWidgetDisabledState(w, 2, v->owner != _local_player); |
6420
456c275f3313
(svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents:
6198
diff
changeset
|
37 |
/* disable service-scroller when interval is set to disabled */ |
4709
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
38 |
SetWindowWidgetDisabledState(w, 5, !_patches.servint_ships); |
a81ab800c25b
(svn r6619) -Codechange: Use accessors for disabled_state.
belugas
parents:
4702
diff
changeset
|
39 |
SetWindowWidgetDisabledState(w, 6, !_patches.servint_ships); |
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 |
|
7049
0ebe47348074
(svn r10314) -Codechange: Refer to vehicle names by index
peter1138
parents:
7010
diff
changeset
|
41 |
SetDParam(0, v->index); |
0 | 42 |
DrawWindowWidgets(w); |
43 |
||
44 |
/* Draw running cost */ |
|
45 |
{ |
|
46 |
int year = v->age / 366; |
|
47 |
||
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
48 |
SetDParam(1, year); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
49 |
|
2252
6df2bfd7a077
(svn r2772) Simplify the age notice in the vehicle details window
tron
parents:
2244
diff
changeset
|
50 |
SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED); |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
51 |
SetDParam(2, v->max_age / 366); |
7002
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
52 |
SetDParam(3, ShipVehInfo(v->engine_type)->running_cost * _price.ship_running >> 8); |
0 | 53 |
DrawString(2, 15, STR_9812_AGE_RUNNING_COST_YR, 0); |
54 |
} |
|
55 |
||
56 |
/* Draw max speed */ |
|
57 |
{ |
|
7219
46fcc725cad3
(svn r10497) -Fix (FS#1013,r8464): Ship max speed wrongly shown (benc)
peter1138
parents:
7134
diff
changeset
|
58 |
SetDParam(0, v->max_speed * 10 / 32); |
0 | 59 |
DrawString(2, 25, STR_9813_MAX_SPEED, 0); |
60 |
} |
|
61 |
||
62 |
/* Draw profit */ |
|
63 |
{ |
|
7002
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
64 |
SetDParam(0, v->profit_this_year); |
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
65 |
SetDParam(1, v->profit_last_year); |
0 | 66 |
DrawString(2, 35, STR_9814_PROFIT_THIS_YEAR_LAST_YEAR, 0); |
67 |
} |
|
68 |
||
69 |
/* Draw breakdown & reliability */ |
|
70 |
{ |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
71 |
SetDParam(0, v->reliability * 100 >> 16); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
72 |
SetDParam(1, v->breakdowns_since_last_service); |
0 | 73 |
DrawString(2, 45, STR_9815_RELIABILITY_BREAKDOWNS, 0); |
74 |
} |
|
75 |
||
76 |
/* Draw service interval text */ |
|
77 |
{ |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
78 |
SetDParam(0, v->service_interval); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
79 |
SetDParam(1, v->date_of_last_service); |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6420
diff
changeset
|
80 |
DrawString(13, 102, _patches.servint_ispercent ? STR_SERVICING_INTERVAL_PERCENT : STR_883C_SERVICING_INTERVAL_DAYS, 0); |
0 | 81 |
} |
82 |
||
83 |
DrawShipImage(v, 3, 57, INVALID_VEHICLE); |
|
84 |
||
7059
c6d12e3de0dc
(svn r10324) -Codechange: reference engine names by index
peter1138
parents:
7049
diff
changeset
|
85 |
SetDParam(0, v->engine_type); |
4329
0e6e689f66e7
(svn r6002) -Cleanup: remove the now redundant BASE_YEAR constant.
rubidium
parents:
4299
diff
changeset
|
86 |
SetDParam(1, v->build_year); |
7002
1bf6a62b0fcb
(svn r10258) -Codechange: as we are now using int64 all over the place, it's better to use int64 variables in the string generating too instead of packing them into two int32s.
rubidium
parents:
6991
diff
changeset
|
87 |
SetDParam(2, v->value); |
0 | 88 |
DrawString(74, 57, STR_9816_BUILT_VALUE, 0); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
89 |
|
4896
f86350aaaaa5
(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:
4793
diff
changeset
|
90 |
SetDParam(0, v->cargo_type); |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
91 |
SetDParam(1, v->cargo_cap); |
0 | 92 |
DrawString(74, 67, STR_9817_CAPACITY, 0); |
93 |
||
94 |
str = STR_8812_EMPTY; |
|
7010
6f0d9f03180d
(svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
rubidium
parents:
7002
diff
changeset
|
95 |
if (!v->cargo.Empty()) { |
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
96 |
SetDParam(0, v->cargo_type); |
7010
6f0d9f03180d
(svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
rubidium
parents:
7002
diff
changeset
|
97 |
SetDParam(1, v->cargo.Count()); |
6f0d9f03180d
(svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
rubidium
parents:
7002
diff
changeset
|
98 |
SetDParam(2, v->cargo.Source()); |
0 | 99 |
str = STR_8813_FROM; |
100 |
} |
|
101 |
DrawString(74, 78, str, 0); |
|
6198 | 102 |
|
103 |
/* Draw Transfer credits text */ |
|
7010
6f0d9f03180d
(svn r10266) -Codechange: keep track of the origin, time of travel and accumulated feeder share (transfers) of individual pieces of cargo. This means that cargo isn't thrown on a big pile when it's put in a station or unloaded at a station, however the GUI does not reflect these changes yet so you will not actually see it.
rubidium
parents:
7002
diff
changeset
|
104 |
SetDParam(0, v->cargo.FeederShare()); |
6198 | 105 |
DrawString(74, 89, STR_FEEDER_CARGO_VALUE, 0); |
106 |
||
1790
47963a0cfca3
(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:
1751
diff
changeset
|
107 |
} break; |
0 | 108 |
|
1790
47963a0cfca3
(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:
1751
diff
changeset
|
109 |
case WE_CLICK: { |
47963a0cfca3
(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:
1751
diff
changeset
|
110 |
int mod; |
47963a0cfca3
(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:
1751
diff
changeset
|
111 |
const Vehicle *v; |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
112 |
switch (e->we.click.widget) { |
0 | 113 |
case 2: /* rename */ |
1790
47963a0cfca3
(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:
1751
diff
changeset
|
114 |
v = GetVehicle(w->window_number); |
7049
0ebe47348074
(svn r10314) -Codechange: Refer to vehicle names by index
peter1138
parents:
7010
diff
changeset
|
115 |
SetDParam(0, v->index); |
0ebe47348074
(svn r10314) -Codechange: Refer to vehicle names by index
peter1138
parents:
7010
diff
changeset
|
116 |
ShowQueryString(STR_VEHICLE_NAME, STR_9831_NAME_SHIP, 31, 150, w, CS_ALPHANUMERAL); |
0 | 117 |
break; |
118 |
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
|
119 |
mod = _ctrl_pressed? 5 : 10; |
1790
47963a0cfca3
(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:
1751
diff
changeset
|
120 |
goto do_change_service_int; |
0 | 121 |
case 6: /* decrease int */ |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6420
diff
changeset
|
122 |
mod = _ctrl_pressed ? - 5 : -10; |
1790
47963a0cfca3
(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:
1751
diff
changeset
|
123 |
do_change_service_int: |
47963a0cfca3
(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:
1751
diff
changeset
|
124 |
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
|
125 |
|
1790
47963a0cfca3
(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:
1751
diff
changeset
|
126 |
mod = GetServiceIntervalClamped(mod + v->service_interval); |
47963a0cfca3
(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:
1751
diff
changeset
|
127 |
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
|
128 |
|
2819
f25fb6ee397f
(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
|
129 |
DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING)); |
0 | 130 |
break; |
131 |
} |
|
1790
47963a0cfca3
(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:
1751
diff
changeset
|
132 |
} break; |
0 | 133 |
|
2548
49c8a096033f
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2517
diff
changeset
|
134 |
case WE_ON_EDIT_TEXT: |
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
135 |
if (e->we.edittext.str[0] != '\0') { |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
136 |
_cmd_text = e->we.edittext.str; |
1820
d03c56850dc2
(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
|
137 |
DoCommandP(0, w->window_number, 0, NULL, |
d03c56850dc2
(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
|
138 |
CMD_NAME_VEHICLE | CMD_MSG(STR_9832_CAN_T_NAME_SHIP)); |
d03c56850dc2
(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
|
139 |
} |
2548
49c8a096033f
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2517
diff
changeset
|
140 |
break; |
0 | 141 |
} |
142 |
} |
|
143 |
||
144 |
||
145 |
static const Widget _ship_details_widgets[] = { |
|
4344
7e123fec5b0b
(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
|
146 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
7e123fec5b0b
(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
|
147 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 364, 0, 13, STR_9811_DETAILS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
7e123fec5b0b
(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
|
148 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 365, 404, 0, 13, STR_01AA_NAME, STR_982F_NAME_SHIP}, |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
149 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 404, 14, 55, 0x0, STR_NULL}, |
6198 | 150 |
{ WWT_PANEL, RESIZE_NONE, 14, 0, 404, 56, 100, 0x0, STR_NULL}, |
151 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 10, 101, 106, STR_0188, STR_884D_INCREASE_SERVICING_INTERVAL}, |
|
152 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 10, 107, 112, STR_0189, STR_884E_DECREASE_SERVICING_INTERVAL}, |
|
153 |
{ WWT_PANEL, RESIZE_NONE, 14, 11, 404, 101, 112, 0x0, STR_NULL}, |
|
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
154 |
{ WIDGETS_END}, |
0 | 155 |
}; |
156 |
||
157 |
static const WindowDesc _ship_details_desc = { |
|
6198 | 158 |
WDP_AUTO, WDP_AUTO, 405, 113, |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6420
diff
changeset
|
159 |
WC_VEHICLE_DETAILS, WC_VEHICLE_VIEW, |
0 | 160 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
161 |
_ship_details_widgets, |
|
162 |
ShipDetailsWndProc |
|
163 |
}; |
|
164 |
||
4171 | 165 |
static void ShowShipDetailsWindow(const Vehicle *v) |
0 | 166 |
{ |
167 |
Window *w; |
|
168 |
VehicleID veh = v->index; |
|
2639 | 169 |
|
0 | 170 |
DeleteWindowById(WC_VEHICLE_ORDERS, veh); |
171 |
DeleteWindowById(WC_VEHICLE_DETAILS, veh); |
|
5071
e28106dfcb6f
(svn r7129) -Codechange: Get rid of a global variable that only sets a window's number.
Darkvater
parents:
5070
diff
changeset
|
172 |
w = AllocateWindowDescFront(&_ship_details_desc, veh); |
0 | 173 |
w->caption_color = v->owner; |
174 |
} |
|
175 |
||
1977
37bbebf94434
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
176 |
void CcBuildShip(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 177 |
{ |
4171 | 178 |
const Vehicle *v; |
0 | 179 |
if (!success) return; |
180 |
||
3948
a09379beffd5
(svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough.
tron
parents:
3887
diff
changeset
|
181 |
v = GetVehicle(_new_vehicle_id); |
0 | 182 |
if (v->tile == _backup_orders_tile) { |
183 |
_backup_orders_tile = 0; |
|
184 |
RestoreVehicleOrders(v, _backup_orders_data); |
|
185 |
} |
|
186 |
ShowShipViewWindow(v); |
|
187 |
} |
|
188 |
||
3887
ece644bbf459
(svn r4943) uint tile -> TileIndex tile, byte player -> PlayerID player
tron
parents:
3884
diff
changeset
|
189 |
void CcCloneShip(bool success, TileIndex tile, uint32 p1, uint32 p2) |
2244 | 190 |
{ |
3948
a09379beffd5
(svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough.
tron
parents:
3887
diff
changeset
|
191 |
if (success) ShowShipViewWindow(GetVehicle(_new_vehicle_id)); |
2244 | 192 |
} |
193 |
||
4171 | 194 |
static void ShipViewWndProc(Window *w, WindowEvent *e) |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
195 |
{ |
2952 | 196 |
switch (e->event) { |
2244 | 197 |
case WE_PAINT: { |
198 |
Vehicle *v = GetVehicle(w->window_number); |
|
199 |
StringID str; |
|
4779
6b3663047652
(svn r6693) -Fix: [ship view window] disable the refit button when the ship is not refitable or not stopped in a depot
bjarni
parents:
4734
diff
changeset
|
200 |
bool refitable_and_stopped_in_depot = ShipVehInfo(v->engine_type)->refittable && IsShipInDepotStopped(v); |
5078
b9fb462c82f2
(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)
glx
parents:
5071
diff
changeset
|
201 |
bool is_localplayer = v->owner == _local_player; |
0 | 202 |
|
5078
b9fb462c82f2
(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)
glx
parents:
5071
diff
changeset
|
203 |
SetWindowWidgetDisabledState(w, 7, !is_localplayer); |
b9fb462c82f2
(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)
glx
parents:
5071
diff
changeset
|
204 |
SetWindowWidgetDisabledState(w, 8, |
b9fb462c82f2
(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)
glx
parents:
5071
diff
changeset
|
205 |
!is_localplayer || // Disable if owner is not local player |
4779
6b3663047652
(svn r6693) -Fix: [ship view window] disable the refit button when the ship is not refitable or not stopped in a depot
bjarni
parents:
4734
diff
changeset
|
206 |
!refitable_and_stopped_in_depot); // Disable if the ship is not refitable or stopped in a depot |
5078
b9fb462c82f2
(svn r7142) -Fix: disable clone button in vehicle view for not owned vehicles (was already done for trains)
glx
parents:
5071
diff
changeset
|
207 |
SetWindowWidgetDisabledState(w, 11, !is_localplayer); |
0 | 208 |
|
2244 | 209 |
/* draw widgets & caption */ |
7049
0ebe47348074
(svn r10314) -Codechange: Refer to vehicle names by index
peter1138
parents:
7010
diff
changeset
|
210 |
SetDParam(0, v->index); |
2244 | 211 |
DrawWindowWidgets(w); |
0 | 212 |
|
2244 | 213 |
if (v->breakdown_ctr == 1) { |
214 |
str = STR_885C_BROKEN_DOWN; |
|
215 |
} else if (v->vehstatus & VS_STOPPED) { |
|
216 |
str = STR_8861_STOPPED; |
|
217 |
} else { |
|
218 |
switch (v->current_order.type) { |
|
219 |
case OT_GOTO_STATION: { |
|
4527
fa30d19685c2
(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
|
220 |
SetDParam(0, v->current_order.dest); |
5874
2db89a640b7a
(svn r8464) -Revert (r4322): Change back to converting to mph in the GUI code, as 1 mph == 1.6 km/h is too far out for some people.
peter1138
parents:
5783
diff
changeset
|
221 |
SetDParam(1, v->cur_speed * 10 / 32); |
2244 | 222 |
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed; |
223 |
} break; |
|
0 | 224 |
|
2244 | 225 |
case OT_GOTO_DEPOT: { |
4527
fa30d19685c2
(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
|
226 |
Depot *depot = GetDepot(v->current_order.dest); |
2244 | 227 |
SetDParam(0, depot->town_index); |
5874
2db89a640b7a
(svn r8464) -Revert (r4322): Change back to converting to mph in the GUI code, as 1 mph == 1.6 km/h is too far out for some people.
peter1138
parents:
5783
diff
changeset
|
228 |
SetDParam(1, v->cur_speed * 10 / 32); |
4633
cf6c2f173030
(svn r6497) -Fix r6165: Vehicles heading for depots when their orders contained "service in depot" displayed the stopping in depot string
bjarni
parents:
4592
diff
changeset
|
229 |
if (HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT) && !HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS)) { |
4412
cae52239a576
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
230 |
str = STR_HEADING_FOR_SHIP_DEPOT + _patches.vehicle_speed; |
cae52239a576
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
231 |
} else { |
cae52239a576
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
232 |
str = STR_HEADING_FOR_SHIP_DEPOT_SERVICE + _patches.vehicle_speed; |
cae52239a576
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
233 |
} |
2244 | 234 |
} break; |
235 |
||
236 |
case OT_LOADING: |
|
237 |
case OT_LEAVESTATION: |
|
238 |
str = STR_882F_LOADING_UNLOADING; |
|
239 |
break; |
|
2261
d3554e5d3e86
(svn r2781) Fix some of the issues with variables in .h files.
ludde
parents:
2252
diff
changeset
|
240 |
|
2244 | 241 |
default: |
242 |
if (v->num_orders == 0) { |
|
243 |
str = STR_NO_ORDERS + _patches.vehicle_speed; |
|
5874
2db89a640b7a
(svn r8464) -Revert (r4322): Change back to converting to mph in the GUI code, as 1 mph == 1.6 km/h is too far out for some people.
peter1138
parents:
5783
diff
changeset
|
244 |
SetDParam(0, v->cur_speed * 10 / 32); |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
245 |
} else { |
2244 | 246 |
str = STR_EMPTY; |
4077
d4d440dd8925
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
247 |
} |
2244 | 248 |
break; |
249 |
} |
|
0 | 250 |
} |
251 |
||
2103
a2b3106d33d5
(svn r2613) - Truncate savegames, and vehicle-texts in their window.
Darkvater
parents:
2084
diff
changeset
|
252 |
/* draw the flag plus orders */ |
5668
36b39f4a9032
(svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents:
5584
diff
changeset
|
253 |
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, PAL_NONE, 2, w->widget[5].top + 1); |
2113
be2f07df0dfa
(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
|
254 |
DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0); |
0 | 255 |
DrawWindowViewport(w); |
256 |
} break; |
|
257 |
||
2244 | 258 |
case WE_CLICK: { |
4171 | 259 |
const Vehicle *v = GetVehicle(w->window_number); |
0 | 260 |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
261 |
switch (e->we.click.widget) { |
2244 | 262 |
case 5: /* start stop */ |
263 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_SHIP | CMD_MSG(STR_9818_CAN_T_STOP_START_SHIP)); |
|
264 |
break; |
|
265 |
case 6: /* center main view */ |
|
266 |
ScrollMainWindowTo(v->x_pos, v->y_pos); |
|
267 |
break; |
|
268 |
case 7: /* goto hangar */ |
|
4506
e6a56518135c
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4456
diff
changeset
|
269 |
DoCommandP(v->tile, v->index, _ctrl_pressed ? DEPOT_SERVICE : 0, NULL, CMD_SEND_SHIP_TO_DEPOT | CMD_MSG(STR_9819_CAN_T_SEND_SHIP_TO_DEPOT)); |
2244 | 270 |
break; |
271 |
case 8: /* refit */ |
|
4712
4335ad42e163
(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
|
272 |
ShowVehicleRefitWindow(v, INVALID_VEH_ORDER_ID); |
2244 | 273 |
break; |
274 |
case 9: /* show orders */ |
|
275 |
ShowOrdersWindow(v); |
|
276 |
break; |
|
277 |
case 10: /* show details */ |
|
278 |
ShowShipDetailsWindow(v); |
|
279 |
break; |
|
280 |
case 11: { |
|
281 |
/* clone vehicle */ |
|
282 |
DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneShip, CMD_CLONE_VEHICLE | CMD_MSG(STR_980D_CAN_T_BUILD_SHIP)); |
|
283 |
} break; |
|
284 |
} |
|
285 |
} break; |
|
286 |
||
287 |
case WE_RESIZE: |
|
4634
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
288 |
w->viewport->width += e->we.sizing.diff.x; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
289 |
w->viewport->height += e->we.sizing.diff.y; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
290 |
w->viewport->virtual_width += e->we.sizing.diff.x; |
07699ac2bf37
(svn r6499) -Codechange: Finally, got "byte event" outside of the union WindowEvent, which is now a struct
belugas
parents:
4633
diff
changeset
|
291 |
w->viewport->virtual_height += e->we.sizing.diff.y; |
0 | 292 |
break; |
293 |
||
2244 | 294 |
case WE_DESTROY: |
295 |
DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number); |
|
296 |
DeleteWindowById(WC_VEHICLE_REFIT, w->window_number); |
|
297 |
DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number); |
|
7063
fbaa8de982dd
(svn r10328) -Codechange: Close the timetable window when closing the vehicle window.
maedhros
parents:
7059
diff
changeset
|
298 |
DeleteWindowById(WC_VEHICLE_TIMETABLE, w->window_number); |
2244 | 299 |
break; |
1485
34545d21c656
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
300 |
|
4702
c79e9d9f27b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
301 |
case WE_MOUSELOOP: { |
4171 | 302 |
const Vehicle *v = GetVehicle(w->window_number); |
4702
c79e9d9f27b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
303 |
bool ship_stopped = IsShipInDepotStopped(v); |
4000
4009d092b306
(svn r5210) Many small changes which piled up: const, unsigned, variable scope, CSE for readability, DeMorgan, if cascades -> switch, whitespace, parentheses, bracing, misc.
tron
parents:
3989
diff
changeset
|
304 |
|
4702
c79e9d9f27b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
305 |
/* Widget 7 (send to depot) must be hidden if the ship is already stopped in depot. |
c79e9d9f27b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
306 |
* Widget 11 (clone) should then be shown, since cloning is allowed only while in depot and stopped. |
c79e9d9f27b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
307 |
* This sytem allows to have two buttons, on top of each otherother*/ |
c79e9d9f27b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
308 |
if (ship_stopped != IsWindowWidgetHidden(w, 7) || ship_stopped == IsWindowWidgetHidden(w, 11)) { |
c79e9d9f27b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
309 |
SetWindowWidgetHiddenState(w, 7, ship_stopped); // send to depot |
c79e9d9f27b3
(svn r6612) -Codechange: Use accessors for hidden_state.
belugas
parents:
4668
diff
changeset
|
310 |
SetWindowWidgetHiddenState(w, 11, !ship_stopped); // clone |
2244 | 311 |
SetWindowDirty(w); |
312 |
} |
|
313 |
} |
|
0 | 314 |
} |
315 |
} |
|
316 |
||
317 |
static const Widget _ship_view_widgets[] = { |
|
4939
bef7c24a6027
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
318 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
bef7c24a6027
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
319 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 237, 0, 13, STR_980F, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
bef7c24a6027
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
320 |
{ WWT_STICKYBOX, RESIZE_LR, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON}, |
bef7c24a6027
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
321 |
{ WWT_PANEL, RESIZE_RB, 14, 0, 231, 14, 103, 0x0, STR_NULL}, |
bef7c24a6027
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
322 |
{ WWT_INSET, RESIZE_RB, 14, 2, 229, 16, 101, 0x0, STR_NULL}, |
4938
0447845fd1b3
(svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents:
4937
diff
changeset
|
323 |
{ WWT_PUSHBTN, RESIZE_RTB, 14, 0, 237, 104, 115, 0x0, STR_9827_CURRENT_SHIP_ACTION_CLICK}, |
4937
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4932
diff
changeset
|
324 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 14, 31, SPR_CENTRE_VIEW_VEHICLE, STR_9829_CENTER_MAIN_VIEW_ON_SHIP}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4932
diff
changeset
|
325 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, SPR_SEND_SHIP_TODEPOT, STR_982A_SEND_SHIP_TO_DEPOT}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4932
diff
changeset
|
326 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 50, 67, SPR_REFIT_VEHICLE, STR_983A_REFIT_CARGO_SHIP_TO_CARRY}, |
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4932
diff
changeset
|
327 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 68, 85, SPR_SHOW_ORDERS, STR_9828_SHOW_SHIP_S_ORDERS}, |
6491
00dc414c909d
(svn r9672) -Cleanup: lots of coding style fixes around operands.
rubidium
parents:
6420
diff
changeset
|
328 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 86, 103, SPR_SHOW_VEHICLE_DETAILS, STR_982B_SHOW_SHIP_DETAILS}, |
4937
8cfdd86fd709
(svn r6924) -Codechange: Give the last (in the widget arrays at least) sprites meaningful names.
Darkvater
parents:
4932
diff
changeset
|
329 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, SPR_CLONE_SHIP, STR_CLONE_SHIP_INFO}, |
4939
bef7c24a6027
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
330 |
{ WWT_PANEL, RESIZE_LRB, 14, 232, 249, 104, 103, 0x0, STR_NULL }, |
bef7c24a6027
(svn r6926) -Codechange: Rename WWT_4 to WWT_TEXTBTN_2 and WWT_6 to WWT_INSET (credits to peter1138
Darkvater
parents:
4938
diff
changeset
|
331 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 238, 249, 104, 115, 0x0, STR_NULL }, |
1485
34545d21c656
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
332 |
{ WIDGETS_END } |
0 | 333 |
}; |
334 |
||
335 |
static const WindowDesc _ship_view_desc = { |
|
5070
7f5b13b7e728
(svn r7128) -Codechange: Replace magic numbers by magic enums (windowdesc positioning WDP_AUTO = -1)
Darkvater
parents:
4939
diff
changeset
|
336 |
WDP_AUTO, WDP_AUTO, 250, 116, |
5893
7e431a4abebb
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents:
5874
diff
changeset
|
337 |
WC_VEHICLE_VIEW, WC_NONE, |
1485
34545d21c656
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
338 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
0 | 339 |
_ship_view_widgets, |
340 |
ShipViewWndProc |
|
341 |
}; |
|
342 |
||
4171 | 343 |
void ShowShipViewWindow(const Vehicle *v) |
0 | 344 |
{ |
4171 | 345 |
Window *w = AllocateWindowDescFront(&_ship_view_desc, v->index); |
0 | 346 |
|
2561
233dafd7cf6c
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
347 |
if (w != NULL) { |
0 | 348 |
w->caption_color = v->owner; |
6624
880e29b1f25e
(svn r9844) -Codechange: replace zoomlevel with an enum
truelight
parents:
6491
diff
changeset
|
349 |
AssignWindowViewport(w, 3, 17, 0xE2, 0x54, w->window_number | (1 << 31), ZOOM_LVL_SHIP); |
0 | 350 |
} |
351 |
} |