author | bjarni |
Fri, 22 Sep 2006 23:13:12 +0000 | |
changeset 4633 | fae5d85ef53d |
parent 4547 | 9786a24c4102 |
child 4634 | 897461a3e9ca |
permissions | -rw-r--r-- |
2186 | 1 |
/* $Id$ */ |
2 |
||
0 | 3 |
#include "stdafx.h" |
1891
92a3b0aa0946
(svn r2397) - CodeChange: rename all "ttd" files to "openttd" files.
Darkvater
parents:
1820
diff
changeset
|
4 |
#include "openttd.h" |
1299
0a6510cc889b
(svn r1803) Move debugging stuff into files of it's own
tron
parents:
1294
diff
changeset
|
5 |
#include "debug.h" |
2163
637ec3c361f5
(svn r2673) Include functions.h directly, not globally via openttd.h
tron
parents:
2159
diff
changeset
|
6 |
#include "functions.h" |
3959 | 7 |
#include "roadveh.h" |
1922
797081e56d13
(svn r2428) - Feature: [newgrf] Implement shorter train vehicles (Therax), and the callback that goes with it.
hackykid
parents:
1907
diff
changeset
|
8 |
#include "table/sprites.h" |
507
8aa8100b0b22
(svn r815) Include strings.h only in the files which need it.
tron
parents:
374
diff
changeset
|
9 |
#include "table/strings.h" |
679
e959706a3e4d
(svn r1117) Move map arrays and some related macros into their own files map.c and map.h
tron
parents:
671
diff
changeset
|
10 |
#include "map.h" |
0 | 11 |
#include "window.h" |
12 |
#include "gui.h" |
|
13 |
#include "gfx.h" |
|
14 |
#include "vehicle.h" |
|
15 |
#include "viewport.h" |
|
16 |
#include "station.h" |
|
17 |
#include "command.h" |
|
18 |
#include "player.h" |
|
19 |
#include "engine.h" |
|
1313
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1299
diff
changeset
|
20 |
#include "depot.h" |
2159
3b634157c3b2
(svn r2669) Shuffle some more stuff around to reduce dependencies
tron
parents:
2113
diff
changeset
|
21 |
#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
|
22 |
#include "newgrf_engine.h" |
4261
2ec8f5a9747b
(svn r5887) -Cleanup: move date related functions, defines and variables to date.[ch]
rubidium
parents:
4243
diff
changeset
|
23 |
#include "date.h" |
0 | 24 |
|
1907
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
25 |
/** |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
26 |
* Draw the purchase info details of road vehicle at a given location. |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
27 |
* @param x,y location where to draw the info |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
28 |
* @param engine_number the engine of which to draw the info of |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
29 |
*/ |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
30 |
void DrawRoadVehPurchaseInfo(int x, int y, EngineID engine_number) |
842 | 31 |
{ |
32 |
const RoadVehicleInfo *rvi = RoadVehInfo(engine_number); |
|
4171 | 33 |
const Engine *e = GetEngine(engine_number); |
3990
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
34 |
bool refittable = (_engine_info[engine_number].refit_mask != 0); |
842 | 35 |
YearMonthDay ymd; |
4288
60398d0e64ee
(svn r5918) -Cleanup: rename ConvertDayToYMD/ConvertYMDToDay as they really convert a Date to/from a YearMonthDay.
rubidium
parents:
4286
diff
changeset
|
36 |
ConvertDateToYMD(e->intro_date, &ymd); |
842 | 37 |
|
1907
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
38 |
/* Purchase cost - Max speed */ |
842 | 39 |
SetDParam(0, rvi->base_cost * (_price.roadveh_base>>3)>>5); |
3477
80c3465b38ee
(svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again.
peter1138
parents:
3431
diff
changeset
|
40 |
SetDParam(1, rvi->max_speed / 2); |
1907
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
41 |
DrawString(x, y, STR_PURCHASE_INFO_COST_SPEED, 0); |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
42 |
y += 10; |
842 | 43 |
|
1907
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
44 |
/* Running cost */ |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
45 |
SetDParam(0, rvi->running_cost * _price.roadveh_running >> 8); |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
46 |
DrawString(x, y, STR_PURCHASE_INFO_RUNNINGCOST, 0); |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
47 |
y += 10; |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
48 |
|
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
49 |
/* Cargo type + capacity */ |
2084
d67790a49f78
(svn r2594) Fix: [strgen] Misc updates to the string system.
ludde
parents:
1986
diff
changeset
|
50 |
SetDParam(0, _cargoc.names_long[rvi->cargo_type]); |
1907
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
51 |
SetDParam(1, rvi->capacity); |
3990
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
52 |
SetDParam(2, refittable ? STR_9842_REFITTABLE : STR_EMPTY); |
1907
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
53 |
DrawString(x, y, STR_PURCHASE_INFO_CAPACITY, 0); |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
54 |
y += 10; |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
55 |
|
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
56 |
/* Design date - Life length */ |
4293
2c24234a7aec
(svn r5926) -Codechange: make _cur_year contain the full year, instead of the offset since 1920
rubidium
parents:
4288
diff
changeset
|
57 |
SetDParam(0, ymd.year); |
1907
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
58 |
SetDParam(1, e->lifelength); |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
59 |
DrawString(x, y, STR_PURCHASE_INFO_DESIGNED_LIFE, 0); |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
60 |
y += 10; |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
61 |
|
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
62 |
/* Reliability */ |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
63 |
SetDParam(0, e->reliability * 100 >> 16); |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
64 |
DrawString(x, y, STR_PURCHASE_INFO_RELIABILITY, 0); |
cebdef7a1c8a
(svn r2413) - Codechange: Rewrite the displaying of purchase details a bit, make it easyer to add lines later.
hackykid
parents:
1906
diff
changeset
|
65 |
y += 10; |
4243
900826bcac92
(svn r5820) - NewGRF: Add support for extra vehicle text in the purchase list for road vehicles, aircraft and ships.
peter1138
parents:
4171
diff
changeset
|
66 |
|
900826bcac92
(svn r5820) - NewGRF: Add support for extra vehicle text in the purchase list for road vehicles, aircraft and ships.
peter1138
parents:
4171
diff
changeset
|
67 |
/* Additional text from NewGRF */ |
900826bcac92
(svn r5820) - NewGRF: Add support for extra vehicle text in the purchase list for road vehicles, aircraft and ships.
peter1138
parents:
4171
diff
changeset
|
68 |
// XXX 227 will become a calculated width... |
900826bcac92
(svn r5820) - NewGRF: Add support for extra vehicle text in the purchase list for road vehicles, aircraft and ships.
peter1138
parents:
4171
diff
changeset
|
69 |
y += ShowAdditionalText(x, y, 227, engine_number); |
842 | 70 |
} |
71 |
||
4442
8d8d0c2df7cb
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4434
diff
changeset
|
72 |
void DrawRoadVehImage(const Vehicle *v, int x, int y, VehicleID selection) |
0 | 73 |
{ |
3049
b797ca543c13
(svn r3631) - 2cc: Remove use of some temporary variables and perform minor optimization in the form of the ternary operator.
peter1138
parents:
3040
diff
changeset
|
74 |
PalSpriteID pal = (v->vehstatus & VS_CRASHED) ? PALETTE_CRASH : GetVehiclePalette(v); |
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
3049
diff
changeset
|
75 |
DrawSprite(GetRoadVehImage(v, DIR_W) | pal, x + 14, y + 6); |
0 | 76 |
|
77 |
if (v->index == selection) { |
|
2639 | 78 |
DrawFrameRect(x - 1, y - 1, x + 28, y + 12, 15, FR_BORDERONLY); |
0 | 79 |
} |
80 |
} |
|
81 |
||
3990
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
82 |
static void RoadVehRefitWndProc(Window *w, WindowEvent *e) |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
83 |
{ |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
84 |
switch (e->event) { |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
85 |
case WE_PAINT: { |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
86 |
const Vehicle *v = GetVehicle(w->window_number); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
87 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
88 |
SetDParam(0, v->string_id); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
89 |
SetDParam(1, v->unitnumber); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
90 |
DrawWindowWidgets(w); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
91 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
92 |
WP(w,refit_d).cargo = DrawVehicleRefitWindow(v, WP(w,refit_d).sel); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
93 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
94 |
if (WP(w,refit_d).cargo != CT_INVALID) { |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
95 |
int32 cost = DoCommand(v->tile, v->index, WP(w,refit_d).cargo, DC_QUERY_COST, CMD_REFIT_ROAD_VEH); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
96 |
if (!CmdFailed(cost)) { |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
97 |
SetDParam(0, _cargoc.names_long[WP(w,refit_d).cargo]); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
98 |
SetDParam(1, _returned_refit_capacity); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
99 |
SetDParam(2, cost); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
100 |
DrawString(1, 137, STR_9840_NEW_CAPACITY_COST_OF_REFIT, 0); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
101 |
} |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
102 |
} |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
103 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
104 |
break; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
105 |
} |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
106 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
107 |
case WE_CLICK: |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
108 |
switch (e->click.widget) { |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
109 |
case 2: { /* List box */ |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
110 |
int y = e->click.pt.y - 25; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
111 |
if (y >= 0) { |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
112 |
WP(w,refit_d).sel = y / 10; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
113 |
SetWindowDirty(w); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
114 |
} |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
115 |
break; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
116 |
} |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
117 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
118 |
case 4: /* Refit button */ |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
119 |
if (WP(w,refit_d).cargo != CT_INVALID) { |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
120 |
const Vehicle *v = GetVehicle(w->window_number); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
121 |
if (DoCommandP(v->tile, v->index, WP(w,refit_d).cargo, NULL, CMD_REFIT_ROAD_VEH | CMD_MSG(STR_REFIT_ROAD_VEHICLE_CAN_T))) |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
122 |
DeleteWindow(w); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
123 |
} |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
124 |
break; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
125 |
} |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
126 |
break; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
127 |
} |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
128 |
} |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
129 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
130 |
static const Widget _road_veh_refit_widgets[] = { |
4345
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
131 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
132 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 239, 0, 13, STR_983B_REFIT, STR_018C_WINDOW_TITLE_DRAG_THIS }, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
133 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 14, 135, 0x0, STR_983D_SELECT_TYPE_OF_CARGO_FOR }, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
134 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 239, 136, 157, 0x0, STR_NULL }, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
135 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 239, 158, 169, STR_REFIT_ROAD_VEHICLE, STR_REFIT_ROAD_VEHICLE_TO_CARRY_HIGHLIGHTED }, |
dd12549ad473
(svn r6046) CodeChange : Rename WWT_5 Widget type to WWT_LABEL : a centered label
belugas
parents:
4344
diff
changeset
|
136 |
{ WWT_LABEL, RESIZE_NONE, 0, 0, 239, 13, 26, STR_983F_SELECT_CARGO_TYPE_TO_CARRY, STR_NULL}, |
3990
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
137 |
{ WIDGETS_END }, |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
138 |
}; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
139 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
140 |
static const WindowDesc _road_veh_refit_desc = { |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
141 |
-1, -1, 240, 170, |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
142 |
WC_VEHICLE_REFIT, WC_VEHICLE_VIEW, |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
143 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
144 |
_road_veh_refit_widgets, |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
145 |
RoadVehRefitWndProc, |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
146 |
}; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
147 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
148 |
static void ShowRoadVehRefitWindow(const Vehicle *v) |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
149 |
{ |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
150 |
Window *w; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
151 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
152 |
DeleteWindowById(WC_VEHICLE_REFIT, v->index); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
153 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
154 |
_alloc_wnd_parent_num = v->index; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
155 |
w = AllocateWindowDesc(&_road_veh_refit_desc); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
156 |
w->window_number = v->index; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
157 |
w->caption_color = v->owner; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
158 |
WP(w,refit_d).sel = -1; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
159 |
} |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
160 |
|
0 | 161 |
static void RoadVehDetailsWndProc(Window *w, WindowEvent *e) |
162 |
{ |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
163 |
switch (e->event) { |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
164 |
case WE_PAINT: { |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
165 |
const Vehicle *v = GetVehicle(w->window_number); |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
166 |
StringID str; |
0 | 167 |
|
168 |
w->disabled_state = v->owner == _local_player ? 0 : (1 << 2); |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
169 |
// disable service-scroller when interval is set to disabled |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
170 |
if (!_patches.servint_roadveh) w->disabled_state |= (1 << 5) | (1 << 6); |
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
|
171 |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
172 |
SetDParam(0, v->string_id); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
173 |
SetDParam(1, v->unitnumber); |
0 | 174 |
DrawWindowWidgets(w); |
175 |
||
176 |
/* Draw running cost */ |
|
177 |
{ |
|
178 |
int year = v->age / 366; |
|
179 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
180 |
SetDParam(1, year); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
181 |
|
2261
3f78323707bb
(svn r2781) Fix some of the issues with variables in .h files.
ludde
parents:
2252
diff
changeset
|
182 |
SetDParam(0, (v->age + 365 < v->max_age) ? STR_AGE : STR_AGE_RED); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
183 |
SetDParam(2, v->max_age / 366); |
538
5dd99f3b7eca
(svn r920) Replace vehicle info macros with inline functions and add asserts to check limits
tron
parents:
534
diff
changeset
|
184 |
SetDParam(3, RoadVehInfo(v->engine_type)->running_cost * _price.roadveh_running >> 8); |
0 | 185 |
DrawString(2, 15, STR_900D_AGE_RUNNING_COST_YR, 0); |
186 |
} |
|
187 |
||
188 |
/* Draw max speed */ |
|
189 |
{ |
|
3477
80c3465b38ee
(svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again.
peter1138
parents:
3431
diff
changeset
|
190 |
SetDParam(0, v->max_speed / 2); |
0 | 191 |
DrawString(2, 25, STR_900E_MAX_SPEED, 0); |
192 |
} |
|
193 |
||
194 |
/* Draw profit */ |
|
195 |
{ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
196 |
SetDParam(0, v->profit_this_year); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
197 |
SetDParam(1, v->profit_last_year); |
0 | 198 |
DrawString(2, 35, STR_900F_PROFIT_THIS_YEAR_LAST_YEAR, 0); |
199 |
} |
|
200 |
||
201 |
/* Draw breakdown & reliability */ |
|
202 |
{ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
203 |
SetDParam(0, v->reliability * 100 >> 16); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
204 |
SetDParam(1, v->breakdowns_since_last_service); |
0 | 205 |
DrawString(2, 45, STR_9010_RELIABILITY_BREAKDOWNS, 0); |
206 |
} |
|
207 |
||
208 |
/* Draw service interval text */ |
|
209 |
{ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
210 |
SetDParam(0, v->service_interval); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
211 |
SetDParam(1, v->date_of_last_service); |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
212 |
DrawString(13, 90, _patches.servint_ispercent?STR_SERVICING_INTERVAL_PERCENT:STR_883C_SERVICING_INTERVAL_DAYS, 0); |
0 | 213 |
} |
214 |
||
215 |
DrawRoadVehImage(v, 3, 57, INVALID_VEHICLE); |
|
216 |
||
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
217 |
SetDParam(0, GetCustomEngineName(v->engine_type)); |
4329
9759d5c52010
(svn r6002) -Cleanup: remove the now redundant BASE_YEAR constant.
rubidium
parents:
4299
diff
changeset
|
218 |
SetDParam(1, v->build_year); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
219 |
SetDParam(2, v->value); |
0 | 220 |
DrawString(34, 57, STR_9011_BUILT_VALUE, 0); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
221 |
|
2084
d67790a49f78
(svn r2594) Fix: [strgen] Misc updates to the string system.
ludde
parents:
1986
diff
changeset
|
222 |
SetDParam(0, _cargoc.names_long[v->cargo_type]); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
223 |
SetDParam(1, v->cargo_cap); |
0 | 224 |
DrawString(34, 67, STR_9012_CAPACITY, 0); |
225 |
||
226 |
str = STR_8812_EMPTY; |
|
227 |
if (v->cargo_count != 0) { |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
228 |
SetDParam(0, v->cargo_type); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
229 |
SetDParam(1, v->cargo_count); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
230 |
SetDParam(2, v->cargo_source); |
0 | 231 |
str = STR_8813_FROM; |
232 |
} |
|
233 |
DrawString(34, 78, str, 0); |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
234 |
} break; |
0 | 235 |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
236 |
case WE_CLICK: { |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
237 |
int mod; |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
238 |
const Vehicle *v; |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
239 |
switch (e->click.widget) { |
0 | 240 |
case 2: /* rename */ |
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
241 |
v = GetVehicle(w->window_number); |
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
242 |
SetDParam(0, v->unitnumber); |
4299
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4293
diff
changeset
|
243 |
ShowQueryString(v->string_id, STR_902C_NAME_ROAD_VEHICLE, 31, 150, w->window_class, w->window_number, CS_ALPHANUMERAL); |
0 | 244 |
break; |
245 |
||
246 |
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
|
247 |
mod = _ctrl_pressed? 5 : 10; |
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
248 |
goto do_change_service_int; |
0 | 249 |
case 6: /* decrease int */ |
156
8fef5e5752d6
(svn r157) -Feature: [1009708] Percent-based service intervals. Send a vehicle to depot after it has lost X% of its reliability (mivlad)
darkvater
parents:
10
diff
changeset
|
250 |
mod = _ctrl_pressed? -5 : -10; |
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
251 |
do_change_service_int: |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
252 |
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
|
253 |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
254 |
mod = GetServiceIntervalClamped(mod + v->service_interval); |
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
255 |
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
|
256 |
|
2819
710436dd4288
(svn r3367) Unify the 4 distinct CMD_CHANGE_{AIRCRAFT,ROADVEH,SHIP,TRAIN}_SERVICE_INT commands into one CMD_CHANGE_SERVICE_INT command.
tron
parents:
2806
diff
changeset
|
257 |
DoCommandP(v->tile, v->index, mod, NULL, CMD_CHANGE_SERVICE_INT | CMD_MSG(STR_018A_CAN_T_CHANGE_SERVICING)); |
0 | 258 |
break; |
259 |
} |
|
1790
4afb4b4e4278
(svn r2294) - CodeChange: check the service interval settings when changing of all vehicle-types. To simplify things introduce GetServiceIntervalClamped() that returns the same or clamped value of the new service interval. There were some inconsistencies in the gui files so I had to change those, and const correctness kicked in, so it's a bit messy at certain points.
Darkvater
parents:
1485
diff
changeset
|
260 |
} break; |
0 | 261 |
|
262 |
case WE_ON_EDIT_TEXT: { |
|
1820
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1790
diff
changeset
|
263 |
if (e->edittext.str[0] != '\0') { |
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1790
diff
changeset
|
264 |
_cmd_text = e->edittext.str; |
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1790
diff
changeset
|
265 |
DoCommandP(0, w->window_number, 0, NULL, |
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1790
diff
changeset
|
266 |
CMD_NAME_VEHICLE | CMD_MSG(STR_902D_CAN_T_NAME_ROAD_VEHICLE)); |
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1790
diff
changeset
|
267 |
} |
0 | 268 |
} break; |
269 |
||
270 |
} |
|
271 |
} |
|
272 |
||
273 |
static const Widget _roadveh_details_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
274 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
275 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 339, 0, 13, STR_900C_DETAILS, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
276 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 340, 379, 0, 13, STR_01AA_NAME, STR_902E_NAME_ROAD_VEHICLE}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
277 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 379, 14, 55, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
278 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 0, 379, 56, 88, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
279 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 10, 89, 94, STR_0188, STR_884D_INCREASE_SERVICING_INTERVAL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
280 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 10, 95, 100, STR_0189, STR_884E_DECREASE_SERVICING_INTERVAL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
281 |
{ WWT_IMGBTN, RESIZE_NONE, 14, 11, 379, 89, 100, 0x0, STR_NULL}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
282 |
{ WIDGETS_END}, |
0 | 283 |
}; |
284 |
||
285 |
static const WindowDesc _roadveh_details_desc = { |
|
286 |
-1,-1, 380, 101, |
|
287 |
WC_VEHICLE_DETAILS,WC_VEHICLE_VIEW, |
|
288 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS, |
|
289 |
_roadveh_details_widgets, |
|
290 |
RoadVehDetailsWndProc |
|
291 |
}; |
|
292 |
||
4171 | 293 |
static void ShowRoadVehDetailsWindow(const Vehicle *v) |
0 | 294 |
{ |
295 |
Window *w; |
|
296 |
VehicleID veh = v->index; |
|
2639 | 297 |
|
0 | 298 |
DeleteWindowById(WC_VEHICLE_ORDERS, veh); |
299 |
DeleteWindowById(WC_VEHICLE_DETAILS, veh); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
300 |
_alloc_wnd_parent_num = veh; |
0 | 301 |
w = AllocateWindowDesc(&_roadveh_details_desc); |
302 |
w->window_number = veh; |
|
303 |
w->caption_color = v->owner; |
|
304 |
} |
|
305 |
||
3887
3e44ae3b1e7c
(svn r4943) uint tile -> TileIndex tile, byte player -> PlayerID player
tron
parents:
3884
diff
changeset
|
306 |
void CcCloneRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2) |
2244 | 307 |
{ |
3948
95f9fa0ac551
(svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough.
tron
parents:
3887
diff
changeset
|
308 |
if (success) ShowRoadVehViewWindow(GetVehicle(_new_vehicle_id)); |
2244 | 309 |
} |
310 |
||
0 | 311 |
static void RoadVehViewWndProc(Window *w, WindowEvent *e) |
312 |
{ |
|
2952 | 313 |
switch (e->event) { |
0 | 314 |
case WE_PAINT: { |
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
315 |
Vehicle *v = GetVehicle(w->window_number); |
0 | 316 |
StringID str; |
317 |
||
3990
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
318 |
w->disabled_state = (v->owner != _local_player) ? (1 << 8 | 1 << 7 | 1 << 12) : 0; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
319 |
|
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
320 |
/* Disable refit button if vehicle not refittable */ |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
321 |
if (_engine_info[v->engine_type].refit_mask == 0) SETBIT(w->disabled_state, 12); |
0 | 322 |
|
323 |
/* draw widgets & caption */ |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
324 |
SetDParam(0, v->string_id); |
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
325 |
SetDParam(1, v->unitnumber); |
0 | 326 |
DrawWindowWidgets(w); |
327 |
||
328 |
if (v->u.road.crashed_ctr != 0) { |
|
329 |
str = STR_8863_CRASHED; |
|
330 |
} else if (v->breakdown_ctr == 1) { |
|
331 |
str = STR_885C_BROKEN_DOWN; |
|
332 |
} else if (v->vehstatus & VS_STOPPED) { |
|
333 |
str = STR_8861_STOPPED; |
|
334 |
} else { |
|
555
eec6c0294435
(svn r955) Replace uint16 for orders with struct Order
tron
parents:
543
diff
changeset
|
335 |
switch (v->current_order.type) { |
0 | 336 |
case OT_GOTO_STATION: { |
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4524
diff
changeset
|
337 |
SetDParam(0, v->current_order.dest); |
3477
80c3465b38ee
(svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again.
peter1138
parents:
3431
diff
changeset
|
338 |
SetDParam(1, v->cur_speed / 2); |
0 | 339 |
str = STR_HEADING_FOR_STATION + _patches.vehicle_speed; |
340 |
} break; |
|
341 |
||
342 |
case OT_GOTO_DEPOT: { |
|
4527
b18634a31a4a
(svn r6353) -Codechange: Make DestinationID a typedef of uin16, which is as large as any type of destinataion (StationID, DepotID, WaypointID) it can hold
tron
parents:
4524
diff
changeset
|
343 |
Depot *depot = GetDepot(v->current_order.dest); |
1313
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1299
diff
changeset
|
344 |
SetDParam(0, depot->town_index); |
3477
80c3465b38ee
(svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again.
peter1138
parents:
3431
diff
changeset
|
345 |
SetDParam(1, v->cur_speed / 2); |
4633
fae5d85ef53d
(svn r6497) -Fix r6165: Vehicles heading for depots when their orders contained "service in depot" displayed the stopping in depot string
bjarni
parents:
4547
diff
changeset
|
346 |
if (HASBIT(v->current_order.flags, OFB_HALT_IN_DEPOT) && !HASBIT(v->current_order.flags, OFB_PART_OF_ORDERS)) { |
4412
945e8a9bb89a
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
347 |
str = STR_HEADING_FOR_ROAD_DEPOT + _patches.vehicle_speed; |
945e8a9bb89a
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
348 |
} else { |
945e8a9bb89a
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
349 |
str = STR_HEADING_FOR_ROAD_DEPOT_SERVICE + _patches.vehicle_speed; |
945e8a9bb89a
(svn r6165) -Feature: control click Goto Depot will now make the vehicle service
bjarni
parents:
4408
diff
changeset
|
350 |
} |
0 | 351 |
} break; |
352 |
||
353 |
case OT_LOADING: |
|
354 |
case OT_LEAVESTATION: |
|
355 |
str = STR_882F_LOADING_UNLOADING; |
|
356 |
break; |
|
357 |
||
358 |
default: |
|
359 |
if (v->num_orders == 0) { |
|
360 |
str = STR_NO_ORDERS + _patches.vehicle_speed; |
|
3477
80c3465b38ee
(svn r4322) - Codechange: Remove conversion of kmh to mph from gui code to within the units conversion system, in string.c. This means displaying kmh requires no conversion, instead of being convert from kmh to mph, and then back to kmh again.
peter1138
parents:
3431
diff
changeset
|
361 |
SetDParam(0, v->cur_speed / 2); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
362 |
} else { |
0 | 363 |
str = STR_EMPTY; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
364 |
} |
0 | 365 |
break; |
366 |
} |
|
367 |
} |
|
368 |
||
2103
9266bb2ac29d
(svn r2613) - Truncate savegames, and vehicle-texts in their window.
Darkvater
parents:
2084
diff
changeset
|
369 |
/* draw the flag plus orders */ |
2517
b90693227193
(svn r3046) Replace some numbers with sprite names and fix a typo in the sprite list
tron
parents:
2498
diff
changeset
|
370 |
DrawSprite(v->vehstatus & VS_STOPPED ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, 2, w->widget[5].top + 1); |
2113
f228b399da01
(svn r2623) - CodeChange: rework DrawStringCenteredTruncated() a bit. Instead of giving center + width you give the coordinates of the bounding box (left, right) it has to fit in (ludde)
Darkvater
parents:
2103
diff
changeset
|
371 |
DrawStringCenteredTruncated(w->widget[5].left + 8, w->widget[5].right, w->widget[5].top + 1, str, 0); |
0 | 372 |
DrawWindowViewport(w); |
373 |
} break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
374 |
|
0 | 375 |
case WE_CLICK: { |
4171 | 376 |
const Vehicle *v = GetVehicle(w->window_number); |
0 | 377 |
|
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
378 |
switch (e->click.widget) { |
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
379 |
case 5: /* start stop */ |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
380 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE)); |
0 | 381 |
break; |
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
382 |
case 6: /* center main view */ |
0 | 383 |
ScrollMainWindowTo(v->x_pos, v->y_pos); |
384 |
break; |
|
3990
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
385 |
case 7: /* goto depot */ |
4506
0d8fcc0a4e49
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4473
diff
changeset
|
386 |
DoCommandP(v->tile, v->index, _ctrl_pressed ? DEPOT_SERVICE : 0, NULL, CMD_SEND_ROADVEH_TO_DEPOT | CMD_MSG(STR_9018_CAN_T_SEND_VEHICLE_TO_DEPOT)); |
0 | 387 |
break; |
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
388 |
case 8: /* turn around */ |
0 | 389 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_TURN_ROADVEH | CMD_MSG(STR_9033_CAN_T_MAKE_VEHICLE_TURN)); |
390 |
break; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
391 |
case 9: /* show orders */ |
0 | 392 |
ShowOrdersWindow(v); |
393 |
break; |
|
755
823358e83abf
(svn r1211) -Feature: Introduce sticky windows to all vehicle windows...Just make sure you do not sticky more than 23 at a time. Also a lot of places in the code invalidated the 'status bar' of the vehicle, referring to it as widget 4. This is now widget 5 and has been #definitized
darkvater
parents:
727
diff
changeset
|
394 |
case 10: /* show details */ |
0 | 395 |
ShowRoadVehDetailsWindow(v); |
396 |
break; |
|
3990
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
397 |
case 11: /* clone vehicle */ |
2244 | 398 |
DoCommandP(v->tile, v->index, _ctrl_pressed ? 1 : 0, CcCloneRoadVeh, CMD_CLONE_VEHICLE | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE)); |
3990
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
399 |
break; |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
400 |
case 12: /* Refit vehicle */ |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
401 |
ShowRoadVehRefitWindow(v); |
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
402 |
break; |
0 | 403 |
} |
404 |
} break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
405 |
|
1485
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
406 |
case WE_RESIZE: |
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
407 |
w->viewport->width += e->sizing.diff.x; |
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
408 |
w->viewport->height += e->sizing.diff.y; |
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
409 |
w->viewport->virtual_width += e->sizing.diff.x; |
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
410 |
w->viewport->virtual_height += e->sizing.diff.y; |
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
411 |
break; |
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
412 |
|
0 | 413 |
case WE_DESTROY: |
3990
d3d23f3bcd34
(svn r5191) - NewGRF: add cargo refit support for road vehicles
peter1138
parents:
3960
diff
changeset
|
414 |
DeleteWindowById(WC_VEHICLE_REFIT, w->window_number); |
0 | 415 |
DeleteWindowById(WC_VEHICLE_ORDERS, w->window_number); |
416 |
DeleteWindowById(WC_VEHICLE_DETAILS, w->window_number); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
417 |
break; |
2244 | 418 |
|
419 |
case WE_MOUSELOOP: |
|
420 |
{ |
|
4171 | 421 |
const Vehicle *v = GetVehicle(w->window_number); |
4000
bab1ebc37da0
(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:
3990
diff
changeset
|
422 |
uint32 h = IsRoadVehInDepotStopped(v) ? 1 << 7 | 1 << 8 : 1 << 11 | 1 << 12; |
bab1ebc37da0
(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:
3990
diff
changeset
|
423 |
|
2244 | 424 |
if (h != w->hidden_state) { |
425 |
w->hidden_state = h; |
|
426 |
SetWindowDirty(w); |
|
427 |
} |
|
428 |
} |
|
0 | 429 |
} |
430 |
} |
|
431 |
||
432 |
static const Widget _roadveh_view_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
433 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
434 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 237, 0, 13, STR_9002, STR_018C_WINDOW_TITLE_DRAG_THIS }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
435 |
{ WWT_STICKYBOX, RESIZE_LR, 14, 238, 249, 0, 13, 0x0, STR_STICKY_BUTTON }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
436 |
{ WWT_IMGBTN, RESIZE_RB, 14, 0, 231, 14, 103, 0x0, STR_NULL }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
437 |
{ WWT_6, RESIZE_RB, 14, 2, 229, 16, 101, 0x0, STR_NULL }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
438 |
{ WWT_PUSHIMGBTN, RESIZE_RTB, 14, 0, 237, 104, 115, 0x0, STR_901C_CURRENT_VEHICLE_ACTION }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
439 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 14, 31, 0x2AB, STR_901E_CENTER_MAIN_VIEW_ON_VEHICLE }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
440 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, 0x2AE, STR_901F_SEND_VEHICLE_TO_DEPOT }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
441 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 50, 67, 0x2CB, STR_9020_FORCE_VEHICLE_TO_TURN_AROUND }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
442 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 68, 85, 0x2B2, STR_901D_SHOW_VEHICLE_S_ORDERS }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
443 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 86, 103, 0x2B3, STR_9021_SHOW_ROAD_VEHICLE_DETAILS }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
444 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 32, 49, SPR_CLONE_ROADVEH, STR_CLONE_ROAD_VEHICLE_INFO }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
445 |
{ WWT_PUSHIMGBTN, RESIZE_LR, 14, 232, 249, 50, 67, 0x2B4, STR_REFIT_ROAD_VEHICLE_TO_CARRY }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
446 |
{ WWT_PANEL, RESIZE_LRB, 14, 232, 249, 104, 103, 0x0, STR_NULL }, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
447 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 238, 249, 104, 115, 0x0, STR_NULL }, |
1485
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
448 |
{ WIDGETS_END } |
0 | 449 |
}; |
450 |
||
451 |
static const WindowDesc _roadveh_view_desc = { |
|
452 |
-1,-1, 250, 116, |
|
453 |
WC_VEHICLE_VIEW,0, |
|
1485
a2f36708c260
(svn r1989) -Feature: Resizable vehicle view windows; this is based on a patch by tmesisbob
tron
parents:
1330
diff
changeset
|
454 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
0 | 455 |
_roadveh_view_widgets, |
456 |
RoadVehViewWndProc, |
|
457 |
}; |
|
458 |
||
4171 | 459 |
void ShowRoadVehViewWindow(const Vehicle *v) |
0 | 460 |
{ |
4171 | 461 |
Window *w = AllocateWindowDescFront(&_roadveh_view_desc, v->index); |
0 | 462 |
|
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
463 |
if (w != NULL) { |
0 | 464 |
w->caption_color = v->owner; |
465 |
AssignWindowViewport(w, 3, 17, 0xE2, 0x54, w->window_number | (1 << 31), 0); |
|
466 |
} |
|
467 |
} |
|
468 |
||
469 |
||
470 |
static void DrawNewRoadVehWindow(Window *w) |
|
471 |
{ |
|
4473
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
472 |
EngineID selected_id; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
473 |
EngineID e; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
474 |
uint count; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
475 |
int pos; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
476 |
int sel; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
477 |
int y; |
0 | 478 |
|
4473
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
479 |
if (w->window_number == 0) w->disabled_state = 1 << 5; |
1926
68d60188a22f
(svn r2432) Use GetEngine() instead of DEREF_ENGINE() or even _engines[]
tron
parents:
1922
diff
changeset
|
480 |
|
4473
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
481 |
count = 0; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
482 |
for (e = ROAD_ENGINES_INDEX; e < ROAD_ENGINES_INDEX + NUM_ROAD_ENGINES; e++) { |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
483 |
if (HASBIT(GetEngine(e)->player_avail, _local_player)) count++; |
0 | 484 |
} |
4473
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
485 |
SetVScrollCount(w, count); |
0 | 486 |
|
487 |
DrawWindowWidgets(w); |
|
488 |
||
4473
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
489 |
y = 15; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
490 |
sel = WP(w,buildtrain_d).sel_index; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
491 |
pos = w->vscroll.pos; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
492 |
selected_id = INVALID_ENGINE; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
493 |
for (e = ROAD_ENGINES_INDEX; e < ROAD_ENGINES_INDEX + NUM_ROAD_ENGINES; e++) { |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
494 |
if (!HASBIT(GetEngine(e)->player_avail, _local_player)) continue; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
495 |
if (sel == 0) selected_id = e; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
496 |
if (IS_INT_INSIDE(--pos, -w->vscroll.cap, 0)) { |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
497 |
DrawString(60, y + 2, GetCustomEngineName(e), sel == 0 ? 0xC : 0x10); |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
498 |
DrawRoadVehEngine(30, y + 6, e, GetEnginePalette(e, _local_player)); |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
499 |
y += 14; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
500 |
} |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
501 |
sel--; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
502 |
} |
0 | 503 |
|
4473
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
504 |
WP(w,buildtrain_d).sel_engine = selected_id; |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
505 |
if (selected_id != INVALID_ENGINE) { |
e4bf558ae479
(svn r6258) Reduce the number of induction variables and inner scopes for clarity
tron
parents:
4456
diff
changeset
|
506 |
DrawRoadVehPurchaseInfo(2, w->widget[4].top + 1, selected_id); |
0 | 507 |
} |
508 |
} |
|
509 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
510 |
void CcBuildRoadVeh(bool success, TileIndex tile, uint32 p1, uint32 p2) |
0 | 511 |
{ |
4171 | 512 |
const Vehicle *v; |
0 | 513 |
|
514 |
if (!success) return; |
|
515 |
||
3948
95f9fa0ac551
(svn r5094) Remove _new_{aircraft,roadveh,ship,train,wagon}_id. _new_vehicle_id is enough.
tron
parents:
3887
diff
changeset
|
516 |
v = GetVehicle(_new_vehicle_id); |
0 | 517 |
if (v->tile == _backup_orders_tile) { |
518 |
_backup_orders_tile = 0; |
|
519 |
RestoreVehicleOrders(v, _backup_orders_data); |
|
520 |
} |
|
521 |
ShowRoadVehViewWindow(v); |
|
522 |
} |
|
523 |
||
524 |
static void NewRoadVehWndProc(Window *w, WindowEvent *e) |
|
525 |
{ |
|
2639 | 526 |
switch (e->event) { |
0 | 527 |
case WE_PAINT: |
528 |
DrawNewRoadVehWindow(w); |
|
529 |
break; |
|
530 |
||
531 |
case WE_CLICK: |
|
2952 | 532 |
switch (e->click.widget) { |
0 | 533 |
case 2: { /* listbox */ |
534 |
uint i = (e->click.pt.y - 14) / 14; |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
535 |
if (i < w->vscroll.cap) { |
0 | 536 |
WP(w,buildtrain_d).sel_index = i + w->vscroll.pos; |
537 |
SetWindowDirty(w); |
|
538 |
} |
|
539 |
} break; |
|
540 |
||
541 |
case 5: { /* build */ |
|
2498
befad2fe53d2
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2477
diff
changeset
|
542 |
EngineID sel_eng = WP(w,buildtrain_d).sel_engine; |
befad2fe53d2
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2477
diff
changeset
|
543 |
if (sel_eng != INVALID_ENGINE) |
0 | 544 |
DoCommandP(w->window_number, sel_eng, 0, CcBuildRoadVeh, CMD_BUILD_ROAD_VEH | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE)); |
545 |
} break; |
|
546 |
||
968
9c47631d62dc
(svn r1463) -Fix: [1099451] Game crashes after the click on Rename (see also Bug 10992). There was no check for non-selected engine
darkvater
parents:
919
diff
changeset
|
547 |
case 6: { /* rename */ |
2498
befad2fe53d2
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2477
diff
changeset
|
548 |
EngineID sel_eng = WP(w,buildtrain_d).sel_engine; |
befad2fe53d2
(svn r3024) -Codechange: Another batch of replacements of int/uint/int16/byte/-1 with proper types and constants
tron
parents:
2477
diff
changeset
|
549 |
if (sel_eng != INVALID_ENGINE) { |
968
9c47631d62dc
(svn r1463) -Fix: [1099451] Game crashes after the click on Rename (see also Bug 10992). There was no check for non-selected engine
darkvater
parents:
919
diff
changeset
|
550 |
WP(w,buildtrain_d).rename_engine = sel_eng; |
9c47631d62dc
(svn r1463) -Fix: [1099451] Game crashes after the click on Rename (see also Bug 10992). There was no check for non-selected engine
darkvater
parents:
919
diff
changeset
|
551 |
ShowQueryString(GetCustomEngineName(sel_eng), |
4299
b86602eaaff1
(svn r5944) -Merge TGP (r5578, r5579, r5724, r5726): -Feature: filter for textboxes to only
truelight
parents:
4293
diff
changeset
|
552 |
STR_9036_RENAME_ROAD_VEHICLE_TYPE, 31, 160, w->window_class, w->window_number, CS_ALPHANUMERAL); |
968
9c47631d62dc
(svn r1463) -Fix: [1099451] Game crashes after the click on Rename (see also Bug 10992). There was no check for non-selected engine
darkvater
parents:
919
diff
changeset
|
553 |
} |
9c47631d62dc
(svn r1463) -Fix: [1099451] Game crashes after the click on Rename (see also Bug 10992). There was no check for non-selected engine
darkvater
parents:
919
diff
changeset
|
554 |
} break; |
0 | 555 |
} |
556 |
break; |
|
557 |
||
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2517
diff
changeset
|
558 |
case WE_ON_EDIT_TEXT: |
1820
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1790
diff
changeset
|
559 |
if (e->edittext.str[0] != '\0') { |
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1790
diff
changeset
|
560 |
_cmd_text = e->edittext.str; |
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1790
diff
changeset
|
561 |
DoCommandP(0, WP(w, buildtrain_d).rename_engine, 0, NULL, |
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1790
diff
changeset
|
562 |
CMD_RENAME_ENGINE | CMD_MSG(STR_9037_CAN_T_RENAME_ROAD_VEHICLE)); |
9b6458526480
(svn r2324) Introduce _cmd_text for passing strings with a command instead of abusing _decode_parameters as text buffer. This should prevent several possible buffer overruns and is a bit cleaner to use. As bonus it reduces the size of most command packets by 79 bytes.
tron
parents:
1790
diff
changeset
|
563 |
} |
2548
97ada3bd2702
(svn r3077) static, const, bracing, indentation, 0 -> '\0'/NULL, typos in comments, excess empty lines, minor other changes
tron
parents:
2517
diff
changeset
|
564 |
break; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
565 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
566 |
case WE_RESIZE: { |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
567 |
if (e->sizing.diff.y == 0) break; |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
568 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
569 |
w->vscroll.cap += e->sizing.diff.y / 14; |
4547
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4541
diff
changeset
|
570 |
w->widget[2].data = (w->vscroll.cap << 8) + 1; |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
571 |
} break; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
572 |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
573 |
} |
0 | 574 |
} |
575 |
||
576 |
static const Widget _new_road_veh_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
577 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
578 |
{ WWT_CAPTION, RESIZE_NONE, 14, 11, 247, 0, 13, STR_9006_NEW_ROAD_VEHICLES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
579 |
{ WWT_MATRIX, RESIZE_BOTTOM, 14, 0, 235, 14, 125, 0x801, STR_9026_ROAD_VEHICLE_SELECTION}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
580 |
{ WWT_SCROLLBAR, RESIZE_BOTTOM, 14, 236, 247, 14, 125, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
581 |
{ WWT_IMGBTN, RESIZE_TB, 14, 0, 247, 126, 197, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
582 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 117, 198, 209, STR_9007_BUILD_VEHICLE, STR_9027_BUILD_THE_HIGHLIGHTED_ROAD}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
583 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 118, 235, 198, 209, STR_9034_RENAME, STR_9035_RENAME_ROAD_VEHICLE_TYPE}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
584 |
{ WWT_RESIZEBOX, RESIZE_TB, 14, 236, 247, 198, 209, 0x0, STR_RESIZE_BUTTON}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
585 |
{ WIDGETS_END}, |
0 | 586 |
}; |
587 |
||
588 |
static const WindowDesc _new_road_veh_desc = { |
|
4243
900826bcac92
(svn r5820) - NewGRF: Add support for extra vehicle text in the purchase list for road vehicles, aircraft and ships.
peter1138
parents:
4171
diff
changeset
|
589 |
-1, -1, 248, 210, |
0 | 590 |
WC_BUILD_VEHICLE,0, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
591 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE, |
0 | 592 |
_new_road_veh_widgets, |
593 |
NewRoadVehWndProc |
|
594 |
}; |
|
595 |
||
4442
8d8d0c2df7cb
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4434
diff
changeset
|
596 |
void ShowBuildRoadVehWindow(TileIndex tile) |
0 | 597 |
{ |
598 |
Window *w; |
|
599 |
||
600 |
DeleteWindowById(WC_BUILD_VEHICLE, tile); |
|
601 |
||
602 |
w = AllocateWindowDesc(&_new_road_veh_desc); |
|
603 |
w->window_number = tile; |
|
604 |
w->vscroll.cap = 8; |
|
4547
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4541
diff
changeset
|
605 |
w->widget[2].data = (w->vscroll.cap << 8) + 1; |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
606 |
|
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
607 |
w->resize.step_height = 14; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
608 |
w->resize.height = w->height - 14 * 4; /* Minimum of 4 vehicles in the display */ |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
609 |
|
0 | 610 |
if (tile != 0) { |
1901
fb05044cf5c3
(svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
tron
parents:
1891
diff
changeset
|
611 |
w->caption_color = GetTileOwner(tile); |
0 | 612 |
} else { |
613 |
w->caption_color = _local_player; |
|
614 |
} |
|
615 |
} |
|
616 |
||
617 |
static void DrawRoadDepotWindow(Window *w) |
|
618 |
{ |
|
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
619 |
TileIndex tile; |
0 | 620 |
Vehicle *v; |
621 |
int num,x,y; |
|
1313
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1299
diff
changeset
|
622 |
Depot *depot; |
0 | 623 |
|
624 |
tile = w->window_number; |
|
625 |
||
626 |
/* setup disabled buttons */ |
|
1901
fb05044cf5c3
(svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
tron
parents:
1891
diff
changeset
|
627 |
w->disabled_state = |
2244 | 628 |
IsTileOwner(tile, _local_player) ? 0 : ((1<<4) | (1<<7) | (1<<8)); |
0 | 629 |
|
630 |
/* determine amount of items for scroller */ |
|
631 |
num = 0; |
|
632 |
FOR_ALL_VEHICLES(v) { |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
633 |
if (v->type == VEH_Road && IsRoadVehInDepot(v) && v->tile == tile) num++; |
0 | 634 |
} |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
635 |
SetVScrollCount(w, (num + w->hscroll.cap - 1) / w->hscroll.cap); |
0 | 636 |
|
637 |
/* locate the depot struct */ |
|
1313
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1299
diff
changeset
|
638 |
depot = GetDepotByTile(tile); |
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1299
diff
changeset
|
639 |
assert(depot != NULL); |
0 | 640 |
|
1313
bba6afb8a995
(svn r1817) -Codechange: Moved depot-functions to depot.c
truelight
parents:
1299
diff
changeset
|
641 |
SetDParam(0, depot->town_index); |
0 | 642 |
DrawWindowWidgets(w); |
643 |
||
644 |
x = 2; |
|
645 |
y = 15; |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
646 |
num = w->vscroll.pos * w->hscroll.cap; |
0 | 647 |
|
648 |
FOR_ALL_VEHICLES(v) { |
|
3959 | 649 |
if (v->type == VEH_Road && IsRoadVehInDepot(v) && v->tile == tile && |
4434
4175805666a5
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4426
diff
changeset
|
650 |
--num < 0 && num >= -w->vscroll.cap * w->hscroll.cap) { |
0 | 651 |
DrawRoadVehImage(v, x+24, y, WP(w,traindepot_d).sel); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
652 |
|
534
17ab2f22ff74
(svn r901) Small step in the process to clean up the DPARAM mess:
tron
parents:
507
diff
changeset
|
653 |
SetDParam(0, v->unitnumber); |
0 | 654 |
DrawString(x, y+2, (uint16)(v->max_age-366) >= v->age ? STR_00E2 : STR_00E3, 0); |
655 |
||
2517
b90693227193
(svn r3046) Replace some numbers with sprite names and fix a typo in the sprite list
tron
parents:
2498
diff
changeset
|
656 |
DrawSprite((v->vehstatus & VS_STOPPED) ? SPR_FLAG_VEH_STOPPED : SPR_FLAG_VEH_RUNNING, x + 16, y); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
657 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
658 |
if ((x+=56) == 2 + 56 * w->hscroll.cap) { |
0 | 659 |
x = 2; |
660 |
y += 14; |
|
661 |
} |
|
662 |
} |
|
663 |
} |
|
664 |
} |
|
665 |
||
2436
177cb6a8339f
(svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents:
2406
diff
changeset
|
666 |
static int GetVehicleFromRoadDepotWndPt(const Window *w, int x, int y, Vehicle **veh) |
0 | 667 |
{ |
969
8c4bede35fcc
(svn r1464) -Fix: [1099106] Resizeable portion of bus/air/rail depots window unclickable
darkvater
parents:
968
diff
changeset
|
668 |
uint xt,row,xm; |
0 | 669 |
TileIndex tile; |
670 |
Vehicle *v; |
|
671 |
int pos; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
672 |
|
0 | 673 |
xt = x / 56; |
674 |
xm = x % 56; |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
675 |
if (xt >= w->hscroll.cap) return 1; |
0 | 676 |
|
969
8c4bede35fcc
(svn r1464) -Fix: [1099106] Resizeable portion of bus/air/rail depots window unclickable
darkvater
parents:
968
diff
changeset
|
677 |
row = (y - 14) / 14; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
678 |
if (row >= w->vscroll.cap) return 1; |
0 | 679 |
|
971
1b6f956d8ac5
(svn r1466) -Fix: oops, depot windows can of course also scroll horizontally. Thanks si-m1.
darkvater
parents:
969
diff
changeset
|
680 |
pos = (row + w->vscroll.pos) * w->hscroll.cap + xt; |
0 | 681 |
|
682 |
tile = w->window_number; |
|
683 |
FOR_ALL_VEHICLES(v) { |
|
3959 | 684 |
if (v->type == VEH_Road && IsRoadVehInDepot(v) && v->tile == tile && |
0 | 685 |
--pos < 0) { |
1986
5dd3db2b86d7
(svn r2492) Remove some pointless casts and fix some nearby indentation
tron
parents:
1977
diff
changeset
|
686 |
*veh = v; |
5dd3db2b86d7
(svn r2492) Remove some pointless casts and fix some nearby indentation
tron
parents:
1977
diff
changeset
|
687 |
if (xm >= 24) return 0; |
5dd3db2b86d7
(svn r2492) Remove some pointless casts and fix some nearby indentation
tron
parents:
1977
diff
changeset
|
688 |
if (xm <= 16) return -1; /* show window */ |
5dd3db2b86d7
(svn r2492) Remove some pointless casts and fix some nearby indentation
tron
parents:
1977
diff
changeset
|
689 |
return -2; /* start stop */ |
5dd3db2b86d7
(svn r2492) Remove some pointless casts and fix some nearby indentation
tron
parents:
1977
diff
changeset
|
690 |
} |
0 | 691 |
} |
692 |
||
693 |
return 1; /* outside */ |
|
694 |
} |
|
695 |
||
696 |
static void RoadDepotClickVeh(Window *w, int x, int y) |
|
697 |
{ |
|
698 |
Vehicle *v; |
|
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
699 |
int mode; |
0 | 700 |
|
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
701 |
mode = GetVehicleFromRoadDepotWndPt(w, x, y, &v); |
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
702 |
if (mode > 0) return; |
0 | 703 |
|
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
704 |
// share / copy orders |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
705 |
if (_thd.place_mode && mode <= 0) { |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
706 |
_place_clicked_vehicle = v; |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
707 |
return; |
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
708 |
} |
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
709 |
|
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
710 |
switch (mode) { |
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
711 |
case 0: // start dragging of vehicle |
0 | 712 |
if (v != NULL) { |
713 |
WP(w,traindepot_d).sel = v->index; |
|
714 |
SetWindowDirty(w); |
|
3157
40de8616c04c
(svn r3783) Replace further ints and magic numbers by Direction, DiagDirection and friends
tron
parents:
3049
diff
changeset
|
715 |
SetObjectToPlaceWnd(GetVehiclePalette(v) | GetRoadVehImage(v, DIR_W), 4, w); |
0 | 716 |
} |
717 |
break; |
|
718 |
||
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
719 |
case -1: // show info window |
0 | 720 |
ShowRoadVehViewWindow(v); |
721 |
break; |
|
722 |
||
10
c35ab8426202
(svn r11) Feature: Copy/share orders now works from ship depot window for ships and hangar window for aircraft
dominik
parents:
0
diff
changeset
|
723 |
case -2: // click start/stop flag |
0 | 724 |
DoCommandP(v->tile, v->index, 0, NULL, CMD_START_STOP_ROADVEH | CMD_MSG(STR_9015_CAN_T_STOP_START_ROAD_VEHICLE)); |
725 |
break; |
|
726 |
||
727 |
default: |
|
728 |
NOT_REACHED(); |
|
729 |
} |
|
730 |
} |
|
731 |
||
2244 | 732 |
/** |
733 |
* Clones a road vehicle |
|
734 |
* @param *v is the original vehicle to clone |
|
735 |
* @param *w is the window of the depot where the clone is build |
|
736 |
*/ |
|
4171 | 737 |
static void HandleCloneVehClick(const Vehicle *v, const Window *w) |
2244 | 738 |
{ |
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
739 |
if (v == NULL || v->type != VEH_Road) return; |
2244 | 740 |
|
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
741 |
DoCommandP(w->window_number, v->index, _ctrl_pressed ? 1 : 0, CcCloneRoadVeh, |
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
742 |
CMD_CLONE_VEHICLE | CMD_MSG(STR_9009_CAN_T_BUILD_ROAD_VEHICLE) |
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
743 |
); |
2244 | 744 |
|
745 |
ResetObjectToPlace(); |
|
746 |
} |
|
747 |
||
4171 | 748 |
static void ClonePlaceObj(const Window *w) |
2244 | 749 |
{ |
4171 | 750 |
const Vehicle *v = CheckMouseOverVehicle(); |
2244 | 751 |
|
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
752 |
if (v != NULL) HandleCloneVehClick(v, w); |
2244 | 753 |
} |
754 |
||
0 | 755 |
static void RoadDepotWndProc(Window *w, WindowEvent *e) |
756 |
{ |
|
2952 | 757 |
switch (e->event) { |
0 | 758 |
case WE_PAINT: |
759 |
DrawRoadDepotWindow(w); |
|
760 |
break; |
|
761 |
||
762 |
case WE_CLICK: { |
|
2952 | 763 |
switch (e->click.widget) { |
982
be834034b331
(svn r1478) -Fix: [1099195] mouse-wheel in train replace window. Scrollbar1 and Scrollbar2 now work independently. You can only scroll on list and scrollbar itself; scrollbar must be next widget of the list.
darkvater
parents:
971
diff
changeset
|
764 |
case 5: |
0 | 765 |
RoadDepotClickVeh(w, e->click.pt.x, e->click.pt.y); |
766 |
break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
767 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
768 |
case 7: |
2244 | 769 |
ResetObjectToPlace(); |
0 | 770 |
ShowBuildRoadVehWindow(w->window_number); |
771 |
break; |
|
2261
3f78323707bb
(svn r2781) Fix some of the issues with variables in .h files.
ludde
parents:
2252
diff
changeset
|
772 |
|
2244 | 773 |
case 8: /* clone button */ |
774 |
InvalidateWidget(w, 8); |
|
775 |
TOGGLEBIT(w->click_state, 8); |
|
2261
3f78323707bb
(svn r2781) Fix some of the issues with variables in .h files.
ludde
parents:
2252
diff
changeset
|
776 |
|
2244 | 777 |
if (HASBIT(w->click_state, 8)) { |
778 |
_place_clicked_vehicle = NULL; |
|
779 |
SetObjectToPlaceWnd(SPR_CURSOR_CLONE, VHM_RECT, w); |
|
780 |
} else { |
|
781 |
ResetObjectToPlace(); |
|
782 |
} |
|
783 |
break; |
|
2261
3f78323707bb
(svn r2781) Fix some of the issues with variables in .h files.
ludde
parents:
2252
diff
changeset
|
784 |
|
4532
e54ebe7faf28
(svn r6359) -Fix: Do not reset the current cursor action when centering on a depot/hangar (noticed by Neonox)
tron
parents:
4527
diff
changeset
|
785 |
case 9: ScrollMainWindowToTile(w->window_number); break; |
2244 | 786 |
} |
787 |
} break; |
|
2261
3f78323707bb
(svn r2781) Fix some of the issues with variables in .h files.
ludde
parents:
2252
diff
changeset
|
788 |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
789 |
case WE_PLACE_OBJ: |
2958
3f8946daf55f
(svn r3520) Remove unused parameters from some functions
tron
parents:
2952
diff
changeset
|
790 |
ClonePlaceObj(w); |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
791 |
break; |
0 | 792 |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
793 |
case WE_ABORT_PLACE_OBJ: |
2244 | 794 |
CLRBIT(w->click_state, 8); |
795 |
InvalidateWidget(w, 8); |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
796 |
break; |
2261
3f78323707bb
(svn r2781) Fix some of the issues with variables in .h files.
ludde
parents:
2252
diff
changeset
|
797 |
|
2244 | 798 |
// check if a vehicle in a depot was clicked.. |
799 |
case WE_MOUSELOOP: { |
|
4171 | 800 |
const Vehicle *v = _place_clicked_vehicle; |
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
801 |
|
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
802 |
// since OTTD checks all open depot windows, we will make sure that it triggers the one with a clicked clone button |
2244 | 803 |
if (v != NULL && HASBIT(w->click_state, 8)) { |
804 |
_place_clicked_vehicle = NULL; |
|
2561
c78c3d248897
(svn r3098) static, const, uint -> TileIndex, indentation, bracing, unused return values, ... mostly related to the clone vehicle GUI
tron
parents:
2549
diff
changeset
|
805 |
HandleCloneVehClick(v, w); |
0 | 806 |
} |
807 |
} break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
808 |
|
0 | 809 |
case WE_DESTROY: |
810 |
DeleteWindowById(WC_BUILD_VEHICLE, w->window_number); |
|
811 |
break; |
|
812 |
||
2755
3098984d08c8
(svn r3300) Remove unreachable code - in this case some duplicate breaks
tron
parents:
2725
diff
changeset
|
813 |
case WE_DRAGDROP: |
2952 | 814 |
switch (e->click.widget) { |
982
be834034b331
(svn r1478) -Fix: [1099195] mouse-wheel in train replace window. Scrollbar1 and Scrollbar2 now work independently. You can only scroll on list and scrollbar itself; scrollbar must be next widget of the list.
darkvater
parents:
971
diff
changeset
|
815 |
case 5: { |
0 | 816 |
Vehicle *v; |
817 |
VehicleID sel = WP(w,traindepot_d).sel; |
|
818 |
||
819 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
|
820 |
SetWindowDirty(w); |
|
821 |
||
822 |
if (GetVehicleFromRoadDepotWndPt(w, e->dragdrop.pt.x, e->dragdrop.pt.y, &v) == 0 && |
|
823 |
v != NULL && |
|
824 |
sel == v->index) { |
|
825 |
ShowRoadVehViewWindow(v); |
|
826 |
} |
|
827 |
} break; |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
828 |
|
982
be834034b331
(svn r1478) -Fix: [1099195] mouse-wheel in train replace window. Scrollbar1 and Scrollbar2 now work independently. You can only scroll on list and scrollbar itself; scrollbar must be next widget of the list.
darkvater
parents:
971
diff
changeset
|
829 |
case 4: |
be834034b331
(svn r1478) -Fix: [1099195] mouse-wheel in train replace window. Scrollbar1 and Scrollbar2 now work independently. You can only scroll on list and scrollbar itself; scrollbar must be next widget of the list.
darkvater
parents:
971
diff
changeset
|
830 |
if (!HASBIT(w->disabled_state, 4) && |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
831 |
WP(w,traindepot_d).sel != INVALID_VEHICLE) { |
0 | 832 |
Vehicle *v; |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
833 |
|
982
be834034b331
(svn r1478) -Fix: [1099195] mouse-wheel in train replace window. Scrollbar1 and Scrollbar2 now work independently. You can only scroll on list and scrollbar itself; scrollbar must be next widget of the list.
darkvater
parents:
971
diff
changeset
|
834 |
HandleButtonClick(w, 4); |
0 | 835 |
|
919
b0d6c7642f99
(svn r1407) -Codechange: changed a lot around _stations, _vehicles, _towns and _industries
truelight
parents:
893
diff
changeset
|
836 |
v = GetVehicle(WP(w,traindepot_d).sel); |
0 | 837 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
838 |
||
839 |
_backup_orders_tile = v->tile; |
|
840 |
BackupVehicleOrders(v, _backup_orders_data); |
|
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
841 |
|
0 | 842 |
if (!DoCommandP(v->tile, v->index, 0, NULL, CMD_SELL_ROAD_VEH | CMD_MSG(STR_9014_CAN_T_SELL_ROAD_VEHICLE))) |
843 |
_backup_orders_tile = 0; |
|
844 |
} |
|
845 |
break; |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
846 |
|
0 | 847 |
default: |
848 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
|
849 |
SetWindowDirty(w); |
|
850 |
} |
|
851 |
break; |
|
852 |
||
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
853 |
case WE_RESIZE: |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
854 |
/* Update the scroll + matrix */ |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
855 |
w->vscroll.cap += e->sizing.diff.y / 14; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
856 |
w->hscroll.cap += e->sizing.diff.x / 56; |
4547
9786a24c4102
(svn r6379) -Codechange: cast 'remove babel' on widget's unkA and rename it to 'data'.
Darkvater
parents:
4541
diff
changeset
|
857 |
w->widget[5].data = (w->vscroll.cap << 8) + w->hscroll.cap; |
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
858 |
break; |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
859 |
|
0 | 860 |
} |
861 |
} |
|
862 |
||
863 |
static const Widget _road_depot_widgets[] = { |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
864 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
865 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 302, 0, 13, STR_9003_ROAD_VEHICLE_DEPOT, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
866 |
{ WWT_STICKYBOX, RESIZE_LR, 14, 303, 314, 0, 13, 0x0, STR_STICKY_BUTTON}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
867 |
{ WWT_PANEL, RESIZE_LRB, 14, 280, 302, 14, 13, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
868 |
{ WWT_IMGBTN, RESIZE_LRTB, 14, 280, 302, 14, 55, 0x2A9, STR_9024_DRAG_ROAD_VEHICLE_TO_HERE}, |
982
be834034b331
(svn r1478) -Fix: [1099195] mouse-wheel in train replace window. Scrollbar1 and Scrollbar2 now work independently. You can only scroll on list and scrollbar itself; scrollbar must be next widget of the list.
darkvater
parents:
971
diff
changeset
|
869 |
|
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
870 |
{ WWT_MATRIX, RESIZE_RB, 14, 0, 279, 14, 55, 0x305, STR_9022_VEHICLES_CLICK_ON_VEHICLE}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
871 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 303, 314, 14, 55, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
872 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 100, 56, 67, STR_9004_NEW_VEHICLES, STR_9023_BUILD_NEW_ROAD_VEHICLE}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
873 |
{WWT_NODISTXTBTN, RESIZE_TB, 14, 101, 200, 56, 67, STR_CLONE_ROAD_VEHICLE, STR_CLONE_ROAD_VEHICLE_DEPOT_INFO}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
874 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 201, 302, 56, 67, STR_00E4_LOCATION, STR_9025_CENTER_MAIN_VIEW_ON_ROAD}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
875 |
{ WWT_PANEL, RESIZE_RTB, 14, 303, 302, 56, 67, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
876 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 303, 314, 56, 67, 0x0, STR_RESIZE_BUTTON}, |
176
84990c4b9212
(svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents:
174
diff
changeset
|
877 |
{ WIDGETS_END}, |
0 | 878 |
}; |
879 |
||
880 |
static const WindowDesc _road_depot_desc = { |
|
881 |
-1, -1, 315, 68, |
|
882 |
WC_VEHICLE_DEPOT,0, |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
883 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
0 | 884 |
_road_depot_widgets, |
885 |
RoadDepotWndProc |
|
886 |
}; |
|
887 |
||
1977
4392ae3d8e31
(svn r2483) Replace almost 500 "uint tile" (and variants) with "TileIndex tile"
tron
parents:
1962
diff
changeset
|
888 |
void ShowRoadDepotWindow(TileIndex tile) |
0 | 889 |
{ |
4171 | 890 |
Window *w = AllocateWindowDescFront(&_road_depot_desc, tile); |
193
0a7025304867
(svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents:
176
diff
changeset
|
891 |
|
4077
d3022f976946
(svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents:
4012
diff
changeset
|
892 |
if (w != NULL) { |
1901
fb05044cf5c3
(svn r2407) Use {Get,Is}TileOwner to get/check the owner of a tile and fix some bogus reads of _map_owner
tron
parents:
1891
diff
changeset
|
893 |
w->caption_color = GetTileOwner(w->window_number); |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
894 |
w->hscroll.cap = 5; |
0 | 895 |
w->vscroll.cap = 3; |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
896 |
w->resize.step_width = 56; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
897 |
w->resize.step_height = 14; |
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
898 |
WP(w,traindepot_d).sel = INVALID_VEHICLE; |
0 | 899 |
_backup_orders_tile = 0; |
900 |
} |
|
901 |
} |
|
902 |
||
4456
0590b6294847
(svn r6239) -Code cleanup: cleaned up PlayerVehWndProc
bjarni
parents:
4449
diff
changeset
|
903 |
static const Widget _player_roadveh_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
904 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
905 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 247, 0, 13, STR_9001_ROAD_VEHICLES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
906 |
{ WWT_STICKYBOX, RESIZE_LR, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
907 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 80, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
908 |
{ WWT_PANEL, RESIZE_NONE, 14, 81, 235, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
909 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 236, 247, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
910 |
{ WWT_PANEL, RESIZE_RIGHT, 14, 248, 259, 14, 25, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
911 |
{ WWT_MATRIX, RESIZE_RB, 14, 0, 247, 26, 207, 0x701, STR_901A_ROAD_VEHICLES_CLICK_ON}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
912 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 248, 259, 26, 207, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
4506
0d8fcc0a4e49
(svn r6291) -Feature: Vehicle lists from the station window now also got the goto depot button
bjarni
parents:
4473
diff
changeset
|
913 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 0, 124, 208, 219, STR_SEND_TO_DEPOTS, STR_SEND_TO_DEPOTS_TIP}, |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
914 |
{ WWT_PUSHTXTBTN, RESIZE_TB, 14, 125, 247, 208, 219, STR_REPLACE_VEHICLES, STR_REPLACE_HELP}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
915 |
{ WWT_PANEL, RESIZE_RTB, 14, 248, 247, 208, 219, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
916 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 248, 259, 208, 219, 0x0, STR_RESIZE_BUTTON}, |
588 | 917 |
{ WIDGETS_END}, |
918 |
}; |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
919 |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
920 |
static const Widget _other_player_roadveh_widgets[] = { |
4344
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
921 |
{ WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
922 |
{ WWT_CAPTION, RESIZE_RIGHT, 14, 11, 247, 0, 13, STR_9001_ROAD_VEHICLES, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
923 |
{ WWT_STICKYBOX, RESIZE_LR, 14, 248, 259, 0, 13, 0x0, STR_STICKY_BUTTON}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
924 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 80, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
925 |
{ WWT_PANEL, RESIZE_NONE, 14, 81, 235, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
926 |
{ WWT_TEXTBTN, RESIZE_NONE, 14, 236, 247, 14, 25, STR_0225, STR_SORT_CRITERIA_TIP}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
927 |
{ WWT_PANEL, RESIZE_RIGHT, 14, 248, 259, 14, 25, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
928 |
{ WWT_MATRIX, RESIZE_RB, 14, 0, 247, 26, 207, 0x701, STR_901A_ROAD_VEHICLES_CLICK_ON}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
929 |
{ WWT_SCROLLBAR, RESIZE_LRB, 14, 248, 259, 26, 207, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
930 |
{ WWT_PANEL, RESIZE_RTB, 14, 0, 247, 208, 219, 0x0, STR_NULL}, |
5d0e40cd67b9
(svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents:
4329
diff
changeset
|
931 |
{ WWT_RESIZEBOX, RESIZE_LRTB, 14, 248, 259, 208, 219, 0x0, STR_RESIZE_BUTTON}, |
588 | 932 |
{ WIDGETS_END}, |
933 |
}; |
|
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
934 |
|
0 | 935 |
static const WindowDesc _player_roadveh_desc = { |
164
0cbdf3c9bde1
(svn r165) -Feature: Option to sort vehicles in vehicle-list window by different criteria. Total independent sort for all types and players. Periodic resort of list every 10 TTD days. Thank you for your graphical inspiration follow and buxo (since none of you provided any code).
darkvater
parents:
156
diff
changeset
|
936 |
-1, -1, 260, 220, |
0 | 937 |
WC_ROADVEH_LIST,0, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
938 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
0 | 939 |
_player_roadveh_widgets, |
4442
8d8d0c2df7cb
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4434
diff
changeset
|
940 |
PlayerVehWndProc |
0 | 941 |
}; |
942 |
||
943 |
static const WindowDesc _other_player_roadveh_desc = { |
|
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
944 |
-1, -1, 260, 220, |
0 | 945 |
WC_ROADVEH_LIST,0, |
867
581154a08a78
(svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents:
842
diff
changeset
|
946 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
0 | 947 |
_other_player_roadveh_widgets, |
4442
8d8d0c2df7cb
(svn r6215) -Codechange: [vehicle list windows] unified Player(vehicle)WndProc into PlayerVehWndProc
bjarni
parents:
4434
diff
changeset
|
948 |
PlayerVehWndProc |
0 | 949 |
}; |
950 |
||
951 |
||
4414
ed5b85ff5b0a
(svn r6167) -Code cleanup r6161: replaced some uint16 with OrderID and (1 << 8) with SHARE_FLAG
bjarni
parents:
4412
diff
changeset
|
952 |
static void ShowPlayerRoadVehiclesLocal(PlayerID player, StationID station, OrderID order, bool show_shared) |
0 | 953 |
{ |
954 |
Window *w; |
|
955 |
||
4408
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
956 |
if (show_shared) { |
4456
0590b6294847
(svn r6239) -Code cleanup: cleaned up PlayerVehWndProc
bjarni
parents:
4449
diff
changeset
|
957 |
w = AllocateWindowDescFront(&_player_roadveh_desc, (order << 16) | (VEH_Road << 11) | VLW_SHARED_ORDERS | player); |
4408
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
958 |
} else { |
4449
7b1d5a6d15be
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
959 |
uint16 VLW_flag = (station == INVALID_STATION) ? VLW_STANDARD : VLW_STATION_LIST; |
7b1d5a6d15be
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
960 |
if (player == _local_player) { |
7b1d5a6d15be
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
961 |
w = AllocateWindowDescFront(&_player_roadveh_desc, (station << 16) | (VEH_Road << 11) | VLW_flag | player); |
4408
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
962 |
} else { |
4449
7b1d5a6d15be
(svn r6227) -Codechange: added window type flags to use with PlayerVehWndProc
bjarni
parents:
4442
diff
changeset
|
963 |
w = AllocateWindowDescFront(&_other_player_roadveh_desc, (station << 16) | (VEH_Road << 11) | VLW_flag | player); |
4408
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
964 |
} |
0 | 965 |
} |
966 |
} |
|
4408
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
967 |
|
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
968 |
void ShowPlayerRoadVehicles(PlayerID player, StationID station) |
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
969 |
{ |
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
970 |
ShowPlayerRoadVehiclesLocal(player, station, 0, false); |
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
971 |
} |
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
972 |
|
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
973 |
void ShowVehWithSharedOrdersRoadVehicles(Vehicle *v) |
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
974 |
{ |
4434
4175805666a5
(svn r6204) -Cleanup: replace non-indentation with spaces; like '}<TAB>else {' -> '} else {', tabs between code and comment, etc.
rubidium
parents:
4426
diff
changeset
|
975 |
if (v->orders == NULL) return; // no shared list to show |
4408
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
976 |
ShowPlayerRoadVehiclesLocal(v->owner, INVALID_STATION, v->orders->index, true); |
84ec2899adfa
(svn r6161) -Feature: List of vehicles with the same shared orders
bjarni
parents:
4389
diff
changeset
|
977 |
} |