author | peter1138 |
Sun, 03 Aug 2008 17:35:08 +0000 | |
changeset 9834 | 7474149531c1 |
parent 9744 | a1964a9acb91 |
child 9913 | d9ce89020cc0 |
permissions | -rw-r--r-- |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
1 |
/* $Id$ */ |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
2 |
|
9111
48ce04029fe4
(svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents:
8974
diff
changeset
|
3 |
/** @file group_gui.cpp GUI for the group window. */ |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
4 |
|
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
5 |
#include "stdafx.h" |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
6 |
#include "openttd.h" |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
7 |
#include "gui.h" |
8107
bb7deea89175
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8106
diff
changeset
|
8 |
#include "window_gui.h" |
bb7deea89175
(svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents:
8106
diff
changeset
|
9 |
#include "textbuf_gui.h" |
8116
8da76dcb3287
(svn r11677) -Codechange: move price and command related types/functions to their respective places.
rubidium
parents:
8114
diff
changeset
|
10 |
#include "command_func.h" |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
11 |
#include "vehicle_gui.h" |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
12 |
#include "train.h" |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
13 |
#include "group.h" |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
14 |
#include "debug.h" |
8114
dd6d21dc99c1
(svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents:
8110
diff
changeset
|
15 |
#include "strings_func.h" |
8130
d2eb7d04f6e1
(svn r11691) -Codechange: move+rename helpers.hpp and only include it when it is really needed.
rubidium
parents:
8121
diff
changeset
|
16 |
#include "core/alloc_func.hpp" |
8131
160939e24ed3
(svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents:
8130
diff
changeset
|
17 |
#include "window_func.h" |
8144
65cec0877b78
(svn r11706) -Codechange: split vehicle.h and remove another bunch of useless includes.
rubidium
parents:
8140
diff
changeset
|
18 |
#include "vehicle_func.h" |
8212
cf3fce5c7464
(svn r11775) -Codechange: move all autoreplace/autorenew functions to a single location.
rubidium
parents:
8179
diff
changeset
|
19 |
#include "autoreplace_gui.h" |
8214
971f861d5543
(svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents:
8212
diff
changeset
|
20 |
#include "string_func.h" |
8224
c5a64d87cc54
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8214
diff
changeset
|
21 |
#include "viewport_func.h" |
c5a64d87cc54
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents:
8214
diff
changeset
|
22 |
#include "gfx_func.h" |
8254
1496654ca5e7
(svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents:
8237
diff
changeset
|
23 |
#include "player_func.h" |
8315
bfa951865513
(svn r11880) -Codechange: Generate vehicle group action dropdown dynamically, and assign an enum for the function return codes.
peter1138
parents:
8314
diff
changeset
|
24 |
#include "widgets/dropdown_type.h" |
8284
ebdc5ba08874
(svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents:
8264
diff
changeset
|
25 |
#include "widgets/dropdown_func.h" |
9127
14f21c5954ee
(svn r12987) -Codechange: split viewport and tile selection.
rubidium
parents:
9116
diff
changeset
|
26 |
#include "tilehighlight_func.h" |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
27 |
|
8264
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
28 |
#include "table/strings.h" |
b1e85998c7d3
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents:
8254
diff
changeset
|
29 |
#include "table/sprites.h" |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
30 |
|
9182
412cb6c0caf1
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents:
9143
diff
changeset
|
31 |
typedef GUIList<const Group*> GUIGroupList; |
8770
ea070bc7bdad
(svn r12469) -Codechange: split type related stuff from group.h (and openttd.h) to group_type.h.
rubidium
parents:
8701
diff
changeset
|
32 |
|
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
33 |
enum GroupListWidgets { |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
34 |
GRP_WIDGET_CLOSEBOX = 0, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
35 |
GRP_WIDGET_CAPTION, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
36 |
GRP_WIDGET_STICKY, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
37 |
GRP_WIDGET_EMPTY_TOP_LEFT, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
38 |
GRP_WIDGET_ALL_VEHICLES, |
7258
8ea218277d00
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
rubidium
parents:
7134
diff
changeset
|
39 |
GRP_WIDGET_DEFAULT_VEHICLES, |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
40 |
GRP_WIDGET_LIST_GROUP, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
41 |
GRP_WIDGET_LIST_GROUP_SCROLLBAR, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
42 |
GRP_WIDGET_SORT_BY_ORDER, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
43 |
GRP_WIDGET_SORT_BY_DROPDOWN, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
44 |
GRP_WIDGET_EMPTY_TOP_RIGHT, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
45 |
GRP_WIDGET_LIST_VEHICLE, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
46 |
GRP_WIDGET_LIST_VEHICLE_SCROLLBAR, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
47 |
GRP_WIDGET_CREATE_GROUP, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
48 |
GRP_WIDGET_DELETE_GROUP, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
49 |
GRP_WIDGET_RENAME_GROUP, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
50 |
GRP_WIDGET_EMPTY1, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
51 |
GRP_WIDGET_REPLACE_PROTECTION, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
52 |
GRP_WIDGET_EMPTY2, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
53 |
GRP_WIDGET_AVAILABLE_VEHICLES, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
54 |
GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
55 |
GRP_WIDGET_STOP_ALL, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
56 |
GRP_WIDGET_START_ALL, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
57 |
GRP_WIDGET_EMPTY_BOTTOM_RIGHT, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
58 |
GRP_WIDGET_RESIZE, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
59 |
}; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
60 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
61 |
enum GroupActionListFunction { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
62 |
GALF_REPLACE, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
63 |
GALF_SERVICE, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
64 |
GALF_DEPOT, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
65 |
GALF_ADD_SHARED, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
66 |
GALF_REMOVE_ALL, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
67 |
}; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
68 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
69 |
/** |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
70 |
* Update/redraw the group action dropdown |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
71 |
* @param w the window the dropdown belongs to |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
72 |
* @param gid the currently selected group in the window |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
73 |
*/ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
74 |
static void ShowGroupActionDropdown(Window *w, GroupID gid) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
75 |
{ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
76 |
DropDownList *list = new DropDownList(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
77 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
78 |
list->push_back(new DropDownListStringItem(STR_REPLACE_VEHICLES, GALF_REPLACE, false)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
79 |
list->push_back(new DropDownListStringItem(STR_SEND_FOR_SERVICING, GALF_SERVICE, false)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
80 |
list->push_back(new DropDownListStringItem(STR_SEND_TRAIN_TO_DEPOT, GALF_DEPOT, false)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
81 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
82 |
if (IsValidGroupID(gid)) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
83 |
list->push_back(new DropDownListStringItem(STR_GROUP_ADD_SHARED_VEHICLE, GALF_ADD_SHARED, false)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
84 |
list->push_back(new DropDownListStringItem(STR_GROUP_REMOVE_ALL_VEHICLES, GALF_REMOVE_ALL, false)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
85 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
86 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
87 |
ShowDropDownList(w, list, 0, GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
88 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
89 |
|
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
90 |
|
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
91 |
static const Widget _group_widgets[] = { |
9744
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
92 |
{ WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
93 |
{ WWT_CAPTION, RESIZE_RIGHT, COLOUR_GREY, 11, 447, 0, 13, 0x0, STR_018C_WINDOW_TITLE_DRAG_THIS}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
94 |
{ WWT_STICKYBOX, RESIZE_LR, COLOUR_GREY, 448, 459, 0, 13, 0x0, STR_STICKY_BUTTON}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
95 |
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 200, 14, 25, 0x0, STR_NULL}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
96 |
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 200, 26, 38, 0x0, STR_NULL}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
97 |
{ WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 200, 39, 51, 0x0, STR_NULL}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
98 |
{ WWT_MATRIX, RESIZE_BOTTOM, COLOUR_GREY, 0, 188, 52, 168, 0x701, STR_GROUPS_CLICK_ON_GROUP_FOR_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
99 |
{ WWT_SCROLLBAR, RESIZE_BOTTOM, COLOUR_GREY, 189, 200, 52, 168, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
100 |
{ WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 201, 281, 14, 25, STR_SORT_BY, STR_SORT_ORDER_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
101 |
{ WWT_DROPDOWN, RESIZE_NONE, COLOUR_GREY, 282, 447, 14, 25, 0x0, STR_SORT_CRITERIA_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
102 |
{ WWT_PANEL, RESIZE_RIGHT, COLOUR_GREY, 448, 459, 14, 25, 0x0, STR_NULL}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
103 |
{ WWT_MATRIX, RESIZE_RB, COLOUR_GREY, 201, 447, 26, 181, 0x701, STR_NULL}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
104 |
{ WWT_SCROLL2BAR, RESIZE_LRB, COLOUR_GREY, 448, 459, 26, 181, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
105 |
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 0, 23, 169, 193, 0x0, STR_GROUP_CREATE_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
106 |
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 24, 47, 169, 193, 0x0, STR_GROUP_DELETE_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
107 |
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 48, 71, 169, 193, 0x0, STR_GROUP_RENAME_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
108 |
{ WWT_PANEL, RESIZE_TB, COLOUR_GREY, 72, 164, 169, 193, 0x0, STR_NULL}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
109 |
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 165, 188, 169, 193, 0x0, STR_GROUP_REPLACE_PROTECTION_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
110 |
{ WWT_PANEL, RESIZE_TB, COLOUR_GREY, 189, 200, 169, 193, 0x0, STR_NULL}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
111 |
{ WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_GREY, 201, 306, 182, 193, 0x0, STR_AVAILABLE_ENGINES_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
112 |
{ WWT_DROPDOWN, RESIZE_TB, COLOUR_GREY, 307, 423, 182, 193, STR_MANAGE_LIST, STR_MANAGE_LIST_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
113 |
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 424, 435, 182, 193, SPR_FLAG_VEH_STOPPED, STR_MASS_STOP_LIST_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
114 |
{ WWT_PUSHIMGBTN, RESIZE_TB, COLOUR_GREY, 436, 447, 182, 193, SPR_FLAG_VEH_RUNNING, STR_MASS_START_LIST_TIP}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
115 |
{ WWT_PANEL, RESIZE_RTB, COLOUR_GREY, 448, 447, 182, 193, 0x0, STR_NULL}, |
a1964a9acb91
(svn r13879) -Codechange: Replace numbers with Colours enum on engine, industries and group gui
belugas
parents:
9652
diff
changeset
|
116 |
{ WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_GREY, 448, 459, 182, 193, 0x0, STR_RESIZE_BUTTON}, |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
117 |
{ WIDGETS_END}, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
118 |
}; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
119 |
|
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
120 |
|
9369
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
121 |
class VehicleGroupWindow : public Window, public VehicleListBase { |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
122 |
private: |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
123 |
GroupID group_sel; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
124 |
VehicleID vehicle_sel; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
125 |
GUIGroupList groups; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
126 |
|
9369
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
127 |
/** |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
128 |
* (Re)Build the group list. |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
129 |
* |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
130 |
* @param owner The owner of the window |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
131 |
*/ |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
132 |
void BuildGroupList(PlayerID owner) |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
133 |
{ |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
134 |
if (!this->groups.NeedRebuild()) return; |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
135 |
|
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
136 |
this->groups.Clear(); |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
137 |
|
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
138 |
const Group *g; |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
139 |
FOR_ALL_GROUPS(g) { |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
140 |
if (g->owner == owner && g->vehicle_type == this->vehicle_type) { |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
141 |
*this->groups.Append() = g; |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
142 |
} |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
143 |
} |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
144 |
|
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
145 |
this->groups.Compact(); |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
146 |
this->groups.RebuildDone(); |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
147 |
} |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
148 |
|
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
149 |
/** Sort the groups by their name */ |
9376
afdc4beedc99
(svn r13280) -Fix (r13276): MSVC compilation was broken
smatz
parents:
9369
diff
changeset
|
150 |
static int CDECL GroupNameSorter(const Group* const *a, const Group* const *b) |
9369
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
151 |
{ |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
152 |
static const Group *last_group[2] = { NULL, NULL }; |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
153 |
static char last_name[2][64] = { "", "" }; |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
154 |
|
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
155 |
if (*a != last_group[0]) { |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
156 |
last_group[0] = *a; |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
157 |
SetDParam(0, (*a)->index); |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
158 |
GetString(last_name[0], STR_GROUP_NAME, lastof(last_name[0])); |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
159 |
} |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
160 |
|
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
161 |
if (*b != last_group[1]) { |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
162 |
last_group[1] = *b; |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
163 |
SetDParam(0, (*b)->index); |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
164 |
GetString(last_name[1], STR_GROUP_NAME, lastof(last_name[1])); |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
165 |
} |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
166 |
|
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
167 |
int r = strcmp(last_name[0], last_name[1]); // sort by name |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
168 |
if (r == 0) return (*a)->index - (*b)->index; |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
169 |
return r; |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
170 |
} |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
171 |
|
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
172 |
public: |
9203
082fbf0500c4
(svn r13069) -Codechange: it is no longer needed to pass a void *data pointer with the WE_CREATE message because nothing uses it anymore.
rubidium
parents:
9183
diff
changeset
|
173 |
VehicleGroupWindow(const WindowDesc *desc, WindowNumber window_number) : Window(desc, window_number) |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
174 |
{ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
175 |
const PlayerID owner = (PlayerID)GB(this->window_number, 0, 8); |
9212
5f56a631a668
(svn r13078) -Fix: group gui used the vehicle type before it was actually set.
rubidium
parents:
9203
diff
changeset
|
176 |
this->vehicle_type = (VehicleType)GB(this->window_number, 11, 5); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
177 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
178 |
this->caption_color = owner; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
179 |
this->resize.step_width = 1; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
180 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
181 |
switch (this->vehicle_type) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
182 |
default: NOT_REACHED(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
183 |
case VEH_TRAIN: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
184 |
case VEH_ROAD: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
185 |
this->vscroll.cap = 9; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
186 |
this->vscroll2.cap = 6; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
187 |
this->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_SMALL; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
188 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
189 |
case VEH_SHIP: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
190 |
case VEH_AIRCRAFT: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
191 |
this->vscroll.cap = 9; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
192 |
this->vscroll2.cap = 4; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
193 |
this->resize.step_height = PLY_WND_PRC__SIZE_OF_ROW_BIG2; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
194 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
195 |
} |
8315
bfa951865513
(svn r11880) -Codechange: Generate vehicle group action dropdown dynamically, and assign an enum for the function return codes.
peter1138
parents:
8314
diff
changeset
|
196 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
197 |
this->widget[GRP_WIDGET_LIST_GROUP].data = (this->vscroll.cap << 8) + 1; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
198 |
this->widget[GRP_WIDGET_LIST_VEHICLE].data = (this->vscroll2.cap << 8) + 1; |
6660
b892af29d891
(svn r9891) -Fix [FS#787]: the manage list menu wasn't removed/updated when changing to another group making it able to perform "group" actions for "all vehicles", which would cause a crash.
rubidium
parents:
6643
diff
changeset
|
199 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
200 |
switch (this->vehicle_type) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
201 |
default: NOT_REACHED(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
202 |
case VEH_TRAIN: this->sorting = &_sorting.train; break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
203 |
case VEH_ROAD: this->sorting = &_sorting.roadveh; break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
204 |
case VEH_SHIP: this->sorting = &_sorting.ship; break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
205 |
case VEH_AIRCRAFT: this->sorting = &_sorting.aircraft; break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
206 |
} |
6660
b892af29d891
(svn r9891) -Fix [FS#787]: the manage list menu wasn't removed/updated when changing to another group making it able to perform "group" actions for "all vehicles", which would cause a crash.
rubidium
parents:
6643
diff
changeset
|
207 |
|
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
208 |
this->vehicles.SetListing(*this->sorting); |
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
209 |
this->vehicles.ForceRebuild(); |
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
210 |
this->vehicles.NeedResort(); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
211 |
|
9369
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
212 |
this->groups.ForceRebuild(); |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
213 |
this->groups.NeedResort(); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
214 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
215 |
this->group_sel = ALL_GROUP; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
216 |
this->vehicle_sel = INVALID_VEHICLE; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
217 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
218 |
switch (this->vehicle_type) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
219 |
case VEH_TRAIN: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
220 |
this->widget[GRP_WIDGET_LIST_VEHICLE].tooltips = STR_883D_TRAINS_CLICK_ON_TRAIN_FOR; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
221 |
this->widget[GRP_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_TRAINS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
222 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
223 |
this->widget[GRP_WIDGET_CREATE_GROUP].data = SPR_GROUP_CREATE_TRAIN; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
224 |
this->widget[GRP_WIDGET_RENAME_GROUP].data = SPR_GROUP_RENAME_TRAIN; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
225 |
this->widget[GRP_WIDGET_DELETE_GROUP].data = SPR_GROUP_DELETE_TRAIN; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
226 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
227 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
228 |
case VEH_ROAD: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
229 |
this->widget[GRP_WIDGET_LIST_VEHICLE].tooltips = STR_901A_ROAD_VEHICLES_CLICK_ON; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
230 |
this->widget[GRP_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_ROAD_VEHICLES; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
231 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
232 |
this->widget[GRP_WIDGET_CREATE_GROUP].data = SPR_GROUP_CREATE_ROADVEH; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
233 |
this->widget[GRP_WIDGET_RENAME_GROUP].data = SPR_GROUP_RENAME_ROADVEH; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
234 |
this->widget[GRP_WIDGET_DELETE_GROUP].data = SPR_GROUP_DELETE_ROADVEH; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
235 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
236 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
237 |
case VEH_SHIP: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
238 |
this->widget[GRP_WIDGET_LIST_VEHICLE].tooltips = STR_9823_SHIPS_CLICK_ON_SHIP_FOR; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
239 |
this->widget[GRP_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_SHIPS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
240 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
241 |
this->widget[GRP_WIDGET_CREATE_GROUP].data = SPR_GROUP_CREATE_SHIP; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
242 |
this->widget[GRP_WIDGET_RENAME_GROUP].data = SPR_GROUP_RENAME_SHIP; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
243 |
this->widget[GRP_WIDGET_DELETE_GROUP].data = SPR_GROUP_DELETE_SHIP; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
244 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
245 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
246 |
case VEH_AIRCRAFT: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
247 |
this->widget[GRP_WIDGET_LIST_VEHICLE].tooltips = STR_A01F_AIRCRAFT_CLICK_ON_AIRCRAFT; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
248 |
this->widget[GRP_WIDGET_AVAILABLE_VEHICLES].data = STR_AVAILABLE_AIRCRAFT; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
249 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
250 |
this->widget[GRP_WIDGET_CREATE_GROUP].data = SPR_GROUP_CREATE_AIRCRAFT; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
251 |
this->widget[GRP_WIDGET_RENAME_GROUP].data = SPR_GROUP_RENAME_AIRCRAFT; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
252 |
this->widget[GRP_WIDGET_DELETE_GROUP].data = SPR_GROUP_DELETE_AIRCRAFT; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
253 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
254 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
255 |
default: NOT_REACHED(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
256 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
257 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
258 |
this->FindWindowPlacementAndResize(desc); |
8315
bfa951865513
(svn r11880) -Codechange: Generate vehicle group action dropdown dynamically, and assign an enum for the function return codes.
peter1138
parents:
8314
diff
changeset
|
259 |
} |
bfa951865513
(svn r11880) -Codechange: Generate vehicle group action dropdown dynamically, and assign an enum for the function return codes.
peter1138
parents:
8314
diff
changeset
|
260 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
261 |
~VehicleGroupWindow() |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
262 |
{ |
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
263 |
*this->sorting = this->vehicles.GetListing(); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
264 |
} |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
265 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
266 |
virtual void OnInvalidateData(int data) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
267 |
{ |
9369
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
268 |
if (data == 0) { |
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
269 |
this->vehicles.ForceRebuild(); |
9369
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
270 |
this->groups.ForceRebuild(); |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
271 |
} else { |
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
272 |
this->vehicles.ForceResort(); |
9369
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
273 |
this->groups.ForceResort(); |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
274 |
} |
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
275 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
276 |
if (!(IsAllGroupID(this->group_sel) || IsDefaultGroupID(this->group_sel) || IsValidGroupID(this->group_sel))) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
277 |
this->group_sel = ALL_GROUP; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
278 |
HideDropDownMenu(this); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
279 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
280 |
this->SetDirty(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
281 |
} |
6667 | 282 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
283 |
virtual void OnPaint() |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
284 |
{ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
285 |
const PlayerID owner = (PlayerID)GB(this->window_number, 0, 8); |
9408
e9ac1e9138e1
(svn r13319) -Codechange: Remove use of imaginary horizontal scrollbar in the group vehicle list
peter1138
parents:
9376
diff
changeset
|
286 |
int x = this->widget[GRP_WIDGET_LIST_VEHICLE].left + 2; |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
287 |
int y2 = PLY_WND_PRC__OFFSET_TOP_WIDGET; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
288 |
int y1 = PLY_WND_PRC__OFFSET_TOP_WIDGET + 2; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
289 |
int max; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
290 |
int i; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
291 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
292 |
/* If we select the all vehicles, this->list will contain all vehicles of the player |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
293 |
* else this->list will contain all vehicles which belong to the selected group */ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
294 |
BuildVehicleList(this, owner, this->group_sel, IsAllGroupID(this->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
295 |
SortVehicleList(this); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
296 |
|
9369
1c3d22cfdeb5
(svn r13271) -Codechange: groups sorting uses GUILists Sort() now
skidd13
parents:
9368
diff
changeset
|
297 |
this->BuildGroupList(owner); |
9376
afdc4beedc99
(svn r13280) -Fix (r13276): MSVC compilation was broken
smatz
parents:
9369
diff
changeset
|
298 |
this->groups.Sort(&GroupNameSorter); |
7890
4209769a14d8
(svn r11441) -Fix [FS#1443]: manage list dropdown menu did not "disappear" when the all vehicles are removed from the "current" group.
rubidium
parents:
7889
diff
changeset
|
299 |
|
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
300 |
SetVScrollCount(this, this->groups.Length()); |
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
301 |
SetVScroll2Count(this, this->vehicles.Length()); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
302 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
303 |
/* The drop down menu is out, *but* it may not be used, retract it. */ |
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
304 |
if (this->vehicles.Length() == 0 && this->IsWidgetLowered(GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN)) { |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
305 |
this->RaiseWidget(GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
306 |
HideDropDownMenu(this); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
307 |
} |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
308 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
309 |
/* Disable all lists management button when the list is empty */ |
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
310 |
this->SetWidgetsDisabledState(this->vehicles.Length() == 0 || _local_player != owner, |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
311 |
GRP_WIDGET_STOP_ALL, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
312 |
GRP_WIDGET_START_ALL, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
313 |
GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
314 |
WIDGET_LIST_END); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
315 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
316 |
/* Disable the group specific function when we select the default group or all vehicles */ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
317 |
this->SetWidgetsDisabledState(IsDefaultGroupID(this->group_sel) || IsAllGroupID(this->group_sel) || _local_player != owner, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
318 |
GRP_WIDGET_DELETE_GROUP, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
319 |
GRP_WIDGET_RENAME_GROUP, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
320 |
GRP_WIDGET_REPLACE_PROTECTION, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
321 |
WIDGET_LIST_END); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
322 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
323 |
/* Disable remaining buttons for non-local player |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
324 |
* Needed while changing _local_player, eg. by cheats |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
325 |
* All procedures (eg. move vehicle to another group) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
326 |
* verify, whether you are the owner of the vehicle, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
327 |
* so it doesn't have to be disabled |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
328 |
*/ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
329 |
this->SetWidgetsDisabledState(_local_player != owner, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
330 |
GRP_WIDGET_CREATE_GROUP, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
331 |
GRP_WIDGET_AVAILABLE_VEHICLES, |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
332 |
WIDGET_LIST_END); |
7547
93b6e6de2898
(svn r11067) -Codechange: also make it possible to use the advanced vehicle list for other players. Patch by SmatZ.
rubidium
parents:
7490
diff
changeset
|
333 |
|
93b6e6de2898
(svn r11067) -Codechange: also make it possible to use the advanced vehicle list for other players. Patch by SmatZ.
rubidium
parents:
7490
diff
changeset
|
334 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
335 |
/* If selected_group == DEFAULT_GROUP || ALL_GROUP, draw the standard caption |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
336 |
We list all vehicles or ungrouped vehicles */ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
337 |
if (IsDefaultGroupID(this->group_sel) || IsAllGroupID(this->group_sel)) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
338 |
SetDParam(0, owner); |
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
339 |
SetDParam(1, this->vehicles.Length()); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
340 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
341 |
switch (this->vehicle_type) { |
7258
8ea218277d00
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
rubidium
parents:
7134
diff
changeset
|
342 |
case VEH_TRAIN: |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
343 |
this->widget[GRP_WIDGET_CAPTION].data = STR_881B_TRAINS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
344 |
this->widget[GRP_WIDGET_REPLACE_PROTECTION].data = SPR_GROUP_REPLACE_OFF_TRAIN; |
7258
8ea218277d00
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
rubidium
parents:
7134
diff
changeset
|
345 |
break; |
8ea218277d00
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
rubidium
parents:
7134
diff
changeset
|
346 |
case VEH_ROAD: |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
347 |
this->widget[GRP_WIDGET_CAPTION].data = STR_9001_ROAD_VEHICLES; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
348 |
this->widget[GRP_WIDGET_REPLACE_PROTECTION].data = SPR_GROUP_REPLACE_OFF_ROADVEH; |
7258
8ea218277d00
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
rubidium
parents:
7134
diff
changeset
|
349 |
break; |
8ea218277d00
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
rubidium
parents:
7134
diff
changeset
|
350 |
case VEH_SHIP: |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
351 |
this->widget[GRP_WIDGET_CAPTION].data = STR_9805_SHIPS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
352 |
this->widget[GRP_WIDGET_REPLACE_PROTECTION].data = SPR_GROUP_REPLACE_OFF_SHIP; |
7258
8ea218277d00
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
rubidium
parents:
7134
diff
changeset
|
353 |
break; |
8ea218277d00
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
rubidium
parents:
7134
diff
changeset
|
354 |
case VEH_AIRCRAFT: |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
355 |
this->widget[GRP_WIDGET_CAPTION].data = STR_A009_AIRCRAFT; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
356 |
this->widget[GRP_WIDGET_REPLACE_PROTECTION].data = SPR_GROUP_REPLACE_OFF_AIRCRAFT; |
7258
8ea218277d00
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
rubidium
parents:
7134
diff
changeset
|
357 |
break; |
8970
da7261f48b7e
(svn r12762) -Fix: tabs after the first non-tab character are generally not okay (or lines starting with a space and then tabs).
rubidium
parents:
8962
diff
changeset
|
358 |
default: NOT_REACHED(); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
359 |
} |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
360 |
} else { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
361 |
const Group *g = GetGroup(this->group_sel); |
8349
e61105cb1f87
(svn r11915) -Codechange: Add a function to draw a sort button's up/down arrow. Arrows are now drawn in a consistent position based on the widget, instead of randomly positioned by pixel.
peter1138
parents:
8338
diff
changeset
|
362 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
363 |
SetDParam(0, g->index); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
364 |
SetDParam(1, g->num_vehicle); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
365 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
366 |
switch (this->vehicle_type) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
367 |
case VEH_TRAIN: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
368 |
this->widget[GRP_WIDGET_CAPTION].data = STR_GROUP_TRAINS_CAPTION; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
369 |
this->widget[GRP_WIDGET_REPLACE_PROTECTION].data = (g->replace_protection) ? SPR_GROUP_REPLACE_ON_TRAIN : SPR_GROUP_REPLACE_OFF_TRAIN; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
370 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
371 |
case VEH_ROAD: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
372 |
this->widget[GRP_WIDGET_CAPTION].data = STR_GROUP_ROADVEH_CAPTION; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
373 |
this->widget[GRP_WIDGET_REPLACE_PROTECTION].data = (g->replace_protection) ? SPR_GROUP_REPLACE_ON_ROADVEH : SPR_GROUP_REPLACE_OFF_ROADVEH; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
374 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
375 |
case VEH_SHIP: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
376 |
this->widget[GRP_WIDGET_CAPTION].data = STR_GROUP_SHIPS_CAPTION; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
377 |
this->widget[GRP_WIDGET_REPLACE_PROTECTION].data = (g->replace_protection) ? SPR_GROUP_REPLACE_ON_SHIP : SPR_GROUP_REPLACE_OFF_SHIP; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
378 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
379 |
case VEH_AIRCRAFT: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
380 |
this->widget[GRP_WIDGET_CAPTION].data = STR_GROUP_AIRCRAFTS_CAPTION; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
381 |
this->widget[GRP_WIDGET_REPLACE_PROTECTION].data = (g->replace_protection) ? SPR_GROUP_REPLACE_ON_AIRCRAFT : SPR_GROUP_REPLACE_OFF_AIRCRAFT; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
382 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
383 |
default: NOT_REACHED(); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
384 |
} |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
385 |
} |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
386 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
387 |
/* Set text of sort by dropdown */ |
9563
c75bee824deb
(svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents:
9530
diff
changeset
|
388 |
this->widget[GRP_WIDGET_SORT_BY_DROPDOWN].data = this->vehicle_sorter_names[this->vehicles.SortType()]; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
389 |
|
9273
35e0224ea8f1
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents:
9212
diff
changeset
|
390 |
this->DrawWidgets(); |
7258
8ea218277d00
(svn r10567) -Add [FS#915]: a "group" with ungrouped vehicles. Patch by Matthias Wolf.
rubidium
parents:
7134
diff
changeset
|
391 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
392 |
/* Draw Matrix Group |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
393 |
* The selected group is drawn in white */ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
394 |
StringID str_all_veh, str_no_group_veh; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
395 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
396 |
switch (this->vehicle_type) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
397 |
case VEH_TRAIN: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
398 |
str_all_veh = STR_GROUP_ALL_TRAINS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
399 |
str_no_group_veh = STR_GROUP_DEFAULT_TRAINS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
400 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
401 |
case VEH_ROAD: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
402 |
str_all_veh = STR_GROUP_ALL_ROADS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
403 |
str_no_group_veh = STR_GROUP_DEFAULT_ROADS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
404 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
405 |
case VEH_SHIP: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
406 |
str_all_veh = STR_GROUP_ALL_SHIPS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
407 |
str_no_group_veh = STR_GROUP_DEFAULT_SHIPS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
408 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
409 |
case VEH_AIRCRAFT: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
410 |
str_all_veh = STR_GROUP_ALL_AIRCRAFTS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
411 |
str_no_group_veh = STR_GROUP_DEFAULT_AIRCRAFTS; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
412 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
413 |
default: NOT_REACHED(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
414 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
415 |
DrawString(10, y1, str_all_veh, IsAllGroupID(this->group_sel) ? TC_WHITE : TC_BLACK); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
416 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
417 |
y1 += 13; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
418 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
419 |
DrawString(10, y1, str_no_group_veh, IsDefaultGroupID(this->group_sel) ? TC_WHITE : TC_BLACK); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
420 |
|
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
421 |
max = min(this->vscroll.pos + this->vscroll.cap, this->groups.Length()); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
422 |
for (i = this->vscroll.pos ; i < max ; ++i) { |
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
423 |
const Group *g = this->groups[i]; |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
424 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
425 |
assert(g->owner == owner); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
426 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
427 |
y1 += PLY_WND_PRC__SIZE_OF_ROW_TINY; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
428 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
429 |
/* draw the selected group in white, else we draw it in black */ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
430 |
SetDParam(0, g->index); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
431 |
DrawString(10, y1, STR_GROUP_NAME, (this->group_sel == g->index) ? TC_WHITE : TC_BLACK); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
432 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
433 |
/* draw the number of vehicles of the group */ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
434 |
SetDParam(0, g->num_vehicle); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
435 |
DrawStringRightAligned(187, y1 + 1, STR_GROUP_TINY_NUM, (this->group_sel == g->index) ? TC_WHITE : TC_BLACK); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
436 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
437 |
|
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
438 |
this->DrawSortButtonState(GRP_WIDGET_SORT_BY_ORDER, this->vehicles.IsDescSortOrder() ? SBS_DOWN : SBS_UP); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
439 |
|
9408
e9ac1e9138e1
(svn r13319) -Codechange: Remove use of imaginary horizontal scrollbar in the group vehicle list
peter1138
parents:
9376
diff
changeset
|
440 |
int list_width = this->widget[GRP_WIDGET_LIST_VEHICLE].right - this->widget[GRP_WIDGET_LIST_VEHICLE].left - 20; |
e9ac1e9138e1
(svn r13319) -Codechange: Remove use of imaginary horizontal scrollbar in the group vehicle list
peter1138
parents:
9376
diff
changeset
|
441 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
442 |
/* Draw Matrix Vehicle according to the vehicle list built before */ |
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
443 |
max = min(this->vscroll2.pos + this->vscroll2.cap, this->vehicles.Length()); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
444 |
for (i = this->vscroll2.pos ; i < max ; ++i) { |
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
445 |
const Vehicle* v = this->vehicles[i]; |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
446 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
447 |
assert(v->type == this->vehicle_type && v->owner == owner); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
448 |
|
9408
e9ac1e9138e1
(svn r13319) -Codechange: Remove use of imaginary horizontal scrollbar in the group vehicle list
peter1138
parents:
9376
diff
changeset
|
449 |
DrawVehicleImage(v, x + 19, y2 + 6, this->vehicle_sel, list_width, 0); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
450 |
DrawVehicleProfitButton(v, x, y2 + 13); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
451 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
452 |
SetDParam(0, v->unitnumber); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
453 |
DrawString(x, y2 + 2, v->IsInDepot() ? STR_021F : (v->age > v->max_age - 366 ? STR_00E3 : STR_00E2), TC_FROMSTRING); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
454 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
455 |
if (this->resize.step_height == PLY_WND_PRC__SIZE_OF_ROW_BIG2) DrawSmallOrderList(v, x + 138, y2); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
456 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
457 |
SetDParam(0, v->GetDisplayProfitThisYear()); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
458 |
SetDParam(1, v->GetDisplayProfitLastYear()); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
459 |
DrawString(x + 19, y2 + this->resize.step_height - 8, STR_0198_PROFIT_THIS_YEAR_LAST_YEAR, TC_FROMSTRING); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
460 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
461 |
if (IsValidGroupID(v->group_id)) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
462 |
SetDParam(0, v->group_id); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
463 |
DrawString(x + 19, y2, STR_GROUP_TINY_NAME, TC_BLACK); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
464 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
465 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
466 |
y2 += this->resize.step_height; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
467 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
468 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
469 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
470 |
virtual void OnClick(Point pt, int widget) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
471 |
{ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
472 |
if (widget != GRP_WIDGET_SORT_BY_DROPDOWN && widget != GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN) HideDropDownMenu(this); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
473 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
474 |
switch(widget) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
475 |
case GRP_WIDGET_SORT_BY_ORDER: // Flip sorting method ascending/descending |
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
476 |
this->vehicles.ToggleSortOrder(); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
477 |
this->SetDirty(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
478 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
479 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
480 |
case GRP_WIDGET_SORT_BY_DROPDOWN: // Select sorting criteria dropdown menu |
9563
c75bee824deb
(svn r13587) -Codechange: make some globals members of VehicleListBase since they are used as such
skidd13
parents:
9530
diff
changeset
|
481 |
ShowDropDownMenu(this, this->vehicle_sorter_names, this->vehicles.SortType(), GRP_WIDGET_SORT_BY_DROPDOWN, 0, (this->vehicle_type == VEH_TRAIN || this->vehicle_type == VEH_ROAD) ? 0 : (1 << 10)); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
482 |
return; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
483 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
484 |
case GRP_WIDGET_ALL_VEHICLES: // All vehicles button |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
485 |
if (!IsAllGroupID(this->group_sel)) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
486 |
this->group_sel = ALL_GROUP; |
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
487 |
this->vehicles.ForceRebuild(); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
488 |
this->SetDirty(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
489 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
490 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
491 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
492 |
case GRP_WIDGET_DEFAULT_VEHICLES: // Ungrouped vehicles button |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
493 |
if (!IsDefaultGroupID(this->group_sel)) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
494 |
this->group_sel = DEFAULT_GROUP; |
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
495 |
this->vehicles.ForceRebuild(); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
496 |
this->SetDirty(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
497 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
498 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
499 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
500 |
case GRP_WIDGET_LIST_GROUP: { // Matrix Group |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
501 |
uint16 id_g = (pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET - 26) / PLY_WND_PRC__SIZE_OF_ROW_TINY; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
502 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
503 |
if (id_g >= this->vscroll.cap) return; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
504 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
505 |
id_g += this->vscroll.pos; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
506 |
|
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
507 |
if (id_g >= this->groups.Length()) return; |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
508 |
|
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
509 |
this->group_sel = this->groups[id_g]->index;; |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
510 |
|
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
511 |
this->vehicles.ForceRebuild(); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
512 |
this->SetDirty(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
513 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
514 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
515 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
516 |
case GRP_WIDGET_LIST_VEHICLE: { // Matrix Vehicle |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
517 |
uint32 id_v = (pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / (int)this->resize.step_height; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
518 |
const Vehicle *v; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
519 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
520 |
if (id_v >= this->vscroll2.cap) return; // click out of bounds |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
521 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
522 |
id_v += this->vscroll2.pos; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
523 |
|
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
524 |
if (id_v >= this->vehicles.Length()) return; // click out of list bound |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
525 |
|
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
526 |
v = this->vehicles[id_v]; |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
527 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
528 |
this->vehicle_sel = v->index; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
529 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
530 |
if (v->IsValid()) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
531 |
SetObjectToPlaceWnd(v->GetImage(DIR_W), GetVehiclePalette(v), VHM_DRAG, this); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
532 |
_cursor.vehchain = true; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
533 |
} |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
534 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
535 |
this->SetDirty(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
536 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
537 |
} |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
538 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
539 |
case GRP_WIDGET_CREATE_GROUP: // Create a new group |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
540 |
DoCommandP(0, this->vehicle_type, 0, NULL, CMD_CREATE_GROUP | CMD_MSG(STR_GROUP_CAN_T_CREATE)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
541 |
break; |
6667 | 542 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
543 |
case GRP_WIDGET_DELETE_GROUP: { // Delete the selected group |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
544 |
GroupID group = this->group_sel; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
545 |
this->group_sel = ALL_GROUP; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
546 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
547 |
DoCommandP(0, group, 0, NULL, CMD_DELETE_GROUP | CMD_MSG(STR_GROUP_CAN_T_DELETE)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
548 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
549 |
} |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
550 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
551 |
case GRP_WIDGET_RENAME_GROUP: { // Rename the selected roup |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
552 |
assert(IsValidGroupID(this->group_sel)); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
553 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
554 |
const Group *g = GetGroup(this->group_sel); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
555 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
556 |
SetDParam(0, g->index); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
557 |
ShowQueryString(STR_GROUP_NAME, STR_GROUP_RENAME_CAPTION, 31, 150, this, CS_ALPHANUMERAL); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
558 |
} break; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
559 |
|
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
560 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
561 |
case GRP_WIDGET_AVAILABLE_VEHICLES: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
562 |
ShowBuildVehicleWindow(0, this->vehicle_type); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
563 |
break; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
564 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
565 |
case GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
566 |
ShowGroupActionDropdown(this, this->group_sel); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
567 |
break; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
568 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
569 |
case GRP_WIDGET_START_ALL: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
570 |
case GRP_WIDGET_STOP_ALL: { // Start/stop all vehicles of the list |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
571 |
DoCommandP(0, this->group_sel, ((IsAllGroupID(this->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST) & VLW_MASK) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
572 |
| (1 << 6) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
573 |
| (widget == GRP_WIDGET_START_ALL ? (1 << 5) : 0) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
574 |
| this->vehicle_type, NULL, CMD_MASS_START_STOP); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
575 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
576 |
break; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
577 |
} |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
578 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
579 |
case GRP_WIDGET_REPLACE_PROTECTION: |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
580 |
if (IsValidGroupID(this->group_sel)) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
581 |
const Group *g = GetGroup(this->group_sel); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
582 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
583 |
DoCommandP(0, this->group_sel, !g->replace_protection, NULL, CMD_SET_GROUP_REPLACE_PROTECTION); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
584 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
585 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
586 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
587 |
} |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
588 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
589 |
virtual void OnDragDrop(Point pt, int widget) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
590 |
{ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
591 |
switch (widget) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
592 |
case GRP_WIDGET_ALL_VEHICLES: // All vehicles |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
593 |
case GRP_WIDGET_DEFAULT_VEHICLES: // Ungrouped vehicles |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
594 |
DoCommandP(0, DEFAULT_GROUP, this->vehicle_sel, NULL, CMD_ADD_VEHICLE_GROUP | CMD_MSG(STR_GROUP_CAN_T_ADD_VEHICLE)); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
595 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
596 |
this->vehicle_sel = INVALID_VEHICLE; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
597 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
598 |
this->SetDirty(); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
599 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
600 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
601 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
602 |
case GRP_WIDGET_LIST_GROUP: { // Maxtrix group |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
603 |
uint16 id_g = (pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET - 26) / PLY_WND_PRC__SIZE_OF_ROW_TINY; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
604 |
const VehicleID vindex = this->vehicle_sel; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
605 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
606 |
this->vehicle_sel = INVALID_VEHICLE; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
607 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
608 |
this->SetDirty(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
609 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
610 |
if (id_g >= this->vscroll.cap) return; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
611 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
612 |
id_g += this->vscroll.pos; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
613 |
|
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
614 |
if (id_g >= this->groups.Length()) return; |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
615 |
|
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
616 |
DoCommandP(0, this->groups[id_g]->index, vindex, NULL, CMD_ADD_VEHICLE_GROUP | CMD_MSG(STR_GROUP_CAN_T_ADD_VEHICLE)); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
617 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
618 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
619 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
620 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
621 |
case GRP_WIDGET_LIST_VEHICLE: { // Maxtrix vehicle |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
622 |
uint32 id_v = (pt.y - PLY_WND_PRC__OFFSET_TOP_WIDGET) / (int)this->resize.step_height; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
623 |
const Vehicle *v; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
624 |
const VehicleID vindex = this->vehicle_sel; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
625 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
626 |
this->vehicle_sel = INVALID_VEHICLE; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
627 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
628 |
this->SetDirty(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
629 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
630 |
if (id_v >= this->vscroll2.cap) return; // click out of bounds |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
631 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
632 |
id_v += this->vscroll2.pos; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
633 |
|
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
634 |
if (id_v >= this->vehicles.Length()) return; // click out of list bound |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
635 |
|
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
636 |
v = this->vehicles[id_v]; |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
637 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
638 |
if (vindex == v->index) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
639 |
ShowVehicleViewWindow(v); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
640 |
} |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
641 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
642 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
643 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
644 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
645 |
_cursor.vehchain = false; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
646 |
} |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
647 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
648 |
virtual void OnQueryTextFinished(char *str) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
649 |
{ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
650 |
if (!StrEmpty(str)) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
651 |
_cmd_text = str; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
652 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
653 |
DoCommandP(0, this->group_sel, 0, NULL, CMD_RENAME_GROUP | CMD_MSG(STR_GROUP_CAN_T_RENAME)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
654 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
655 |
} |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
656 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
657 |
virtual void OnResize(Point new_size, Point delta) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
658 |
{ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
659 |
this->vscroll.cap += delta.y / PLY_WND_PRC__SIZE_OF_ROW_TINY; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
660 |
this->vscroll2.cap += delta.y / (int)this->resize.step_height; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
661 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
662 |
this->widget[GRP_WIDGET_LIST_GROUP].data = (this->vscroll.cap << 8) + 1; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
663 |
this->widget[GRP_WIDGET_LIST_VEHICLE].data = (this->vscroll2.cap << 8) + 1; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
664 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
665 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
666 |
virtual void OnDropdownSelect(int widget, int index) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
667 |
{ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
668 |
switch (widget) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
669 |
case GRP_WIDGET_SORT_BY_DROPDOWN: |
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
670 |
this->vehicles.SetSortType(index); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
671 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
672 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
673 |
case GRP_WIDGET_MANAGE_VEHICLES_DROPDOWN: |
9365
95e9cbc0257e
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138
parents:
9317
diff
changeset
|
674 |
assert(this->vehicles.Length() != 0); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
675 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
676 |
switch (index) { |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
677 |
case GALF_REPLACE: // Replace window |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
678 |
ShowReplaceGroupVehicleWindow(this->group_sel, this->vehicle_type); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
679 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
680 |
case GALF_SERVICE: // Send for servicing |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
681 |
DoCommandP(0, this->group_sel, ((IsAllGroupID(this->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST) & VLW_MASK) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
682 |
| DEPOT_MASS_SEND |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
683 |
| DEPOT_SERVICE, NULL, GetCmdSendToDepot(this->vehicle_type)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
684 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
685 |
case GALF_DEPOT: // Send to Depots |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
686 |
DoCommandP(0, this->group_sel, ((IsAllGroupID(this->group_sel) ? VLW_STANDARD : VLW_GROUP_LIST) & VLW_MASK) |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
687 |
| DEPOT_MASS_SEND, NULL, GetCmdSendToDepot(this->vehicle_type)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
688 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
689 |
case GALF_ADD_SHARED: // Add shared Vehicles |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
690 |
assert(IsValidGroupID(this->group_sel)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
691 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
692 |
DoCommandP(0, this->group_sel, this->vehicle_type, NULL, CMD_ADD_SHARED_VEHICLE_GROUP | CMD_MSG(STR_GROUP_CAN_T_ADD_SHARED_VEHICLE)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
693 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
694 |
case GALF_REMOVE_ALL: // Remove all Vehicles from the selected group |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
695 |
assert(IsValidGroupID(this->group_sel)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
696 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
697 |
DoCommandP(0, this->group_sel, this->vehicle_type, NULL, CMD_REMOVE_ALL_VEHICLES_GROUP | CMD_MSG(STR_GROUP_CAN_T_REMOVE_ALL_VEHICLES)); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
698 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
699 |
default: NOT_REACHED(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
700 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
701 |
break; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
702 |
|
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
703 |
default: NOT_REACHED(); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
704 |
} |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
705 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
706 |
this->SetDirty(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
707 |
} |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
708 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
709 |
virtual void OnTick() |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
710 |
{ |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
711 |
if (_pause_game != 0) return; |
9530
fba2561f33f1
(svn r13534) -Codechange: Replace the main part of VehiclesListBase sorting with GUIList function calls
skidd13
parents:
9408
diff
changeset
|
712 |
if (this->groups.NeedResort() || this->vehicles.NeedResort()) { |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
713 |
this->SetDirty(); |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
714 |
} |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
715 |
} |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
716 |
|
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
717 |
virtual void OnPlaceObjectAbort() |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
718 |
{ |
8585
61ac905ff5f7
(svn r12166) -Fix [FS#337]: when drag&drop mode was cancelled by keyboard input, depot/group window wasn't updated (original patch by GrimRC)
smatz
parents:
8556
diff
changeset
|
719 |
/* abort drag & drop */ |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
720 |
this->vehicle_sel = INVALID_VEHICLE; |
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
721 |
this->InvalidateWidget(GRP_WIDGET_LIST_VEHICLE); |
8179
60c4282e6de6
(svn r11742) -Codechange [FS#1319]: Run window tick events when paused, so that news pop-ups and the about window still progress. For other windows the events are ignored when paused.
peter1138
parents:
8144
diff
changeset
|
722 |
} |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
723 |
}; |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
724 |
|
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
725 |
|
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
726 |
static const WindowDesc _group_desc = { |
7347
0028b13ed133
(svn r10710) -Codechange: allow automatic downsizing of the group window. Same as idea as for the previous commits, i.e. you could already do so but the button would be out of reach.
rubidium
parents:
7341
diff
changeset
|
727 |
WDP_AUTO, WDP_AUTO, 460, 194, 526, 246, |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
728 |
WC_TRAINS_LIST, WC_NONE, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
729 |
WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON | WDF_RESIZABLE, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
730 |
_group_widgets, |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
731 |
}; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
732 |
|
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
733 |
void ShowPlayerGroup(PlayerID player, VehicleType vehicle_type) |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
734 |
{ |
9652
0405e98d8e96
(svn r13719) -Codechange: rename IsValidPlayer to IsValidPlayerID in line with all other structs/classes that are in a pool.
rubidium
parents:
9563
diff
changeset
|
735 |
if (!IsValidPlayerID(player)) return; |
7407
a0e8d497e161
(svn r10780) -Fix: assertion when opening the advanced vehicle list with the shortcut when being a spectator.
rubidium
parents:
7387
diff
changeset
|
736 |
|
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
737 |
WindowClass wc; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
738 |
|
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
739 |
switch (vehicle_type) { |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
740 |
default: NOT_REACHED(); |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
741 |
case VEH_TRAIN: wc = WC_TRAINS_LIST; break; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
742 |
case VEH_ROAD: wc = WC_ROADVEH_LIST; break; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
743 |
case VEH_SHIP: wc = WC_SHIPS_LIST; break; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
744 |
case VEH_AIRCRAFT: wc = WC_AIRCRAFT_LIST; break; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
745 |
} |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
746 |
|
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
747 |
WindowNumber num = (vehicle_type << 11) | VLW_GROUP_LIST | player; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
748 |
DeleteWindowById(wc, num); |
9183
6e749ab7d680
(svn r13046) -Codechange: make classes of the VehicleListWindow and the VehicleGroupWindow.
rubidium
parents:
9182
diff
changeset
|
749 |
Window *w = new VehicleGroupWindow(&_group_desc, num); |
6643
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
750 |
w->window_class = wc; |
f81bee57bc09
(svn r9874) -Feature: advanced vehicle lists a.k.a. group interface. Now you can make groups of vehicles and perform all kinds of tasks on that given group. Original code by nycom and graphics by skidd13.
rubidium
parents:
diff
changeset
|
751 |
} |