author | Tero Marttila <terom@fixme.fi> |
Fri, 18 Jul 2008 22:41:08 +0300 | |
changeset 11177 | 6d9a43c48924 |
parent 11157 | a0173588b15e |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
10429
1b99254f9607
(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:
10222
diff
changeset
|
3 |
/** @file roadveh_gui.cpp GUI for road vehicles. */ |
6889
f7f6d9cb07a0
(svn r9523) -Cleanup: doxygen changes. Time to take care of "R"
belugas
parents:
6532
diff
changeset
|
4 |
|
0 | 5 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1820
diff
changeset
|
6 |
#include "openttd.h" |
1299
0a6510cc889b
(svn r1803) Move debugging stuff into files of it's own
tron
parents:
1294
diff
changeset
|
7 |
#include "debug.h" |
3959 | 8 |
#include "roadveh.h" |
0 | 9 |
#include "gui.h" |
8603
88c5ce6a5215
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8602
diff
changeset
|
10 |
#include "window_gui.h" |
8720
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
11 |
#include "viewport_func.h" |
4e60c30e2006
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8710
diff
changeset
|
12 |
#include "gfx_func.h" |
8612
6414fc21c2f3
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8610
diff
changeset
|
13 |
#include "command_func.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2113
diff
changeset
|
14 |
#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
|
15 |
#include "newgrf_engine.h" |
8610
17cc343a23dd
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8603
diff
changeset
|
16 |
#include "strings_func.h" |
8640
1e93b81e96d2
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8627
diff
changeset
|
17 |
#include "vehicle_func.h" |
8710
52015340050c
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8640
diff
changeset
|
18 |
#include "string_func.h" |
9280
9c03416d26b1
(svn r12488) -Codechange: split order.h into order_base.h and order_func.h.
rubidium
parents:
8760
diff
changeset
|
19 |
#include "order_func.h" |
0 | 20 |
|
8760
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8720
diff
changeset
|
21 |
#include "table/sprites.h" |
ce0891c412ce
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8720
diff
changeset
|
22 |
#include "table/strings.h" |
8026
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
23 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
24 |
void DrawRoadVehDetails(const Vehicle *v, int x, int y) |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
25 |
{ |
11066
942b9b820006
(svn r13623) -Codechange: only show the 'load' of articulated RV parts that have a capacity instead of showing 'empty' parts when a vehicle is completely full.
rubidium
parents:
10429
diff
changeset
|
26 |
uint y_offset = RoadVehHasArticPart(v) ? 15 : 0; |
8026
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
27 |
StringID str; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
28 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
29 |
SetDParam(0, v->engine_type); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
30 |
SetDParam(1, v->build_year); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
31 |
SetDParam(2, v->value); |
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8149
diff
changeset
|
32 |
DrawString(x, y + y_offset, STR_9011_BUILT_VALUE, TC_FROMSTRING); |
8026
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
33 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
34 |
if (RoadVehHasArticPart(v)) { |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
35 |
AcceptedCargo max_cargo; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
36 |
char capacity[512]; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
37 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
38 |
memset(max_cargo, 0, sizeof(max_cargo)); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
39 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
40 |
for (const Vehicle *u = v; u != NULL; u = u->Next()) { |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
41 |
max_cargo[u->cargo_type] += u->cargo_cap; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
42 |
} |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
43 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
44 |
GetString(capacity, STR_ARTICULATED_RV_CAPACITY, lastof(capacity)); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
45 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
46 |
bool first = true; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
47 |
for (CargoID i = 0; i < NUM_CARGO; i++) { |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
48 |
if (max_cargo[i] > 0) { |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
49 |
char buffer[128]; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
50 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
51 |
SetDParam(0, i); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
52 |
SetDParam(1, max_cargo[i]); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
53 |
GetString(buffer, STR_BARE_CARGO, lastof(buffer)); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
54 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
55 |
if (!first) strecat(capacity, ", ", lastof(capacity)); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
56 |
strecat(capacity, buffer, lastof(capacity)); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
57 |
first = false; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
58 |
} |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
59 |
} |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
60 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
61 |
SetDParamStr(0, capacity); |
11157
a0173588b15e
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium
parents:
11066
diff
changeset
|
62 |
DrawStringTruncated(x, y + 10 + y_offset, STR_JUST_RAW_STRING, TC_BLUE, 380 - x); |
8026
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
63 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
64 |
for (const Vehicle *u = v; u != NULL; u = u->Next()) { |
11066
942b9b820006
(svn r13623) -Codechange: only show the 'load' of articulated RV parts that have a capacity instead of showing 'empty' parts when a vehicle is completely full.
rubidium
parents:
10429
diff
changeset
|
65 |
if (u->cargo_cap == 0) continue; |
942b9b820006
(svn r13623) -Codechange: only show the 'load' of articulated RV parts that have a capacity instead of showing 'empty' parts when a vehicle is completely full.
rubidium
parents:
10429
diff
changeset
|
66 |
|
8026
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
67 |
str = STR_8812_EMPTY; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
68 |
if (!u->cargo.Empty()) { |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
69 |
SetDParam(0, u->cargo_type); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
70 |
SetDParam(1, u->cargo.Count()); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
71 |
SetDParam(2, u->cargo.Source()); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
72 |
str = STR_8813_FROM; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
73 |
} |
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8149
diff
changeset
|
74 |
DrawString(x, y + 21 + y_offset, str, TC_FROMSTRING); |
8026
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
75 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
76 |
y_offset += 11; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
77 |
} |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
78 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
79 |
y_offset -= 11; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
80 |
} else { |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
81 |
SetDParam(0, v->cargo_type); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
82 |
SetDParam(1, v->cargo_cap); |
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8149
diff
changeset
|
83 |
DrawString(x, y + 10 + y_offset, STR_9012_CAPACITY, TC_FROMSTRING); |
8026
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
84 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
85 |
str = STR_8812_EMPTY; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
86 |
if (!v->cargo.Empty()) { |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
87 |
SetDParam(0, v->cargo_type); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
88 |
SetDParam(1, v->cargo.Count()); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
89 |
SetDParam(2, v->cargo.Source()); |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
90 |
str = STR_8813_FROM; |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
91 |
} |
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8149
diff
changeset
|
92 |
DrawString(x, y + 21 + y_offset, str, TC_FROMSTRING); |
8026
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
93 |
} |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
94 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
95 |
/* Draw Transfer credits text */ |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
96 |
SetDParam(0, v->cargo.FeederShare()); |
8320
6ffad7a5d242
(svn r11374) -Codechange: Give meaning to the magical number that specifies the color of the text in a DrawString call.
belugas
parents:
8149
diff
changeset
|
97 |
DrawString(x, y + 33 + y_offset, STR_FEEDER_CARGO_VALUE, TC_FROMSTRING); |
8026
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
98 |
} |
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
99 |
|
269979f5319d
(svn r11049) -Codechange: unify a large part of the vehicle details window. Based on a patch by nycom.
rubidium
parents:
7988
diff
changeset
|
100 |
|
7353
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
101 |
static inline int RoadVehLengthToPixels(int length) |
0 | 102 |
{ |
7353
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
103 |
return (length * 28) / 8; |
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
104 |
} |
0 | 105 |
|
8640
1e93b81e96d2
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8627
diff
changeset
|
106 |
void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection, int count) |
7353
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
107 |
{ |
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
108 |
/* Road vehicle lengths are measured in eighths of the standard length, so |
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
109 |
* count is the number of standard vehicles that should be drawn. If it is |
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
110 |
* 0, we draw enough vehicles for 10 standard vehicle lengths. */ |
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
111 |
int max_length = (count == 0) ? 80 : count * 8; |
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
112 |
|
9324
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
113 |
/* Width of highlight box */ |
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
114 |
int highlight_w = 0; |
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
115 |
|
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
116 |
for (int dx = 0; v != NULL && dx < max_length ; v = v->Next()) { |
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
117 |
int width = v->u.road.cached_veh_length; |
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
118 |
|
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
119 |
if (dx + width > 0 && dx <= max_length) { |
7353
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
120 |
SpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v); |
7630
2cd754d7dfa4
(svn r10408) -Codechange: make GetImage a class method of Vehicle instead of Get(Aircraft|RoadVeh|Ship|Train)Image.
rubidium
parents:
7559
diff
changeset
|
121 |
DrawSprite(v->GetImage(DIR_W), pal, x + 14 + RoadVehLengthToPixels(dx), y + 6); |
7353
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
122 |
|
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
123 |
if (v->index == selection) { |
9324
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
124 |
/* Set the highlight position */ |
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
125 |
highlight_w = RoadVehLengthToPixels(width); |
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
126 |
} else if (_cursor.vehchain && highlight_w != 0) { |
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
127 |
highlight_w += RoadVehLengthToPixels(width); |
7353
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
128 |
} |
716c6dd9322a
(svn r10097) -Feature: Add support for articulated road vehicles, or callbacks 11 and 17 for
maedhros
parents:
7187
diff
changeset
|
129 |
} |
9324
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
130 |
|
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
131 |
dx += width; |
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
132 |
} |
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
133 |
|
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
134 |
if (highlight_w != 0) { |
bf9cc84b889d
(svn r12576) -Feature(tte) [FS#337]: highlight vehicle chain when dragging in the group and depot GUI if appropriate
smatz
parents:
9280
diff
changeset
|
135 |
DrawFrameRect(x - 1, y - 1, x - 1 + highlight_w, y + 12, 15, FR_BORDERONLY); |
0 | 136 |
} |
137 |
} |
|
138 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
139 |
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 140 |
{ |
4171 | 141 |
const Vehicle *v; |
0 | 142 |
|
143 |
if (!success) return; |
|
144 |
||
3948
95f9fa0ac551
(svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough.
tron
parents:
3887
diff
changeset
|
145 |
v = GetVehicle(_new_vehicle_id); |
0 | 146 |
if (v->tile == _backup_orders_tile) { |
147 |
_backup_orders_tile = 0; |
|
8149
eb78fb69096f
(svn r11184) -Codechange: cleanup the code related to backup orders.
rubidium
parents:
8026
diff
changeset
|
148 |
RestoreVehicleOrders(v); |
0 | 149 |
} |
7982
539e32cc37ce
(svn r10997) -Codechange: unify the vehicle view window. Patch by PhilSophus.
rubidium
parents:
7980
diff
changeset
|
150 |
ShowVehicleViewWindow(v); |
0 | 151 |
} |