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