author | tron |
Wed, 27 Jul 2005 19:22:38 +0000 | |
changeset 2207 | be1ef1e1fc58 |
parent 2186 | db48cf29b983 |
child 2218 | 2132596a35c0 |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
862800791170
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1095
diff
changeset
|
4 |
#include "openttd.h" |
507
04b5403aaf6b
(svn r815) Include strings.h only in the files which need it.
tron
parents:
460
diff
changeset
|
5 |
#include "table/strings.h" |
2163
b17b313113a0
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
6 |
#include "functions.h" |
0 | 7 |
#include "window.h" |
8 |
#include "gui.h" |
|
9 |
#include "viewport.h" |
|
10 |
#include "gfx.h" |
|
11 |
#include "engine.h" |
|
12 |
#include "command.h" |
|
13 |
#include "news.h" |
|
2159
f6284cf5fab0
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2084
diff
changeset
|
14 |
#include "variables.h" |
0 | 15 |
|
16 |
||
1095 | 17 |
static StringID GetEngineCategoryName(byte engine) |
0 | 18 |
{ |
460
7506c66ce4c3
(svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents:
193
diff
changeset
|
19 |
if (engine < NUM_TRAIN_ENGINES) { |
1926
530480d14685
(svn r2432) Use GetEngine() instead of DEREF_ENGINE() or even _engines[]
tron
parents:
1891
diff
changeset
|
20 |
switch (GetEngine(engine)->railtype) { |
460
7506c66ce4c3
(svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents:
193
diff
changeset
|
21 |
case 0: |
7506c66ce4c3
(svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents:
193
diff
changeset
|
22 |
return STR_8102_RAILROAD_LOCOMOTIVE; |
7506c66ce4c3
(svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents:
193
diff
changeset
|
23 |
case 1: |
7506c66ce4c3
(svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents:
193
diff
changeset
|
24 |
return STR_8106_MONORAIL_LOCOMOTIVE; |
7506c66ce4c3
(svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents:
193
diff
changeset
|
25 |
case 2: |
7506c66ce4c3
(svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents:
193
diff
changeset
|
26 |
return STR_8107_MAGLEV_LOCOMOTIVE; |
7506c66ce4c3
(svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents:
193
diff
changeset
|
27 |
} |
7506c66ce4c3
(svn r677) -newgrf: Fix some custom electric trains appearing in maglev depots (pasky).
darkvater
parents:
193
diff
changeset
|
28 |
} |
0 | 29 |
|
30 |
if (engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES) |
|
31 |
return STR_8103_ROAD_VEHICLE; |
|
32 |
||
33 |
if (engine < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES) |
|
34 |
return STR_8105_SHIP; |
|
35 |
||
36 |
return STR_8104_AIRCRAFT; |
|
37 |
} |
|
38 |
||
39 |
static const Widget _engine_preview_widgets[] = { |
|
867
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
40 |
{ WWT_TEXTBTN, RESIZE_NONE, 5, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
41 |
{ WWT_CAPTION, RESIZE_NONE, 5, 11, 299, 0, 13, STR_8100_MESSAGE_FROM_VEHICLE_MANUFACTURE, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
42 |
{ WWT_IMGBTN, RESIZE_NONE, 5, 0, 299, 14, 191, 0x0, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
43 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 5, 85, 144, 172, 183, STR_00C9_NO, STR_NULL}, |
dffd33233237
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
534
diff
changeset
|
44 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 5, 155, 214, 172, 183, STR_00C8_YES, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
0
diff
changeset
|
45 |
{ WIDGETS_END}, |
0 | 46 |
}; |
47 |
||
48 |
typedef void DrawEngineProc(int x, int y, int engine, uint32 image_ormod); |
|
49 |
typedef void DrawEngineInfoProc(int x, int y, int engine, int maxw); |
|
50 |
||
51 |
typedef struct DrawEngineInfo { |
|
52 |
DrawEngineProc *engine_proc; |
|
53 |
DrawEngineInfoProc *info_proc; |
|
54 |
} DrawEngineInfo; |
|
55 |
||
1998
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
56 |
static void DrawTrainEngineInfo(int engine, int x, int y, int maxw); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
57 |
static void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
58 |
static void DrawShipEngineInfo(int engine, int x, int y, int maxw); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
59 |
static void DrawAircraftEngineInfo(int engine, int x, int y, int maxw); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
60 |
|
0 | 61 |
static const DrawEngineInfo _draw_engine_list[4] = { |
62 |
{DrawTrainEngine,DrawTrainEngineInfo}, |
|
63 |
{DrawRoadVehEngine,DrawRoadVehEngineInfo}, |
|
64 |
{DrawShipEngine,DrawShipEngineInfo}, |
|
65 |
{DrawAircraftEngine,DrawAircraftEngineInfo}, |
|
66 |
}; |
|
67 |
||
68 |
static void EnginePreviewWndProc(Window *w, WindowEvent *e) |
|
69 |
{ |
|
70 |
byte eng; |
|
71 |
int engine; |
|
72 |
const DrawEngineInfo *dei; |
|
73 |
int width; |
|
74 |
||
75 |
switch(e->event) { |
|
76 |
case WE_PAINT: |
|
77 |
DrawWindowWidgets(w); |
|
78 |
engine = w->window_number; |
|
79 |
||
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
80 |
SetDParam(0, GetEngineCategoryName(engine)); |
0 | 81 |
DrawStringMultiCenter(150, 44, STR_8101_WE_HAVE_JUST_DESIGNED_A, 296); |
82 |
||
83 |
DrawStringCentered(w->width >> 1, 80, GetCustomEngineName(engine), 0x10); |
|
84 |
||
85 |
eng = (byte)engine; |
|
86 |
(dei = _draw_engine_list,eng < NUM_TRAIN_ENGINES) || |
|
87 |
(dei++,eng < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES) || |
|
88 |
(dei++,eng < NUM_TRAIN_ENGINES + NUM_ROAD_ENGINES + NUM_SHIP_ENGINES) || |
|
89 |
(dei++, true); |
|
90 |
||
91 |
width = w->width; |
|
92 |
dei->engine_proc(width >> 1, 100, engine, 0); |
|
93 |
dei->info_proc(engine, width >> 1, 130, width - 52); |
|
94 |
break; |
|
95 |
||
96 |
case WE_CLICK: |
|
97 |
switch(e->click.widget) { |
|
98 |
case 3: DeleteWindow(w); break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
99 |
case 4: |
0 | 100 |
DoCommandP(0, w->window_number, 0, NULL, CMD_WANT_ENGINE_PREVIEW); |
101 |
DeleteWindow(w); |
|
102 |
break; |
|
103 |
} |
|
104 |
break; |
|
105 |
} |
|
106 |
} |
|
107 |
||
108 |
static const WindowDesc _engine_preview_desc = { |
|
109 |
WDP_CENTER, WDP_CENTER, 300, 192, |
|
110 |
WC_ENGINE_PREVIEW,0, |
|
111 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET, |
|
112 |
_engine_preview_widgets, |
|
113 |
EnginePreviewWndProc |
|
114 |
}; |
|
115 |
||
116 |
||
117 |
void ShowEnginePreviewWindow(int engine) |
|
118 |
{ |
|
119 |
Window *w; |
|
120 |
||
121 |
w = AllocateWindowDesc(&_engine_preview_desc); |
|
122 |
w->window_number = engine; |
|
123 |
} |
|
124 |
||
1998
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
125 |
static void DrawTrainEngineInfo(int engine, int x, int y, int maxw) |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
126 |
{ |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
127 |
const RailVehicleInfo *rvi = RailVehInfo(engine); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
128 |
int cap; |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
129 |
uint multihead = (rvi->flags & RVI_MULTIHEAD) ? 1 : 0; |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
130 |
|
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
131 |
SetDParam(0, (_price.build_railvehicle >> 3) * rvi->base_cost >> 5); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
132 |
SetDParam(2, rvi->max_speed * 10 >> 4); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
133 |
SetDParam(3, rvi->power << multihead); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
134 |
SetDParam(1, rvi->weight << multihead); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
135 |
|
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
136 |
SetDParam(4, rvi->running_cost_base * _price.running_rail[rvi->engclass] >> 8 << multihead); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
137 |
|
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
138 |
cap = rvi->capacity; |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
139 |
SetDParam(5, STR_8838_N_A); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
140 |
if (cap != 0) { |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
141 |
SetDParam(6, cap << multihead); |
2084
65639f898a50
(svn r2594) Fix: [strgen] Misc updates to the string system.
ludde
parents:
1998
diff
changeset
|
142 |
SetDParam(5, _cargoc.names_long[rvi->cargo_type]); |
1998
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
143 |
} |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
144 |
DrawStringMultiCenter(x, y, STR_885B_COST_WEIGHT_T_SPEED_POWER, maxw); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
145 |
} |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
146 |
|
0 | 147 |
void DrawNewsNewTrainAvail(Window *w) |
148 |
{ |
|
149 |
int engine; |
|
150 |
||
151 |
DrawNewsBorder(w); |
|
152 |
||
153 |
engine = WP(w,news_d).ni->string_id; |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
154 |
SetDParam(0, GetEngineCategoryName(engine)); |
0 | 155 |
DrawStringMultiCenter(w->width >> 1, 20, STR_8859_NEW_NOW_AVAILABLE, w->width - 2); |
156 |
||
157 |
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10); |
|
158 |
||
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
159 |
SetDParam(0, GetCustomEngineName(engine)); |
0 | 160 |
DrawStringMultiCenter(w->width >> 1, 57, STR_885A, w->width - 2); |
161 |
||
162 |
DrawTrainEngine(w->width >> 1, 88, engine, 0); |
|
163 |
GfxFillRect(25, 56, w->width - 56, 112, 0x4323); |
|
164 |
DrawTrainEngineInfo(engine, w->width >> 1, 129, w->width - 52); |
|
165 |
} |
|
166 |
||
167 |
StringID GetNewsStringNewTrainAvail(NewsItem *ni) |
|
168 |
{ |
|
169 |
int engine = ni->string_id; |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
170 |
SetDParam(0, STR_8859_NEW_NOW_AVAILABLE); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
171 |
SetDParam(1, GetEngineCategoryName(engine)); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
172 |
SetDParam(2, GetCustomEngineName(engine)); |
0 | 173 |
return STR_02B6; |
174 |
} |
|
175 |
||
1998
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
176 |
static void DrawAircraftEngineInfo(int engine, int x, int y, int maxw) |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
177 |
{ |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
178 |
const AircraftVehicleInfo *avi = AircraftVehInfo(engine); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
179 |
SetDParam(0, (_price.aircraft_base >> 3) * avi->base_cost >> 5); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
180 |
SetDParam(1, avi->max_speed << 3); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
181 |
SetDParam(2, avi->passenger_capacity); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
182 |
SetDParam(3, avi->mail_capacity); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
183 |
SetDParam(4, avi->running_cost * _price.aircraft_running >> 8); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
184 |
|
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
185 |
DrawStringMultiCenter(x, y, STR_A02E_COST_MAX_SPEED_CAPACITY, maxw); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
186 |
} |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
187 |
|
0 | 188 |
void DrawNewsNewAircraftAvail(Window *w) |
189 |
{ |
|
190 |
int engine; |
|
191 |
||
192 |
DrawNewsBorder(w); |
|
193 |
||
194 |
engine = WP(w,news_d).ni->string_id; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
195 |
|
0 | 196 |
DrawStringMultiCenter(w->width >> 1, 20, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE, w->width - 2); |
197 |
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10); |
|
198 |
||
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
199 |
SetDParam(0, GetCustomEngineName(engine)); |
0 | 200 |
DrawStringMultiCenter(w->width >> 1, 57, STR_A02D, w->width - 2); |
201 |
||
202 |
DrawAircraftEngine(w->width >> 1, 93, engine, 0); |
|
203 |
GfxFillRect(25, 56, w->width - 56, 110, 0x4323); |
|
204 |
DrawAircraftEngineInfo(engine, w->width >> 1, 131, w->width - 52); |
|
205 |
} |
|
206 |
||
207 |
StringID GetNewsStringNewAircraftAvail(NewsItem *ni) |
|
208 |
{ |
|
209 |
int engine = ni->string_id; |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
210 |
SetDParam(0, STR_A02C_NEW_AIRCRAFT_NOW_AVAILABLE); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
211 |
SetDParam(1, GetCustomEngineName(engine)); |
0 | 212 |
return STR_02B6; |
213 |
} |
|
214 |
||
1998
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
215 |
static void DrawRoadVehEngineInfo(int engine, int x, int y, int maxw) |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
216 |
{ |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
217 |
const RoadVehicleInfo *rvi = RoadVehInfo(engine); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
218 |
|
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
219 |
SetDParam(0, (_price.roadveh_base >> 3) * rvi->base_cost >> 5); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
220 |
SetDParam(1, rvi->max_speed * 10 >> 5); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
221 |
SetDParam(2, rvi->running_cost * _price.roadveh_running >> 8); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
222 |
|
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
223 |
SetDParam(4, rvi->capacity); |
2084
65639f898a50
(svn r2594) Fix: [strgen] Misc updates to the string system.
ludde
parents:
1998
diff
changeset
|
224 |
SetDParam(3, _cargoc.names_long[rvi->cargo_type]); |
1998
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
225 |
|
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
226 |
DrawStringMultiCenter(x, y, STR_902A_COST_SPEED_RUNNING_COST, maxw); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
227 |
} |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
228 |
|
0 | 229 |
void DrawNewsNewRoadVehAvail(Window *w) |
230 |
{ |
|
231 |
int engine; |
|
232 |
||
233 |
DrawNewsBorder(w); |
|
234 |
||
235 |
engine = WP(w,news_d).ni->string_id; |
|
236 |
DrawStringMultiCenter(w->width >> 1, 20, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE, w->width - 2); |
|
237 |
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10); |
|
238 |
||
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
239 |
SetDParam(0, GetCustomEngineName(engine)); |
0 | 240 |
DrawStringMultiCenter(w->width >> 1, 57, STR_9029, w->width - 2); |
241 |
||
242 |
DrawRoadVehEngine(w->width >> 1, 88, engine, 0); |
|
243 |
GfxFillRect(25, 56, w->width - 56, 112, 0x4323); |
|
244 |
DrawRoadVehEngineInfo(engine, w->width >> 1, 129, w->width - 52); |
|
245 |
} |
|
246 |
||
247 |
StringID GetNewsStringNewRoadVehAvail(NewsItem *ni) |
|
248 |
{ |
|
249 |
int engine = ni->string_id; |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
250 |
SetDParam(0, STR_9028_NEW_ROAD_VEHICLE_NOW_AVAILABLE); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
251 |
SetDParam(1, GetCustomEngineName(engine)); |
0 | 252 |
return STR_02B6; |
253 |
} |
|
254 |
||
1998
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
255 |
static void DrawShipEngineInfo(int engine, int x, int y, int maxw) |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
256 |
{ |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
257 |
const ShipVehicleInfo *svi = ShipVehInfo(engine); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
258 |
SetDParam(0, svi->base_cost * (_price.ship_base >> 3) >> 5); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
259 |
SetDParam(1, svi->max_speed * 10 >> 5); |
2084
65639f898a50
(svn r2594) Fix: [strgen] Misc updates to the string system.
ludde
parents:
1998
diff
changeset
|
260 |
SetDParam(2, _cargoc.names_long[svi->cargo_type]); |
1998
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
261 |
SetDParam(3, svi->capacity); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
262 |
SetDParam(4, svi->running_cost * _price.ship_running >> 8); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
263 |
DrawStringMultiCenter(x, y, STR_982E_COST_MAX_SPEED_CAPACITY, maxw); |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
264 |
} |
23c42534e2a9
(svn r2504) Move Draw*EngineInfo to engine_gui.c to reduce dependencies
tron
parents:
1926
diff
changeset
|
265 |
|
0 | 266 |
void DrawNewsNewShipAvail(Window *w) |
267 |
{ |
|
268 |
int engine; |
|
269 |
||
270 |
DrawNewsBorder(w); |
|
271 |
||
272 |
engine = WP(w,news_d).ni->string_id; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
273 |
|
0 | 274 |
DrawStringMultiCenter(w->width >> 1, 20, STR_982C_NEW_SHIP_NOW_AVAILABLE, w->width - 2); |
275 |
GfxFillRect(25, 56, w->width - 25, w->height - 2, 10); |
|
276 |
||
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
277 |
SetDParam(0, GetCustomEngineName(engine)); |
0 | 278 |
DrawStringMultiCenter(w->width >> 1, 57, STR_982D, w->width - 2); |
279 |
||
280 |
DrawShipEngine(w->width >> 1, 93, engine, 0); |
|
281 |
GfxFillRect(25, 56, w->width - 56, 110, 0x4323); |
|
282 |
DrawShipEngineInfo(engine, w->width >> 1, 131, w->width - 52); |
|
283 |
} |
|
284 |
||
285 |
StringID GetNewsStringNewShipAvail(NewsItem *ni) |
|
286 |
{ |
|
287 |
int engine = ni->string_id; |
|
534
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
288 |
SetDParam(0, STR_982C_NEW_SHIP_NOW_AVAILABLE); |
306bc86eb23e
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
289 |
SetDParam(1, GetCustomEngineName(engine)); |
0 | 290 |
return STR_02B6; |
291 |
} |