Mercurial > hg > openttd
annotate src/network/network_gui.cpp @ 14504:95e338145e97 draft
(svn r19075) -Codechange: unhackify NetworkChangeCompanyPassword()
author | smatz <smatz@openttd.org> |
---|---|
date | Wed, 10 Feb 2010 15:17:27 +0000 |
parents | 9a9236bf1a28 |
children | 1ff472b546d8 |
rev | line source |
---|---|
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1 /* $Id$ */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2 |
12778
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
3 /* |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
4 * This file is part of OpenTTD. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
5 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
6 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
7 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <http://www.gnu.org/licenses/>. |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
8 */ |
bc7926153e19
(svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents:
12632
diff
changeset
|
9 |
9111
d48433370037
(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 <rubidium@openttd.org>
parents:
8937
diff
changeset
|
10 /** @file network_gui.cpp Implementation of the Network related GUIs. */ |
d48433370037
(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 <rubidium@openttd.org>
parents:
8937
diff
changeset
|
11 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
12 #ifdef ENABLE_NETWORK |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
13 #include "../stdafx.h" |
8114
2d6af5d7a142
(svn r11675) -Codechange: split the string types from the string functions.
rubidium <rubidium@openttd.org>
parents:
8107
diff
changeset
|
14 #include "../strings_func.h" |
8140
fb8a05d579da
(svn r11702) -Codechange: move all date related stuff to date*.
rubidium <rubidium@openttd.org>
parents:
8131
diff
changeset
|
15 #include "../date_func.h" |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
16 #include "../fios.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
17 #include "network_client.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
18 #include "network_gui.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
19 #include "network_gamelist.h" |
14258
a899d4e5ee1a
(svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
rubidium <rubidium@openttd.org>
parents:
14098
diff
changeset
|
20 #include "network.h" |
a899d4e5ee1a
(svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
rubidium <rubidium@openttd.org>
parents:
14098
diff
changeset
|
21 #include "network_base.h" |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
22 #include "../gui.h" |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
23 #include "network_udp.h" |
8131
e300ac8001ae
(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 <rubidium@openttd.org>
parents:
8130
diff
changeset
|
24 #include "../window_func.h" |
8224
c45446125bf0
(svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium <rubidium@openttd.org>
parents:
8214
diff
changeset
|
25 #include "../gfx_func.h" |
8284
dbb7bfe0e95c
(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 <peter1138@openttd.org>
parents:
8270
diff
changeset
|
26 #include "../widgets/dropdown_func.h" |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
27 #include "../querystring_gui.h" |
9274
85a62fb8608f
(svn r13140) -Codechange: move the gui-list-sorting out of window_gui.h so window_gui.h only needs to be included in *_gui.cpp.
rubidium <rubidium@openttd.org>
parents:
9273
diff
changeset
|
28 #include "../sortlist_type.h" |
10208
39cf8eebfda5
(svn r14422) -Codechange: also reflect the changes of r14421 in the filenames.
rubidium <rubidium@openttd.org>
parents:
10207
diff
changeset
|
29 #include "../company_base.h" |
11956
6ec97548e188
(svn r16360) -Codechange: don't use _network_playas as a 'second' _local_company, but only as a storage location for the company you want to join in MP.
rubidium <rubidium@openttd.org>
parents:
11924
diff
changeset
|
30 #include "../company_func.h" |
14258
a899d4e5ee1a
(svn r18809) -Codechange/Cleanup: remove unneeded headers from some files, if a header require a header make it include that header
rubidium <rubidium@openttd.org>
parents:
14098
diff
changeset
|
31 #include "../core/geometry_func.hpp" |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
32 |
8264
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8254
diff
changeset
|
33 #include "table/strings.h" |
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8254
diff
changeset
|
34 #include "../table/sprites.h" |
2495310e220f
(svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium <rubidium@openttd.org>
parents:
8254
diff
changeset
|
35 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
36 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
5916
diff
changeset
|
37 static void ShowNetworkStartServerWindow(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
38 static void ShowNetworkLobbyWindow(NetworkGameList *ngl); |
11223
4928ebb36453
(svn r15576) -Codechange: rename SwitchModes to SwitchMode and don't hardcode the values for that enum.
yexo <yexo@openttd.org>
parents:
11218
diff
changeset
|
39 extern void SwitchToMode(SwitchMode new_mode); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
40 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
41 static const StringID _connection_types_dropdown[] = { |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
42 STR_NETWORK_START_SERVER_LAN_INTERNET, |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
43 STR_NETWORK_START_SERVER_INTERNET_ADVERTISE, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
44 INVALID_STRING_ID |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
45 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
46 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
47 static const StringID _lan_internet_types_dropdown[] = { |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
48 STR_NETWORK_SERVER_LIST_LAN, |
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
49 STR_NETWORK_SERVER_LIST_INTERNET, |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
50 INVALID_STRING_ID |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
51 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
52 |
6796
fe8894bfa8ab
(svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents:
6793
diff
changeset
|
53 static StringID _language_dropdown[NETLANG_COUNT + 1] = {STR_NULL}; |
6793
30657c4af0fb
(svn r10032) -Add: sort the strings in server language dropdown
glx <glx@openttd.org>
parents:
6780
diff
changeset
|
54 |
7321
66202e2e042a
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium <rubidium@openttd.org>
parents:
7221
diff
changeset
|
55 void SortNetworkLanguages() |
66202e2e042a
(svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium <rubidium@openttd.org>
parents:
7221
diff
changeset
|
56 { |
6796
fe8894bfa8ab
(svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents:
6793
diff
changeset
|
57 /* Init the strings */ |
fe8894bfa8ab
(svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents:
6793
diff
changeset
|
58 if (_language_dropdown[0] == STR_NULL) { |
fe8894bfa8ab
(svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents:
6793
diff
changeset
|
59 for (int i = 0; i < NETLANG_COUNT; i++) _language_dropdown[i] = STR_NETWORK_LANG_ANY + i; |
fe8894bfa8ab
(svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents:
6793
diff
changeset
|
60 _language_dropdown[NETLANG_COUNT] = INVALID_STRING_ID; |
fe8894bfa8ab
(svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents:
6793
diff
changeset
|
61 } |
6793
30657c4af0fb
(svn r10032) -Add: sort the strings in server language dropdown
glx <glx@openttd.org>
parents:
6780
diff
changeset
|
62 |
6796
fe8894bfa8ab
(svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents:
6793
diff
changeset
|
63 /* Sort the strings (we don't move 'any' and the 'invalid' one) */ |
13028
30e0feabeff8
(svn r17526) -Codechange: use QSortT instead of qsort for sorting the language list in the network GUI
rubidium <rubidium@openttd.org>
parents:
12878
diff
changeset
|
64 QSortT(_language_dropdown, NETLANG_COUNT - 1, &StringIDSorter); |
6793
30657c4af0fb
(svn r10032) -Add: sort the strings in server language dropdown
glx <glx@openttd.org>
parents:
6780
diff
changeset
|
65 } |
6780
05ca25dd9fa4
(svn r10017) -Add (FS#790): more languages flags for servers
glx <glx@openttd.org>
parents:
6531
diff
changeset
|
66 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
67 /** Update the network new window because a new server is |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
68 * found on the network. |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
69 * @param unselect unselect the currently selected item */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
70 void UpdateNetworkGameWindow(bool unselect) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
71 { |
10793
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
72 InvalidateWindowData(WC_NETWORK_WINDOW, 0, unselect ? 1 : 0); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
73 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
74 |
7960
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
75 /** Enum for NetworkGameWindow, referring to _network_game_window_widgets */ |
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
76 enum NetworkGameWindowWidgets { |
11374
f58902ec450d
(svn r15724) -Codechange: some widget documentation/fixing of enumified constant names (Alberth)
rubidium <rubidium@openttd.org>
parents:
11373
diff
changeset
|
77 NGWW_MAIN, ///< Main panel |
7960
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
78 |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
79 NGWW_CONNECTION, ///< Label in front of connection droplist |
8931
844599e493e6
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium <rubidium@openttd.org>
parents:
8738
diff
changeset
|
80 NGWW_CONN_BTN, ///< 'Connection' droplist button |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
81 NGWW_CLIENT_LABEL, ///< Label in front of client name edit box |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
82 NGWW_CLIENT, ///< Panel with editbox to set client name |
8931
844599e493e6
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium <rubidium@openttd.org>
parents:
8738
diff
changeset
|
83 |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
84 NGWW_HEADER, ///< Header container of the matrix |
8931
844599e493e6
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium <rubidium@openttd.org>
parents:
8738
diff
changeset
|
85 NGWW_NAME, ///< 'Name' button |
7960
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
86 NGWW_CLIENTS, ///< 'Clients' button |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
87 NGWW_MAPSIZE, ///< 'Map size' button |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
88 NGWW_DATE, ///< 'Date' button |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
89 NGWW_YEARS, ///< 'Years' button |
7960
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
90 NGWW_INFO, ///< Third button in the game list panel |
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
91 |
8931
844599e493e6
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium <rubidium@openttd.org>
parents:
8738
diff
changeset
|
92 NGWW_MATRIX, ///< Panel with list of games |
844599e493e6
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium <rubidium@openttd.org>
parents:
8738
diff
changeset
|
93 NGWW_SCROLLBAR, ///< Scrollbar of matrix |
7960
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
94 |
8937
f031c91c0cdc
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium <rubidium@openttd.org>
parents:
8931
diff
changeset
|
95 NGWW_LASTJOINED_LABEL, ///< Label "Last joined server:" |
f031c91c0cdc
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium <rubidium@openttd.org>
parents:
8931
diff
changeset
|
96 NGWW_LASTJOINED, ///< Info about the last joined server |
f031c91c0cdc
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium <rubidium@openttd.org>
parents:
8931
diff
changeset
|
97 |
8931
844599e493e6
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium <rubidium@openttd.org>
parents:
8738
diff
changeset
|
98 NGWW_DETAILS, ///< Panel with game details |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
99 NGWW_DETAILS_SPACER, ///< Spacer for game actual details |
8931
844599e493e6
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium <rubidium@openttd.org>
parents:
8738
diff
changeset
|
100 NGWW_JOIN, ///< 'Join game' button |
844599e493e6
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium <rubidium@openttd.org>
parents:
8738
diff
changeset
|
101 NGWW_REFRESH, ///< 'Refresh server' button |
844599e493e6
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium <rubidium@openttd.org>
parents:
8738
diff
changeset
|
102 NGWW_NEWGRF, ///< 'NewGRF Settings' button |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
103 NGWW_NEWGRF_SEL, ///< Selection 'widget' to hide the NewGRF settings |
7960
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
104 |
8931
844599e493e6
(svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium <rubidium@openttd.org>
parents:
8738
diff
changeset
|
105 NGWW_FIND, ///< 'Find server' button |
7960
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
106 NGWW_ADD, ///< 'Add server' button |
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
107 NGWW_START, ///< 'Start server' button |
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
108 NGWW_CANCEL, ///< 'Cancel' button |
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
109 }; |
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
110 |
9182
d3a153aa328d
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents:
9181
diff
changeset
|
111 typedef GUIList<NetworkGameList*> GUIGameServerList; |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
112 typedef uint16 ServerListPosition; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
113 static const ServerListPosition SLP_INVALID = 0xFFFF; |
9182
d3a153aa328d
(svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents:
9181
diff
changeset
|
114 |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
115 /** Full blown container to make it behave exactly as we want :) */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
116 class NWidgetServerListHeader : public NWidgetContainer { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
117 static const uint MINIMUM_NAME_WIDTH_BEFORE_NEW_HEADER = 150; ///< Minimum width before adding a new header |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
118 bool visible[6]; ///< The visible headers |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
119 public: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
120 NWidgetServerListHeader() : NWidgetContainer(NWID_HORIZONTAL) |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
121 { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
122 NWidgetLeaf *leaf = new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_NAME, STR_NETWORK_SERVER_LIST_GAME_NAME, STR_NETWORK_SERVER_LIST_GAME_NAME_TOOLTIP); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
123 leaf->SetResize(1, 0); |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
124 leaf->SetFill(1, 0); |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
125 this->Add(leaf); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
126 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
127 this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_CLIENTS, STR_NETWORK_SERVER_LIST_CLIENTS_CAPTION, STR_NETWORK_SERVER_LIST_CLIENTS_CAPTION_TOOLTIP)); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
128 this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_MAPSIZE, STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION, STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION_TOOLTIP)); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
129 this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_DATE, STR_NETWORK_SERVER_LIST_DATE_CAPTION, STR_NETWORK_SERVER_LIST_DATE_CAPTION_TOOLTIP)); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
130 this->Add(new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_YEARS, STR_NETWORK_SERVER_LIST_YEARS_CAPTION, STR_NETWORK_SERVER_LIST_YEARS_CAPTION_TOOLTIP)); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
131 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
132 leaf = new NWidgetLeaf(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_INFO, STR_EMPTY, STR_NETWORK_SERVER_LIST_INFO_ICONS_TOOLTIP); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
133 leaf->SetMinimalSize(40, 12); |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
134 leaf->SetFill(0, 1); |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
135 this->Add(leaf); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
136 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
137 /* First and last are always visible, the rest is implicitly zeroed */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
138 this->visible[0] = true; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
139 *lastof(this->visible) = true; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
140 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
141 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
142 void SetupSmallestSize(Window *w, bool init_array) |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
143 { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
144 /* Oh yeah, we ought to be findable! */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
145 w->nested_array[NGWW_HEADER] = this; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
146 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
147 this->smallest_x = this->head->smallest_x + this->tail->smallest_x; // First and last are always shown, rest not |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
148 this->smallest_y = 0; // Biggest child. |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
149 this->fill_x = 1; |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
150 this->fill_y = 0; |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
151 this->resize_x = 1; // We only resize in this direction |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
152 this->resize_y = 0; // We never resize in this direction |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
153 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
154 /* First initialise some variables... */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
155 for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
156 child_wid->SetupSmallestSize(w, init_array); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
157 this->smallest_y = max(this->smallest_y, child_wid->smallest_y + child_wid->padding_top + child_wid->padding_bottom); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
158 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
159 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
160 /* ... then in a second pass make sure the 'current' sizes are set. Won't change for most widgets. */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
161 for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
162 child_wid->current_x = child_wid->smallest_x; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
163 child_wid->current_y = this->smallest_y; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
164 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
165 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
166 |
13676
e9a201c03e65
(svn r18201) -Codechange (r18092): No need anymore for initializing nested widgets for Widget* arrays.
alberth <alberth@openttd.org>
parents:
13651
diff
changeset
|
167 void AssignSizePosition(SizingType sizing, uint x, uint y, uint given_width, uint given_height, bool rtl) |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
168 { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
169 assert(given_width >= this->smallest_x && given_height >= this->smallest_y); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
170 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
171 this->pos_x = x; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
172 this->pos_y = y; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
173 this->current_x = given_width; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
174 this->current_y = given_height; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
175 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
176 given_width -= this->tail->smallest_x; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
177 NWidgetBase *child_wid = this->head->next; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
178 /* The first and last widget are always visible, determine which other should be visible */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
179 for (uint i = 1; i < lengthof(this->visible) - 1; i++) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
180 if (given_width - child_wid->smallest_x > MINIMUM_NAME_WIDTH_BEFORE_NEW_HEADER && this->visible[i - 1]) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
181 this->visible[i] = true; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
182 given_width -= child_wid->smallest_x; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
183 } else { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
184 this->visible[i] = false; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
185 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
186 child_wid = child_wid->next; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
187 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
188 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
189 /* All remaining space goes to the first (name) widget */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
190 this->head->current_x = given_width; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
191 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
192 /* Now assign the widgets to their rightful place */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
193 uint position = 0; // Place to put next child relative to origin of the container. |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
194 uint i = rtl ? lengthof(this->visible) - 1 : 0; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
195 child_wid = rtl ? this->tail : this->head; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
196 while (child_wid != NULL) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
197 if (this->visible[i]) { |
13676
e9a201c03e65
(svn r18201) -Codechange (r18092): No need anymore for initializing nested widgets for Widget* arrays.
alberth <alberth@openttd.org>
parents:
13651
diff
changeset
|
198 child_wid->AssignSizePosition(sizing, x + position, y, child_wid->current_x, this->current_y, rtl); |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
199 position += child_wid->current_x; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
200 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
201 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
202 child_wid = rtl ? child_wid->prev : child_wid->next; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
203 i += rtl ? -1 : 1; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
204 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
205 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
206 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
207 /* virtual */ void Draw(const Window *w) |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
208 { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
209 int i = 0; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
210 for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
211 if (!this->visible[i++]) continue; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
212 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
213 child_wid->Draw(w); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
214 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
215 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
216 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
217 /* virtual */ NWidgetCore *GetWidgetFromPos(int x, int y) |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
218 { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
219 if (!IsInsideBS(x, this->pos_x, this->current_x) || !IsInsideBS(y, this->pos_y, this->current_y)) return NULL; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
220 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
221 int i = 0; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
222 for (NWidgetBase *child_wid = this->head; child_wid != NULL; child_wid = child_wid->next) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
223 if (!this->visible[i++]) continue; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
224 NWidgetCore *nwid = child_wid->GetWidgetFromPos(x, y); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
225 if (nwid != NULL) return nwid; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
226 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
227 return NULL; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
228 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
229 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
230 /** |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
231 * Checks whether the given widget is actually visible. |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
232 * @param widget the widget to check for visibility |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
233 * @return true iff the widget is visible. |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
234 */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
235 bool IsWidgetVisible(NetworkGameWindowWidgets widget) const |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
236 { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
237 assert((uint)(widget - NGWW_NAME) < lengthof(this->visible)); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
238 return this->visible[widget - NGWW_NAME]; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
239 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
240 }; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
241 |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
242 class NetworkGameWindow : public QueryStringBaseWindow { |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
243 protected: |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
244 /* Runtime saved values */ |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
245 static Listing last_sorting; |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
246 |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
247 /* Constants for sorting servers */ |
11376
b9b2391afd1a
(svn r15726) -Codechange: unify coding style for const pointers
smatz <smatz@openttd.org>
parents:
11374
diff
changeset
|
248 static GUIGameServerList::SortFunction * const sorter_funcs[]; |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
249 |
11682
2b28014c1684
(svn r16065) -Fix: don't readd (and resolve) the last joined server each time the window gets repainted
rubidium <rubidium@openttd.org>
parents:
11612
diff
changeset
|
250 byte field; ///< selected text-field |
2b28014c1684
(svn r16065) -Fix: don't readd (and resolve) the last joined server each time the window gets repainted
rubidium <rubidium@openttd.org>
parents:
11612
diff
changeset
|
251 NetworkGameList *server; ///< selected server |
2b28014c1684
(svn r16065) -Fix: don't readd (and resolve) the last joined server each time the window gets repainted
rubidium <rubidium@openttd.org>
parents:
11612
diff
changeset
|
252 NetworkGameList *last_joined; ///< the last joined server |
2b28014c1684
(svn r16065) -Fix: don't readd (and resolve) the last joined server each time the window gets repainted
rubidium <rubidium@openttd.org>
parents:
11612
diff
changeset
|
253 GUIGameServerList servers; ///< list with game servers. |
2b28014c1684
(svn r16065) -Fix: don't readd (and resolve) the last joined server each time the window gets repainted
rubidium <rubidium@openttd.org>
parents:
11612
diff
changeset
|
254 ServerListPosition list_pos; ///< position of the selected server |
8937
f031c91c0cdc
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium <rubidium@openttd.org>
parents:
8931
diff
changeset
|
255 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
256 /** |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
257 * (Re)build the network game list as its amount has changed because |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
258 * an item has been added or deleted for example |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
259 */ |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
260 void BuildNetworkGameList() |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
261 { |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
262 if (!this->servers.NeedRebuild()) return; |
8937
f031c91c0cdc
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium <rubidium@openttd.org>
parents:
8931
diff
changeset
|
263 |
9365
5a3d3513930c
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents:
9354
diff
changeset
|
264 /* Create temporary array of games to use for listing */ |
5a3d3513930c
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents:
9354
diff
changeset
|
265 this->servers.Clear(); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
266 |
9365
5a3d3513930c
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents:
9354
diff
changeset
|
267 for (NetworkGameList *ngl = _network_game_list; ngl != NULL; ngl = ngl->next) { |
5a3d3513930c
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents:
9354
diff
changeset
|
268 *this->servers.Append() = ngl; |
5a3d3513930c
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents:
9354
diff
changeset
|
269 } |
7960
d91d1077e1ce
(svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7959
diff
changeset
|
270 |
9365
5a3d3513930c
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents:
9354
diff
changeset
|
271 this->servers.Compact(); |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
272 this->servers.RebuildDone(); |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
273 this->vscroll.SetCount(this->servers.Length()); |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
274 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
275 |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
276 /** Sort servers by name. */ |
10647
592ae9307430
(svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents:
10641
diff
changeset
|
277 static int CDECL NGameNameSorter(NetworkGameList * const *a, NetworkGameList * const *b) |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
278 { |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
279 return strcasecmp((*a)->info.server_name, (*b)->info.server_name); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
280 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
281 |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
282 /** Sort servers by the amount of clients online on a |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
283 * server. If the two servers have the same amount, the one with the |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
284 * higher maximum is preferred. */ |
10647
592ae9307430
(svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents:
10641
diff
changeset
|
285 static int CDECL NGameClientSorter(NetworkGameList * const *a, NetworkGameList * const *b) |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
286 { |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
287 /* Reverse as per default we are interested in most-clients first */ |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
288 int r = (*a)->info.clients_on - (*b)->info.clients_on; |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
289 |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
290 if (r == 0) r = (*a)->info.clients_max - (*b)->info.clients_max; |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
291 if (r == 0) r = NGameNameSorter(a, b); |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
292 |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
293 return r; |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
294 } |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
295 |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
296 /** Sort servers by map size */ |
10647
592ae9307430
(svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents:
10641
diff
changeset
|
297 static int CDECL NGameMapSizeSorter(NetworkGameList * const *a, NetworkGameList * const *b) |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
298 { |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
299 /* Sort by the area of the map. */ |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
300 int r = ((*a)->info.map_height) * ((*a)->info.map_width) - ((*b)->info.map_height) * ((*b)->info.map_width); |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
301 |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
302 if (r == 0) r = (*a)->info.map_width - (*b)->info.map_width; |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
303 return (r != 0) ? r : NGameClientSorter(a, b); |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
304 } |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
305 |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
306 /** Sort servers by current date */ |
10647
592ae9307430
(svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents:
10641
diff
changeset
|
307 static int CDECL NGameDateSorter(NetworkGameList * const *a, NetworkGameList * const *b) |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
308 { |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
309 int r = (*a)->info.game_date - (*b)->info.game_date; |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
310 return (r != 0) ? r : NGameClientSorter(a, b); |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
311 } |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
312 |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
313 /** Sort servers by the number of days the game is running */ |
10647
592ae9307430
(svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents:
10641
diff
changeset
|
314 static int CDECL NGameYearsSorter(NetworkGameList * const *a, NetworkGameList * const *b) |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
315 { |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
316 int r = (*a)->info.game_date - (*a)->info.start_date - (*b)->info.game_date + (*b)->info.start_date; |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
317 return (r != 0) ? r : NGameDateSorter(a, b); |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
318 } |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
319 |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
320 /** Sort servers by joinability. If both servers are the |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
321 * same, prefer the non-passworded server first. */ |
10647
592ae9307430
(svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents:
10641
diff
changeset
|
322 static int CDECL NGameAllowedSorter(NetworkGameList * const *a, NetworkGameList * const *b) |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
323 { |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
324 /* The servers we do not know anything about (the ones that did not reply) should be at the bottom) */ |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
325 int r = StrEmpty((*a)->info.server_revision) - StrEmpty((*b)->info.server_revision); |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
326 |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
327 /* Reverse default as we are interested in version-compatible clients first */ |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
328 if (r == 0) r = (*b)->info.version_compatible - (*a)->info.version_compatible; |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
329 /* The version-compatible ones are then sorted with NewGRF compatible first, incompatible last */ |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
330 if (r == 0) r = (*b)->info.compatible - (*a)->info.compatible; |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
331 /* Passworded servers should be below unpassworded servers */ |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
332 if (r == 0) r = (*a)->info.use_password - (*b)->info.use_password; |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
333 /* Finally sort on the name of the server */ |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
334 if (r == 0) r = NGameNameSorter(a, b); |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
335 |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
336 return r; |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
337 } |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
338 |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
339 /** Sort the server list */ |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
340 void SortNetworkGameList() |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
341 { |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
342 if (!this->servers.Sort()) return; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
343 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
344 /* After sorting ngl->sort_list contains the sorted items. Put these back |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
345 * into the original list. Basically nothing has changed, we are only |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
346 * shuffling the ->next pointers. While iterating, look for the |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
347 * currently selected server and set list_pos to its position */ |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
348 this->list_pos = SLP_INVALID; |
9365
5a3d3513930c
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents:
9354
diff
changeset
|
349 _network_game_list = this->servers[0]; |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
350 NetworkGameList *item = _network_game_list; |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
351 if (item == this->server) this->list_pos = 0; |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
352 for (uint i = 1; i != this->servers.Length(); i++) { |
9365
5a3d3513930c
(svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents:
9354
diff
changeset
|
353 item->next = this->servers[i]; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
354 item = item->next; |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
355 if (item == this->server) this->list_pos = i; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
356 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
357 item->next = NULL; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
358 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
359 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
360 /** |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
361 * Draw a single server line. |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
362 * @param cur_item the server to draw. |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
363 * @param y from where to draw? |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
364 * @param highlight does the line need to be highlighted? |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
365 */ |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
366 void DrawServerLine(const NetworkGameList *cur_item, uint y, bool highlight) const |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
367 { |
13695
75560523443c
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents:
13694
diff
changeset
|
368 const NWidgetBase *nwi_name = this->GetWidget<NWidgetBase>(NGWW_NAME); |
75560523443c
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents:
13694
diff
changeset
|
369 const NWidgetBase *nwi_info = this->GetWidget<NWidgetBase>(NGWW_INFO); |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
370 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
371 /* show highlighted item with a different colour */ |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
372 if (highlight) GfxFillRect(nwi_name->pos_x + 1, y - 2, nwi_info->pos_x + nwi_info->current_x - 2, y + FONT_HEIGHT_NORMAL - 1, 10); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
373 |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
374 DrawString(nwi_name->pos_x + WD_FRAMERECT_LEFT, nwi_name->pos_x + nwi_name->current_x - WD_FRAMERECT_RIGHT, y, cur_item->info.server_name, TC_BLACK); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
375 |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
376 /* only draw details if the server is online */ |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
377 if (cur_item->online) { |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
378 const NWidgetServerListHeader *nwi_header = this->GetWidget<NWidgetServerListHeader>(NGWW_HEADER); |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
379 |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
380 if (nwi_header->IsWidgetVisible(NGWW_CLIENTS)) { |
13695
75560523443c
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents:
13694
diff
changeset
|
381 const NWidgetBase *nwi_clients = this->GetWidget<NWidgetBase>(NGWW_CLIENTS); |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
382 SetDParam(0, cur_item->info.clients_on); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
383 SetDParam(1, cur_item->info.clients_max); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
384 SetDParam(2, cur_item->info.companies_on); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
385 SetDParam(3, cur_item->info.companies_max); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
386 DrawString(nwi_clients->pos_x, nwi_clients->pos_x + nwi_clients->current_x - 1, y, STR_NETWORK_SERVER_LIST_GENERAL_ONLINE, TC_FROMSTRING, SA_CENTER); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
387 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
388 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
389 if (nwi_header->IsWidgetVisible(NGWW_MAPSIZE)) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
390 /* map size */ |
13695
75560523443c
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents:
13694
diff
changeset
|
391 const NWidgetBase *nwi_mapsize = this->GetWidget<NWidgetBase>(NGWW_MAPSIZE); |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
392 SetDParam(0, cur_item->info.map_width); |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
393 SetDParam(1, cur_item->info.map_height); |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
394 DrawString(nwi_mapsize->pos_x, nwi_mapsize->pos_x + nwi_mapsize->current_x - 1, y, STR_NETWORK_SERVER_LIST_MAP_SIZE_SHORT, TC_FROMSTRING, SA_CENTER); |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
395 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
396 |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
397 if (nwi_header->IsWidgetVisible(NGWW_DATE)) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
398 /* current date */ |
13695
75560523443c
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents:
13694
diff
changeset
|
399 const NWidgetBase *nwi_date = this->GetWidget<NWidgetBase>(NGWW_DATE); |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
400 YearMonthDay ymd; |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
401 ConvertDateToYMD(cur_item->info.game_date, &ymd); |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
402 SetDParam(0, ymd.year); |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
403 DrawString(nwi_date->pos_x, nwi_date->pos_x + nwi_date->current_x - 1, y, STR_JUST_INT, TC_BLACK, SA_CENTER); |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
404 } |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
405 |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
406 if (nwi_header->IsWidgetVisible(NGWW_YEARS)) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
407 /* number of years the game is running */ |
13695
75560523443c
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents:
13694
diff
changeset
|
408 const NWidgetBase *nwi_years = this->GetWidget<NWidgetBase>(NGWW_YEARS); |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
409 YearMonthDay ymd_cur, ymd_start; |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
410 ConvertDateToYMD(cur_item->info.game_date, &ymd_cur); |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
411 ConvertDateToYMD(cur_item->info.start_date, &ymd_start); |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
412 SetDParam(0, ymd_cur.year - ymd_start.year); |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
413 DrawString(nwi_years->pos_x, nwi_years->pos_x + nwi_years->current_x - 1, y, STR_JUST_INT, TC_BLACK, SA_CENTER); |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
414 } |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
415 |
13693
a41d4d5669ba
(svn r18218) -Codechange: make a few network windows big font aware
rubidium <rubidium@openttd.org>
parents:
13688
diff
changeset
|
416 /* Align the sprites */ |
a41d4d5669ba
(svn r18218) -Codechange: make a few network windows big font aware
rubidium <rubidium@openttd.org>
parents:
13688
diff
changeset
|
417 y += (FONT_HEIGHT_NORMAL - 10) / 2; |
a41d4d5669ba
(svn r18218) -Codechange: make a few network windows big font aware
rubidium <rubidium@openttd.org>
parents:
13688
diff
changeset
|
418 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
419 /* draw a lock if the server is password protected */ |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
420 if (cur_item->info.use_password) DrawSprite(SPR_LOCK, PAL_NONE, nwi_info->pos_x + 5, y - 1); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
421 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
422 /* draw red or green icon, depending on compatibility with server */ |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
423 DrawSprite(SPR_BLOT, (cur_item->info.compatible ? PALETTE_TO_GREEN : (cur_item->info.version_compatible ? PALETTE_TO_YELLOW : PALETTE_TO_RED)), nwi_info->pos_x + 15, y); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
424 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
425 /* draw flag according to server language */ |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
426 DrawSprite(SPR_FLAGS_BASE + cur_item->info.server_lang, PAL_NONE, nwi_info->pos_x + 25, y); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
427 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
428 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
429 |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
430 /** |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
431 * Scroll the list up or down to the currently selected server. |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
432 * If the server is below the currently displayed servers, it will |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
433 * scroll down an amount so that the server appears at the bottom. |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
434 * If the server is above the currently displayed servers, it will |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
435 * scroll up so that the server appears at the top. |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
436 */ |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
437 void ScrollToSelectedServer() |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
438 { |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
439 if (this->list_pos == SLP_INVALID) return; // no server selected |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
440 this->vscroll.ScrollTowards(this->list_pos); |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
441 } |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
442 |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
443 public: |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
444 NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_CLIENT_NAME_LENGTH) |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
445 { |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
446 this->InitNested(desc, 0); |
11462
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
447 |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
448 ttd_strlcpy(this->edit_str_buf, _settings_client.network.client_name, this->edit_str_size); |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
449 this->afilter = CS_ALPHANUMERAL; |
9897
5b558ce6cb0e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents:
9827
diff
changeset
|
450 InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 120); |
11081
0a26df8849a2
(svn r15424) -Codechange: make it possible to have multiple windows with edit box open simultaniously (Zuu).
rubidium <rubidium@openttd.org>
parents:
11069
diff
changeset
|
451 this->SetFocusedWidget(NGWW_CLIENT); |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
452 |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
453 UpdateNetworkGameWindow(true); |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
454 |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
455 this->field = NGWW_CLIENT; |
11682
2b28014c1684
(svn r16065) -Fix: don't readd (and resolve) the last joined server each time the window gets repainted
rubidium <rubidium@openttd.org>
parents:
11612
diff
changeset
|
456 this->last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); |
14035
1017887e1560
(svn r18578) -Feature: initially select the last joined server when going to the server list
rubidium <rubidium@openttd.org>
parents:
13879
diff
changeset
|
457 this->server = this->last_joined; |
11682
2b28014c1684
(svn r16065) -Fix: don't readd (and resolve) the last joined server each time the window gets repainted
rubidium <rubidium@openttd.org>
parents:
11612
diff
changeset
|
458 |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
459 this->servers.SetListing(this->last_sorting); |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
460 this->servers.SetSortFuncs(this->sorter_funcs); |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
461 this->servers.ForceRebuild(); |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
462 this->SortNetworkGameList(); |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
463 } |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
464 |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
465 ~NetworkGameWindow() |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
466 { |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
467 this->last_sorting = this->servers.GetListing(); |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
468 } |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
469 |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
470 virtual void SetStringParameters(int widget) const |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
471 { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
472 switch (widget) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
473 case NGWW_CONN_BTN: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
474 SetDParam(0, _lan_internet_types_dropdown[_settings_client.network.lan_internet]); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
475 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
476 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
477 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
478 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
479 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
480 { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
481 switch (widget) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
482 case NGWW_CONN_BTN: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
483 *size = maxdim(GetStringBoundingBox(_lan_internet_types_dropdown[0]), GetStringBoundingBox(_lan_internet_types_dropdown[1])); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
484 size->width += padding.width; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
485 size->height += padding.height; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
486 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
487 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
488 case NGWW_MATRIX: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
489 resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
490 size->height = 10 * resize->height; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
491 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
492 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
493 case NGWW_LASTJOINED: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
494 size->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
495 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
496 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
497 case NGWW_NAME: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
498 size->width += 2 * WD_SORTBUTTON_ARROW_WIDTH; // Make space for the arrow |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
499 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
500 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
501 case NGWW_CLIENTS: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
502 size->width += 2 * WD_SORTBUTTON_ARROW_WIDTH; // Make space for the arrow |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
503 SetDParam(0, 255); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
504 SetDParam(1, 255); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
505 SetDParam(2, 15); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
506 SetDParam(3, 15); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
507 *size = maxdim(*size, GetStringBoundingBox(STR_NETWORK_SERVER_LIST_GENERAL_ONLINE)); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
508 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
509 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
510 case NGWW_MAPSIZE: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
511 size->width += 2 * WD_SORTBUTTON_ARROW_WIDTH; // Make space for the arrow |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
512 SetDParam(0, 2048); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
513 SetDParam(1, 2048); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
514 *size = maxdim(*size, GetStringBoundingBox(STR_NETWORK_SERVER_LIST_MAP_SIZE_SHORT)); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
515 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
516 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
517 case NGWW_DATE: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
518 case NGWW_YEARS: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
519 size->width += 2 * WD_SORTBUTTON_ARROW_WIDTH; // Make space for the arrow |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
520 SetDParam(0, 99999); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
521 *size = maxdim(*size, GetStringBoundingBox(STR_JUST_INT)); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
522 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
523 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
524 case NGWW_DETAILS_SPACER: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
525 size->height = 20 + 12 * FONT_HEIGHT_NORMAL; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
526 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
527 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
528 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
529 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
530 virtual void DrawWidget(const Rect &r, int widget) const |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
531 { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
532 switch (widget) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
533 case NGWW_MATRIX: { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
534 uint16 y = r.top + WD_MATRIX_TOP; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
535 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
536 const int max = min(this->vscroll.GetPosition() + this->vscroll.GetCapacity(), (int)this->servers.Length()); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
537 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
538 for (int i = this->vscroll.GetPosition(); i < max; ++i) { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
539 const NetworkGameList *ngl = this->servers[i]; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
540 this->DrawServerLine(ngl, y, ngl == this->server); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
541 y += this->resize.step_height; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
542 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
543 } break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
544 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
545 case NGWW_LASTJOINED: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
546 /* Draw the last joined server, if any */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
547 if (this->last_joined != NULL) this->DrawServerLine(this->last_joined, r.top + WD_MATRIX_TOP, this->last_joined == this->server); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
548 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
549 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
550 case NGWW_DETAILS: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
551 this->DrawDetails(r); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
552 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
553 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
554 case NGWW_NAME: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
555 case NGWW_CLIENTS: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
556 case NGWW_MAPSIZE: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
557 case NGWW_DATE: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
558 case NGWW_YEARS: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
559 case NGWW_INFO: |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
560 if (widget - NGWW_NAME == this->servers.SortType()) this->DrawSortButtonState(widget, this->servers.IsDescSortOrder() ? SBS_DOWN : SBS_UP); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
561 break; |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
562 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
563 } |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
564 |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
565 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
566 virtual void OnPaint() |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
567 { |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
568 if (this->servers.NeedRebuild()) { |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
569 this->BuildNetworkGameList(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
570 } |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
571 this->SortNetworkGameList(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
572 |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
573 NetworkGameList *sel = this->server; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
574 /* 'Refresh' button invisible if no server selected */ |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
575 this->SetWidgetDisabledState(NGWW_REFRESH, sel == NULL); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
576 /* 'Join' button disabling conditions */ |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
577 this->SetWidgetDisabledState(NGWW_JOIN, sel == NULL || // no Selected Server |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
578 !sel->online || // Server offline |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
579 sel->info.clients_on >= sel->info.clients_max || // Server full |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
580 !sel->info.compatible); // Revision mismatch |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
581 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
582 /* 'NewGRF Settings' button invisible if no NewGRF is used */ |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
583 this->GetWidget<NWidgetStacked>(NGWW_NEWGRF_SEL)->SetDisplayedPlane(sel == NULL || !sel->online || sel->info.grfconfig == NULL); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
584 |
9273
72a6d2e60834
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents:
9269
diff
changeset
|
585 this->DrawWidgets(); |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
586 /* Edit box to set client name */ |
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
587 this->DrawEditBox(NGWW_CLIENT); |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
588 } |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
589 |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
590 void DrawDetails(const Rect &r) const |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
591 { |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
592 NetworkGameList *sel = this->server; |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
593 |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
594 const int detail_height = 6 + 8 + 6 + 3 * FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
595 |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
596 /* Draw the right menu */ |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
597 GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.top + detail_height - 1, 157); |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
598 if (sel == NULL) { |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
599 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + 6 + 4 + FONT_HEIGHT_NORMAL, STR_NETWORK_SERVER_LIST_GAME_INFO, TC_FROMSTRING, SA_CENTER); |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
600 } else if (!sel->online) { |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
601 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + 6 + 4 + FONT_HEIGHT_NORMAL, sel->info.server_name, TC_ORANGE, SA_CENTER); // game name |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
602 |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
603 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + detail_height + 4, STR_NETWORK_SERVER_LIST_SERVER_OFFLINE, TC_FROMSTRING, SA_CENTER); // server offline |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
604 } else { // show game info |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
605 |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
606 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + 6, STR_NETWORK_SERVER_LIST_GAME_INFO, TC_FROMSTRING, SA_CENTER); |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
607 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + 6 + 4 + FONT_HEIGHT_NORMAL, sel->info.server_name, TC_ORANGE, SA_CENTER); // game name |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
608 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + 6 + 8 + 2 * FONT_HEIGHT_NORMAL, sel->info.map_name, TC_BLACK, SA_CENTER); // map name |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
609 |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
610 uint16 y = r.top + detail_height + 4; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
611 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
612 SetDParam(0, sel->info.clients_on); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
613 SetDParam(1, sel->info.clients_max); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
614 SetDParam(2, sel->info.companies_on); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
615 SetDParam(3, sel->info.companies_max); |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
616 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_CLIENTS); |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
617 y += FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
618 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
619 SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang); |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
620 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_LANGUAGE); // server language |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
621 y += FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
622 |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
623 SetDParam(0, STR_CHEAT_SWITCH_CLIMATE_TEMPERATE_LANDSCAPE + sel->info.map_set); |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
624 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_TILESET); // tileset |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
625 y += FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
626 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
627 SetDParam(0, sel->info.map_width); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
628 SetDParam(1, sel->info.map_height); |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
629 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_MAP_SIZE); // map size |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
630 y += FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
631 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
632 SetDParamStr(0, sel->info.server_revision); |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
633 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_SERVER_VERSION); // server version |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
634 y += FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
635 |
11608
6eadd58dd981
(svn r15982) -Codechange: use GetAddressAsString to get the name instead of passing the hostname and the IP into a string.
rubidium <rubidium@openttd.org>
parents:
11578
diff
changeset
|
636 SetDParamStr(0, sel->address.GetAddressAsString()); |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
637 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_SERVER_ADDRESS); // server address |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
638 y += FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
639 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
640 SetDParam(0, sel->info.start_date); |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
641 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_START_DATE); // start date |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
642 y += FONT_HEIGHT_NORMAL; |
8937
f031c91c0cdc
(svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium <rubidium@openttd.org>
parents:
8931
diff
changeset
|
643 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
644 SetDParam(0, sel->info.game_date); |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
645 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_CURRENT_DATE); // current date |
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
646 y += FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
647 |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
648 y += WD_PAR_VSEP_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
649 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
650 if (!sel->info.compatible) { |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
651 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, sel->info.version_compatible ? STR_NETWORK_SERVER_LIST_GRF_MISMATCH : STR_NETWORK_SERVER_LIST_VERSION_MISMATCH, TC_FROMSTRING, SA_CENTER); // server mismatch |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
652 } else if (sel->info.clients_on == sel->info.clients_max) { |
9451
49dffcace617
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents:
9441
diff
changeset
|
653 /* Show: server full, when clients_on == max_clients */ |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
654 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_SERVER_FULL, TC_FROMSTRING, SA_CENTER); // server full |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
655 } else if (sel->info.use_password) { |
13373
758ee10ac14a
(svn r17882) -Codechange: make the code to draw the details in the server list a seperate function and remove some magic numbers
rubidium <rubidium@openttd.org>
parents:
13368
diff
changeset
|
656 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_PASSWORD, TC_FROMSTRING, SA_CENTER); // password warning |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
657 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
658 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
659 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
660 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
661 virtual void OnClick(Point pt, int widget, int click_count) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
662 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
663 this->field = widget; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
664 switch (widget) { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
665 case NGWW_CANCEL: // Cancel button |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
666 DeleteWindowById(WC_NETWORK_WINDOW, 0); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
667 break; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
668 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
669 case NGWW_CONN_BTN: // 'Connection' droplist |
9420
ec47ec544964
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium <rubidium@openttd.org>
parents:
9416
diff
changeset
|
670 ShowDropDownMenu(this, _lan_internet_types_dropdown, _settings_client.network.lan_internet, NGWW_CONN_BTN, 0, 0); // do it for widget NSSW_CONN_BTN |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
671 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
672 |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
673 case NGWW_NAME: // Sort by name |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
674 case NGWW_CLIENTS: // Sort by connected clients |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
675 case NGWW_MAPSIZE: // Sort by map size |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
676 case NGWW_DATE: // Sort by date |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
677 case NGWW_YEARS: // Sort by years |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
678 case NGWW_INFO: // Connectivity (green dot) |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
679 if (this->servers.SortType() == widget - NGWW_NAME) { |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
680 this->servers.ToggleSortOrder(); |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
681 if (this->list_pos != SLP_INVALID) this->list_pos = this->servers.Length() - this->list_pos - 1; |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
682 } else { |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
683 this->servers.SetSortType(widget - NGWW_NAME); |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
684 this->servers.ForceResort(); |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
685 this->SortNetworkGameList(); |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
686 } |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
687 this->ScrollToSelectedServer(); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
688 this->SetDirty(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
689 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
690 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
691 case NGWW_MATRIX: { // Matrix to show networkgames |
13695
75560523443c
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents:
13694
diff
changeset
|
692 uint32 id_v = (pt.y - this->GetWidget<NWidgetBase>(NGWW_MATRIX)->pos_y) / this->resize.step_height; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
693 |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
694 if (id_v >= this->vscroll.GetCapacity()) return; // click out of bounds |
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
695 id_v += this->vscroll.GetPosition(); |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
696 |
9415
195a505bb0f4
(svn r13328) -Fix (r13327): Don't access an item when there isn't any
skidd13 <skidd13@openttd.org>
parents:
9414
diff
changeset
|
697 this->server = (id_v < this->servers.Length()) ? this->servers[id_v] : NULL; |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
698 this->list_pos = (server == NULL) ? SLP_INVALID : id_v; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
699 this->SetDirty(); |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
700 |
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
701 /* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */ |
14410
9a9236bf1a28
(svn r18967) -Fix (r18966): Never trust your copy&paste skills.
frosch <frosch@openttd.org>
parents:
14409
diff
changeset
|
702 if (click_count > 1 && !this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN, 1); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
703 } break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
704 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
705 case NGWW_LASTJOINED: { |
11551
939f22f810ef
(svn r15916) -Codechange: let the network game list use NetworkAddress
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
706 NetworkGameList *last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
707 if (last_joined != NULL) { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
708 this->server = last_joined; |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
709 |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
710 /* search the position of the newly selected server */ |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
711 for (uint i = 0; i < this->servers.Length(); i++) { |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
712 if (this->servers[i] == this->server) { |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
713 this->list_pos = i; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
714 break; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
715 } |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
716 } |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
717 this->ScrollToSelectedServer(); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
718 this->SetDirty(); |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
719 |
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
720 /* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */ |
14410
9a9236bf1a28
(svn r18967) -Fix (r18966): Never trust your copy&paste skills.
frosch <frosch@openttd.org>
parents:
14409
diff
changeset
|
721 if (click_count > 1 && !this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN, 1); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
722 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
723 } break; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
724 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
725 case NGWW_FIND: // Find server automatically |
9420
ec47ec544964
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium <rubidium@openttd.org>
parents:
9416
diff
changeset
|
726 switch (_settings_client.network.lan_internet) { |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
727 case 0: NetworkUDPSearchGame(); break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
728 case 1: NetworkUDPQueryMasterServer(); break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
729 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
730 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
731 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
732 case NGWW_ADD: // Add a server |
9648
b53049484e44
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium <rubidium@openttd.org>
parents:
9481
diff
changeset
|
733 SetDParamStr(0, _settings_client.network.connect_to_ip); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
734 ShowQueryString( |
9648
b53049484e44
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium <rubidium@openttd.org>
parents:
9481
diff
changeset
|
735 STR_JUST_RAW_STRING, |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
736 STR_NETWORK_SERVER_LIST_ENTER_IP, |
11860
ebf5beca420e
(svn r16254) -Fix [FS#2886]: Magic constant removed.
frosch <frosch@openttd.org>
parents:
11847
diff
changeset
|
737 NETWORK_HOSTNAME_LENGTH, // maximum number of characters including '\0' |
ebf5beca420e
(svn r16254) -Fix [FS#2886]: Magic constant removed.
frosch <frosch@openttd.org>
parents:
11847
diff
changeset
|
738 0, // no limit in pixels |
10145
dbe302da93a8
(svn r14331) -Codechange: use an enum as additional parameter for ShowQueryString()
smatz <smatz@openttd.org>
parents:
10061
diff
changeset
|
739 this, CS_ALPHANUMERAL, QSF_ACCEPT_UNCHANGED); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
740 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
741 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
742 case NGWW_START: // Start server |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
743 ShowNetworkStartServerWindow(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
744 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
745 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
746 case NGWW_JOIN: // Join Game |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
747 if (this->server != NULL) { |
11551
939f22f810ef
(svn r15916) -Codechange: let the network game list use NetworkAddress
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
748 snprintf(_settings_client.network.last_host, sizeof(_settings_client.network.last_host), "%s", this->server->address.GetHostname()); |
939f22f810ef
(svn r15916) -Codechange: let the network game list use NetworkAddress
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
749 _settings_client.network.last_port = this->server->address.GetPort(); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
750 ShowNetworkLobbyWindow(this->server); |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
751 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
752 break; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
753 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
754 case NGWW_REFRESH: // Refresh |
11551
939f22f810ef
(svn r15916) -Codechange: let the network game list use NetworkAddress
rubidium <rubidium@openttd.org>
parents:
11524
diff
changeset
|
755 if (this->server != NULL) NetworkUDPQueryServer(this->server->address); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
756 break; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
757 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
758 case NGWW_NEWGRF: // NewGRF Settings |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
759 if (this->server != NULL) ShowNewGRFSettings(false, false, false, &this->server->info.grfconfig); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
760 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
761 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
762 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
763 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
764 virtual void OnDropdownSelect(int widget, int index) |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
765 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
766 switch (widget) { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
767 case NGWW_CONN_BTN: |
9420
ec47ec544964
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium <rubidium@openttd.org>
parents:
9416
diff
changeset
|
768 _settings_client.network.lan_internet = index; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
769 break; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
770 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
771 default: |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
772 NOT_REACHED(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
773 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
774 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
775 this->SetDirty(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
776 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
777 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
778 virtual void OnMouseLoop() |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
779 { |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
780 if (this->field == NGWW_CLIENT) this->HandleEditBox(NGWW_CLIENT); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
781 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
782 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
783 virtual void OnInvalidateData(int data) |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
784 { |
10793
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
785 switch (data) { |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
786 /* Remove the selection */ |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
787 case 1: |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
788 this->server = NULL; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
789 this->list_pos = SLP_INVALID; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
790 break; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
791 |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
792 /* Reiterate the whole server list as we downloaded some files */ |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
793 case 2: |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
794 for (NetworkGameList **iter = this->servers.Begin(); iter != this->servers.End(); iter++) { |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
795 NetworkGameList *item = *iter; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
796 bool missing_grfs = false; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
797 for (GRFConfig *c = item->info.grfconfig; c != NULL; c = c->next) { |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
798 if (c->status != GCS_NOT_FOUND) continue; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
799 |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
800 const GRFConfig *f = FindGRFConfig(c->grfid, c->md5sum); |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
801 if (f == NULL) { |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
802 missing_grfs = true; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
803 continue; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
804 } |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
805 |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
806 c->filename = f->filename; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
807 c->name = f->name; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
808 c->info = f->info; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
809 c->status = GCS_UNKNOWN; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
810 } |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
811 |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
812 if (!missing_grfs) item->info.compatible = item->info.version_compatible; |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
813 } |
0744d383a56b
(svn r15126) -Feature: downloading content from a central server (content.openttd.org) where authors can upload they NewGRFS/AI etc. This should make joining servers that use only NewGRFs that are distributed via this system easier as the players can download the NewGRFs from in the game. It should also make it easier to see whether there are updates for NewGRFs and make the necessary updates.
rubidium <rubidium@openttd.org>
parents:
10771
diff
changeset
|
814 break; |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
815 } |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
816 this->servers.ForceRebuild(); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
817 this->SetDirty(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
818 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
819 |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9274
diff
changeset
|
820 virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
821 { |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9274
diff
changeset
|
822 EventState state = ES_NOT_HANDLED; |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
823 |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
824 /* handle up, down, pageup, pagedown, home and end */ |
10641
94cbc9a0158b
(svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents:
10559
diff
changeset
|
825 if (keycode == WKC_UP || keycode == WKC_DOWN || keycode == WKC_PAGEUP || keycode == WKC_PAGEDOWN || keycode == WKC_HOME || keycode == WKC_END) { |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
826 if (this->servers.Length() == 0) return ES_HANDLED; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
827 switch (keycode) { |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
828 case WKC_UP: |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
829 /* scroll up by one */ |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
830 if (this->server == NULL) return ES_HANDLED; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
831 if (this->list_pos > 0) this->list_pos--; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
832 break; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
833 case WKC_DOWN: |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
834 /* scroll down by one */ |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
835 if (this->server == NULL) return ES_HANDLED; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
836 if (this->list_pos < this->servers.Length() - 1) this->list_pos++; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
837 break; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
838 case WKC_PAGEUP: |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
839 /* scroll up a page */ |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
840 if (this->server == NULL) return ES_HANDLED; |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
841 this->list_pos = (this->list_pos < this->vscroll.GetCapacity()) ? 0 : this->list_pos - this->vscroll.GetCapacity(); |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
842 break; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
843 case WKC_PAGEDOWN: |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
844 /* scroll down a page */ |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
845 if (this->server == NULL) return ES_HANDLED; |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
846 this->list_pos = min(this->list_pos + this->vscroll.GetCapacity(), (int)this->servers.Length() - 1); |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
847 break; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
848 case WKC_HOME: |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
849 /* jump to beginning */ |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
850 this->list_pos = 0; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
851 break; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
852 case WKC_END: |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
853 /* jump to end */ |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
854 this->list_pos = this->servers.Length() - 1; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
855 break; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
856 default: break; |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
857 } |
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
858 |
10641
94cbc9a0158b
(svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents:
10559
diff
changeset
|
859 this->server = this->servers[this->list_pos]; |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
860 |
10641
94cbc9a0158b
(svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents:
10559
diff
changeset
|
861 /* scroll to the new server if it is outside the current range */ |
94cbc9a0158b
(svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents:
10559
diff
changeset
|
862 this->ScrollToSelectedServer(); |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
863 |
10641
94cbc9a0158b
(svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents:
10559
diff
changeset
|
864 /* redraw window */ |
94cbc9a0158b
(svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents:
10559
diff
changeset
|
865 this->SetDirty(); |
94cbc9a0158b
(svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents:
10559
diff
changeset
|
866 return ES_HANDLED; |
94cbc9a0158b
(svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents:
10559
diff
changeset
|
867 } |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
868 |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
869 if (this->field != NGWW_CLIENT) { |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
870 if (this->server != NULL) { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
871 if (keycode == WKC_DELETE) { // Press 'delete' to remove servers |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
872 NetworkGameListRemoveItem(this->server); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
873 this->server = NULL; |
10279
63bfb33e1a12
(svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents:
10208
diff
changeset
|
874 this->list_pos = SLP_INVALID; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
875 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
876 } |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9274
diff
changeset
|
877 return state; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
878 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
879 |
10295
7ebf43f7c36b
(svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
glx <glx@openttd.org>
parents:
10292
diff
changeset
|
880 if (this->HandleEditBoxKey(NGWW_CLIENT, key, keycode, state) == HEBR_CONFIRM) return state; |
7343
76fcc58cd6c7
(svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium <rubidium@openttd.org>
parents:
7341
diff
changeset
|
881 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
882 /* The name is only allowed when it starts with a letter! */ |
9416
b6fea52829e6
(svn r13330) -Fix: 'Player name' dialog was broken in two ways
smatz <smatz@openttd.org>
parents:
9415
diff
changeset
|
883 if (!StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') { |
10310
5cefbb1c3fd7
(svn r14555) -Codechange: replace ttd_strlcat and ttd_strlcpy with strecat and strecpy where direct conversion is possible
skidd13 <skidd13@openttd.org>
parents:
10301
diff
changeset
|
884 strecpy(_settings_client.network.client_name, this->edit_str_buf, lastof(_settings_client.network.client_name)); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
885 } else { |
10310
5cefbb1c3fd7
(svn r14555) -Codechange: replace ttd_strlcat and ttd_strlcpy with strecat and strecpy where direct conversion is possible
skidd13 <skidd13@openttd.org>
parents:
10301
diff
changeset
|
886 strecpy(_settings_client.network.client_name, "Player", lastof(_settings_client.network.client_name)); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
887 } |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9274
diff
changeset
|
888 return state; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
889 } |
7343
76fcc58cd6c7
(svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium <rubidium@openttd.org>
parents:
7341
diff
changeset
|
890 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
891 virtual void OnQueryTextFinished(char *str) |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
892 { |
12543
ea54644136d4
(svn r16981) -Fix [FS#3062]: the last manually added server would not be saved
rubidium <rubidium@openttd.org>
parents:
12493
diff
changeset
|
893 if (!StrEmpty(str)) NetworkAddServer(str); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
894 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
895 |
13344
04b02b2cfa2b
(svn r17853) -Codechange: remove the 'delta' parameter from OnResize; it was used in ways that aren't always wanted, causing bugs and the like. Also with nested widgets most reasons for handling OnResize have gone.
rubidium <rubidium@openttd.org>
parents:
13277
diff
changeset
|
896 virtual void OnResize() |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
897 { |
14037
ca29deba0f1a
(svn r18580) -Codechange: Use widget information only for setting scrollbar capacity.
alberth <alberth@openttd.org>
parents:
14035
diff
changeset
|
898 this->vscroll.SetCapacityFromWidget(this, NGWW_MATRIX); |
ca29deba0f1a
(svn r18580) -Codechange: Use widget information only for setting scrollbar capacity.
alberth <alberth@openttd.org>
parents:
14035
diff
changeset
|
899 this->GetWidget<NWidgetCore>(NGWW_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
900 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
901 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
902 |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
903 Listing NetworkGameWindow::last_sorting = {false, 5}; |
11376
b9b2391afd1a
(svn r15726) -Codechange: unify coding style for const pointers
smatz <smatz@openttd.org>
parents:
11374
diff
changeset
|
904 GUIGameServerList::SortFunction * const NetworkGameWindow::sorter_funcs[] = { |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
905 &NGameNameSorter, |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
906 &NGameClientSorter, |
9660
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
907 &NGameMapSizeSorter, |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
908 &NGameDateSorter, |
25bb065da92b
(svn r13732) -Feature: add a few extra columns with information to the server list. Patch by Pegasus.
rubidium <rubidium@openttd.org>
parents:
9659
diff
changeset
|
909 &NGameYearsSorter, |
9414
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
910 &NGameAllowedSorter |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
911 }; |
ca0680949f89
(svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents:
9413
diff
changeset
|
912 |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
913 static NWidgetBase *MakeResizableHeader(int *biggest_index) |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
914 { |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
915 *biggest_index = max<int>(*biggest_index, NGWW_INFO); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
916 return new NWidgetServerListHeader(); |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
917 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
918 |
13096
e3e4c1648e0c
(svn r17596) -Codechange: constify some tables
smatz <smatz@openttd.org>
parents:
13041
diff
changeset
|
919 static const NWidgetPart _nested_network_game_widgets[] = { |
11462
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
920 /* TOP */ |
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
921 NWidget(NWID_HORIZONTAL), |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
922 NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), |
14046
425d4e2d7cb7
(svn r18589) -Codechange: Add tooltip to some network windows, remove old comment.
alberth <alberth@openttd.org>
parents:
14037
diff
changeset
|
923 NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_NETWORK_SERVER_LIST_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
11462
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
924 EndContainer(), |
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
925 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_MAIN), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
926 NWidget(NWID_VERTICAL), SetPIP(10, 7, 0), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
927 NWidget(NWID_HORIZONTAL), SetPIP(10, 7, 10), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
928 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NGWW_CONNECTION), SetDataTip(STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
929 NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, NGWW_CONN_BTN), |
13556
e7121cbd5f5a
(svn r18078) -Codechange: remove some duplicate (non translatable) strings
rubidium <rubidium@openttd.org>
parents:
13449
diff
changeset
|
930 SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_CONNECTION_TOOLTIP), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
931 NWidget(NWID_SPACER), SetFill(1, 0), SetResize(1, 0), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
932 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NGWW_CLIENT_LABEL), SetDataTip(STR_NETWORK_SERVER_LIST_PLAYER_NAME, STR_NULL), |
11462
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
933 NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, NGWW_CLIENT), SetMinimalSize(151, 12), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
934 SetDataTip(STR_NETWORK_SERVER_LIST_PLAYER_NAME_OSKTITLE, STR_NETWORK_SERVER_LIST_ENTER_NAME_TOOLTIP), |
11462
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
935 EndContainer(), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
936 NWidget(NWID_HORIZONTAL), SetPIP(10, 7, 10), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
937 /* LEFT SIDE */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
938 NWidget(NWID_VERTICAL), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
939 NWidget(NWID_HORIZONTAL), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
940 NWidget(NWID_VERTICAL), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
941 NWidgetFunction(MakeResizableHeader), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
942 NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NGWW_MATRIX), SetResize(1, 1), SetFill(1, 0), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
943 SetDataTip(0, STR_NETWORK_SERVER_LIST_CLICK_GAME_TO_SELECT), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
944 EndContainer(), |
13688
93b8eb4077e0
(svn r18213) -Codechange: it's not needed to manually set the fill, (re)size and tooltip for scrollbars
rubidium <rubidium@openttd.org>
parents:
13687
diff
changeset
|
945 NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NGWW_SCROLLBAR), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
946 EndContainer(), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
947 NWidget(NWID_SPACER), SetMinimalSize(0, 7), SetResize(1, 0), SetFill(1, 1), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
948 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NGWW_LASTJOINED_LABEL), SetFill(1, 0), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
949 SetDataTip(STR_NETWORK_SERVER_LIST_LAST_JOINED_SERVER, STR_NULL), SetResize(1, 0), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
950 NWidget(NWID_HORIZONTAL), SetPIP(0, 0, WD_VSCROLLBAR_WIDTH), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
951 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_LASTJOINED), SetFill(1, 0), SetResize(1, 0), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
952 SetDataTip(0x0, STR_NETWORK_SERVER_LIST_CLICK_TO_SELECT_LAST), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
953 EndContainer(), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
954 EndContainer(), |
11462
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
955 EndContainer(), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
956 /* RIGHT SIDE */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
957 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_DETAILS), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
958 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(5, 5, 5), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
959 NWidget(WWT_EMPTY, INVALID_COLOUR, NGWW_DETAILS_SPACER), SetMinimalSize(140, 155), SetResize(0, 1), SetFill(1, 1), // Make sure it's at least this wide |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
960 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(5, 5, 5), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
961 NWidget(NWID_SPACER), SetFill(1, 0), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
962 NWidget(NWID_SELECTION, INVALID_COLOUR, NGWW_NEWGRF_SEL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
963 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_NEWGRF), SetFill(1, 0), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_NULL), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
964 NWidget(NWID_SPACER), SetFill(1, 0), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
965 EndContainer(), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
966 EndContainer(), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
967 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(5, 5, 5), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
968 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_JOIN), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_JOIN_GAME, STR_NULL), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
969 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_REFRESH), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
970 EndContainer(), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
971 EndContainer(), |
11462
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
972 EndContainer(), |
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
973 EndContainer(), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
974 /* BOTTOM */ |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
975 NWidget(NWID_HORIZONTAL), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
976 NWidget(NWID_VERTICAL), |
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
977 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 7, 4), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
978 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_FIND), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_FIND_SERVER, STR_NETWORK_SERVER_LIST_FIND_SERVER_TOOLTIP), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
979 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_ADD), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_ADD_SERVER, STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
980 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_START), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_START_SERVER, STR_NETWORK_SERVER_LIST_START_SERVER_TOOLTIP), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
981 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
982 EndContainer(), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
983 NWidget(NWID_SPACER), SetMinimalSize(0, 6), SetResize(1, 0), SetFill(1, 0), |
11462
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
984 EndContainer(), |
13396
c50ed98b49ff
(svn r17905) -Codechange: make the network server list window nested (and increase the default size slightly)
rubidium <rubidium@openttd.org>
parents:
13378
diff
changeset
|
985 NWidget(NWID_VERTICAL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
986 NWidget(NWID_SPACER), SetFill(0, 1), |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
987 NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE), |
11462
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
988 EndContainer(), |
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
989 EndContainer(), |
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
990 EndContainer(), |
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
991 EndContainer(), |
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
992 }; |
043d6b6bf604
(svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents:
11454
diff
changeset
|
993 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
994 static const WindowDesc _network_game_window_desc( |
13796
3e68f07eb821
(svn r18322) -Codechange: remove the WDP duplication; no need to tell the same twice.
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
995 WDP_CENTER, 1000, 730, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5669
diff
changeset
|
996 WC_NETWORK_WINDOW, WC_NONE, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13726
diff
changeset
|
997 WDF_UNCLICK_BUTTONS, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13556
diff
changeset
|
998 _nested_network_game_widgets, lengthof(_nested_network_game_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
999 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1000 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
5916
diff
changeset
|
1001 void ShowNetworkGameWindow() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1002 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1003 static bool first = true; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1004 DeleteWindowById(WC_NETWORK_WINDOW, 0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1005 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1006 /* Only show once */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1007 if (first) { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1008 first = false; |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1009 /* add all servers from the config file to our list */ |
11565
cf37aec7c469
(svn r15931) -Codechange: let the host and ban lists use of SmallVector.
rubidium <rubidium@openttd.org>
parents:
11551
diff
changeset
|
1010 for (char **iter = _network_host_list.Begin(); iter != _network_host_list.End(); iter++) { |
cf37aec7c469
(svn r15931) -Codechange: let the host and ban lists use of SmallVector.
rubidium <rubidium@openttd.org>
parents:
11551
diff
changeset
|
1011 NetworkAddServer(*iter); |
13194
4b124fd22c06
(svn r17701) -Codechange: don't start line with a space if it's not inside comment
smatz <smatz@openttd.org>
parents:
13186
diff
changeset
|
1012 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1013 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1014 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1015 new NetworkGameWindow(&_network_game_window_desc); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1016 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1017 |
7959
35aac28f0022
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7931
diff
changeset
|
1018 /** Enum for NetworkStartServerWindow, referring to _network_start_server_window_widgets */ |
35aac28f0022
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7931
diff
changeset
|
1019 enum NetworkStartServerWidgets { |
11846
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1020 NSSW_BACKGROUND, |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1021 NSSW_GAMENAME_LABEL, |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1022 NSSW_GAMENAME, ///< Background for editbox to set game name |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1023 NSSW_SETPWD, ///< 'Set password' button |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1024 NSSW_SELECT_MAP_LABEL, |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1025 NSSW_SELMAP, ///< 'Select map' list |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1026 NSSW_SCROLLBAR, |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1027 NSSW_CONNTYPE_LABEL, |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1028 NSSW_CONNTYPE_BTN, ///< 'Connection type' droplist button |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1029 NSSW_CLIENTS_LABEL, |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1030 NSSW_CLIENTS_BTND, ///< 'Max clients' downarrow |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1031 NSSW_CLIENTS_TXT, ///< 'Max clients' text |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1032 NSSW_CLIENTS_BTNU, ///< 'Max clients' uparrow |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1033 NSSW_COMPANIES_LABEL, |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1034 NSSW_COMPANIES_BTND, ///< 'Max companies' downarrow |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1035 NSSW_COMPANIES_TXT, ///< 'Max companies' text |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1036 NSSW_COMPANIES_BTNU, ///< 'Max companies' uparrow |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1037 NSSW_SPECTATORS_LABEL, |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1038 NSSW_SPECTATORS_BTND, ///< 'Max spectators' downarrow |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1039 NSSW_SPECTATORS_TXT, ///< 'Max spectators' text |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1040 NSSW_SPECTATORS_BTNU, ///< 'Max spectators' uparrow |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1041 |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1042 NSSW_LANGUAGE_LABEL, |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1043 NSSW_LANGUAGE_BTN, ///< 'Language spoken' droplist button |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1044 NSSW_START, ///< 'Start' button |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1045 NSSW_LOAD, ///< 'Load' button |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1046 NSSW_CANCEL, ///< 'Cancel' button |
7959
35aac28f0022
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7931
diff
changeset
|
1047 }; |
35aac28f0022
(svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7931
diff
changeset
|
1048 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1049 struct NetworkStartServerWindow : public QueryStringBaseWindow { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1050 byte field; ///< Selected text-field |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1051 FiosItem *map; ///< Selected map |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1052 byte widget_id; ///< The widget that has the pop-up input menu |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1053 |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1054 NetworkStartServerWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_NAME_LENGTH) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1055 { |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1056 this->InitNested(desc, 0); |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1057 |
9897
5b558ce6cb0e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents:
9827
diff
changeset
|
1058 ttd_strlcpy(this->edit_str_buf, _settings_client.network.server_name, this->edit_str_size); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1059 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1060 _saveload_mode = SLD_NEW_GAME; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1061 BuildFileList(); |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1062 this->vscroll.SetCapacity(14); |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
1063 this->vscroll.SetCount(_fios_items.Length() + 1); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1064 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1065 this->afilter = CS_ALPHANUMERAL; |
9897
5b558ce6cb0e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents:
9827
diff
changeset
|
1066 InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 160); |
11081
0a26df8849a2
(svn r15424) -Codechange: make it possible to have multiple windows with edit box open simultaniously (Zuu).
rubidium <rubidium@openttd.org>
parents:
11069
diff
changeset
|
1067 this->SetFocusedWidget(NSSW_GAMENAME); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1068 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1069 this->field = NSSW_GAMENAME; |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1070 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1071 |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1072 virtual void SetStringParameters(int widget) const |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1073 { |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1074 switch (widget) { |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1075 case NSSW_CONNTYPE_BTN: |
13378
1d98fd82aa68
(svn r17887) -Codechange: remove some (now) unneeded {SKIP}s
rubidium <rubidium@openttd.org>
parents:
13377
diff
changeset
|
1076 SetDParam(0, _connection_types_dropdown[_settings_client.network.server_advertise]); |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1077 break; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1078 |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1079 case NSSW_CLIENTS_TXT: |
13378
1d98fd82aa68
(svn r17887) -Codechange: remove some (now) unneeded {SKIP}s
rubidium <rubidium@openttd.org>
parents:
13377
diff
changeset
|
1080 SetDParam(0, _settings_client.network.max_clients); |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1081 break; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1082 |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1083 case NSSW_COMPANIES_TXT: |
13378
1d98fd82aa68
(svn r17887) -Codechange: remove some (now) unneeded {SKIP}s
rubidium <rubidium@openttd.org>
parents:
13377
diff
changeset
|
1084 SetDParam(0, _settings_client.network.max_companies); |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1085 break; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1086 |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1087 case NSSW_SPECTATORS_TXT: |
13378
1d98fd82aa68
(svn r17887) -Codechange: remove some (now) unneeded {SKIP}s
rubidium <rubidium@openttd.org>
parents:
13377
diff
changeset
|
1088 SetDParam(0, _settings_client.network.max_spectators); |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1089 break; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1090 |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1091 case NSSW_LANGUAGE_BTN: |
13378
1d98fd82aa68
(svn r17887) -Codechange: remove some (now) unneeded {SKIP}s
rubidium <rubidium@openttd.org>
parents:
13377
diff
changeset
|
1092 SetDParam(0, STR_NETWORK_LANG_ANY + _settings_client.network.server_lang); |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1093 break; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1094 } |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1095 } |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1096 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
1097 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1098 { |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1099 switch (widget) { |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1100 case NSSW_CONNTYPE_BTN: |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1101 *size = maxdim(GetStringBoundingBox(_connection_types_dropdown[0]), GetStringBoundingBox(_connection_types_dropdown[1])); |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1102 size->width += padding.width; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1103 size->height += padding.height; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1104 break; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1105 |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1106 case NSSW_SELMAP: |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1107 resize->height = FONT_HEIGHT_NORMAL; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1108 size->height = 14 * resize->height + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1109 break; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1110 } |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1111 } |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1112 |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1113 virtual void DrawWidget(const Rect &r, int widget) const |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1114 { |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1115 switch (widget) { |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1116 case NSSW_SELMAP: |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1117 this->DrawMapSelection(r); |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1118 break; |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1119 |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1120 case NSSW_SETPWD: |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1121 /* if password is set, draw red '*' next to 'Set password' button */ |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1122 if (!StrEmpty(_settings_client.network.server_password)) DrawString(r.right + WD_FRAMERECT_LEFT, this->width - WD_FRAMERECT_RIGHT, r.top, "*", TC_RED); |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1123 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1124 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1125 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1126 virtual void OnPaint() |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1127 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1128 /* draw basic widgets */ |
9273
72a6d2e60834
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents:
9269
diff
changeset
|
1129 this->DrawWidgets(); |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1130 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1131 /* editbox to set game name */ |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1132 this->DrawEditBox(NSSW_GAMENAME); |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1133 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1134 |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1135 void DrawMapSelection(const Rect &r) const |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1136 { |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1137 int y = r.top + WD_FRAMERECT_TOP; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1138 /* draw list of maps */ |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1139 GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.bottom - 1, 0xD7); // black background of maps list |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1140 |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
1141 for (uint pos = this->vscroll.GetPosition(); pos < _fios_items.Length() + 1; pos++) { |
14098
6d35a3f22ae1
(svn r18645) -Fix [FS#3433](r942): out-of-bounds access in the 'Start new multiplayer game' GUI
smatz <smatz@openttd.org>
parents:
14052
diff
changeset
|
1142 const FiosItem *item = (pos == 0) ? NULL : _fios_items.Get(pos - 1); |
6d35a3f22ae1
(svn r18645) -Fix [FS#3433](r942): out-of-bounds access in the 'Start new multiplayer game' GUI
smatz <smatz@openttd.org>
parents:
14052
diff
changeset
|
1143 if (item == this->map) { // this->map == NULL for first item |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1144 GfxFillRect(r.left + 1, y, r.right - 1, y + FONT_HEIGHT_NORMAL - 1, 155); // show highlighted item with a different colour |
11464
56ddb993f77d
(svn r15822) -Codechange: replace some magic numbers and improve alignment of the start server window.
rubidium <rubidium@openttd.org>
parents:
11462
diff
changeset
|
1145 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1146 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1147 if (pos == 0) { |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1148 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_START_SERVER_SERVER_RANDOM_GAME, TC_DARK_GREEN); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1149 } else { |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1150 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, item->title, _fios_colours[item->type] ); |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1151 } |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1152 y += FONT_HEIGHT_NORMAL; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1153 |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1154 if (y >= this->vscroll.GetCapacity() * FONT_HEIGHT_NORMAL + r.top) break; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1155 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1156 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1157 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
1158 virtual void OnClick(Point pt, int widget, int click_count) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1159 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1160 this->field = widget; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1161 switch (widget) { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1162 case NSSW_CANCEL: // Cancel button |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1163 ShowNetworkGameWindow(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1164 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1165 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1166 case NSSW_SETPWD: // Set password button |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1167 this->widget_id = NSSW_SETPWD; |
9648
b53049484e44
(svn r13715) -Fix [FS#2129]: C-like strings had to be rebound each time they were printed, otherwise the text could change due to the few number of slots that could be used to bind.
rubidium <rubidium@openttd.org>
parents:
9481
diff
changeset
|
1168 SetDParamStr(0, _settings_client.network.server_password); |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1169 ShowQueryString(STR_JUST_RAW_STRING, STR_NETWORK_START_SERVER_SET_PASSWORD, 20, 250, this, CS_ALPHANUMERAL, QSF_NONE); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1170 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1171 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1172 case NSSW_SELMAP: { // Select map |
13695
75560523443c
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents:
13694
diff
changeset
|
1173 int y = (pt.y - this->GetWidget<NWidgetBase>(NSSW_SELMAP)->pos_y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1174 |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
1175 y += this->vscroll.GetPosition(); |
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
1176 if (y >= this->vscroll.GetCount()) return; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1177 |
9441
e899ed594e7c
(svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13 <skidd13@openttd.org>
parents:
9428
diff
changeset
|
1178 this->map = (y == 0) ? NULL : _fios_items.Get(y - 1); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1179 this->SetDirty(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1180 } break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1181 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1182 case NSSW_CONNTYPE_BTN: // Connection type |
9481
cbb53dc04d5b
(svn r13433) -Codechange: remove a now useless global variable.
rubidium <rubidium@openttd.org>
parents:
9462
diff
changeset
|
1183 ShowDropDownMenu(this, _connection_types_dropdown, _settings_client.network.server_advertise, NSSW_CONNTYPE_BTN, 0, 0); // do it for widget NSSW_CONNTYPE_BTN |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1184 break; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1185 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1186 case NSSW_CLIENTS_BTND: case NSSW_CLIENTS_BTNU: // Click on up/down button for number of clients |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1187 case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU: // Click on up/down button for number of companies |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1188 case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU: // Click on up/down button for number of spectators |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1189 /* Don't allow too fast scrolling */ |
10180
e024f1d28082
(svn r14390) -Codechange: replace magic constants with symbolic constants.
rubidium <rubidium@openttd.org>
parents:
10145
diff
changeset
|
1190 if ((this->flags4 & WF_TIMEOUT_MASK) <= WF_TIMEOUT_TRIGGER) { |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1191 this->HandleButtonClick(widget); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1192 this->SetDirty(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1193 switch (widget) { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1194 default: NOT_REACHED(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1195 case NSSW_CLIENTS_BTND: case NSSW_CLIENTS_BTNU: |
9451
49dffcace617
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents:
9441
diff
changeset
|
1196 _settings_client.network.max_clients = Clamp(_settings_client.network.max_clients + widget - NSSW_CLIENTS_TXT, 2, MAX_CLIENTS); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1197 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1198 case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU: |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
1199 _settings_client.network.max_companies = Clamp(_settings_client.network.max_companies + widget - NSSW_COMPANIES_TXT, 1, MAX_COMPANIES); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1200 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1201 case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU: |
9451
49dffcace617
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents:
9441
diff
changeset
|
1202 _settings_client.network.max_spectators = Clamp(_settings_client.network.max_spectators + widget - NSSW_SPECTATORS_TXT, 0, MAX_CLIENTS); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1203 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1204 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1205 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1206 _left_button_clicked = false; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1207 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1208 |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
1209 case NSSW_CLIENTS_TXT: // Click on number of clients |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1210 this->widget_id = NSSW_CLIENTS_TXT; |
9451
49dffcace617
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents:
9441
diff
changeset
|
1211 SetDParam(0, _settings_client.network.max_clients); |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1212 ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS, 4, 50, this, CS_NUMERAL, QSF_NONE); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1213 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1214 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1215 case NSSW_COMPANIES_TXT: // Click on number of companies |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1216 this->widget_id = NSSW_COMPANIES_TXT; |
9451
49dffcace617
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents:
9441
diff
changeset
|
1217 SetDParam(0, _settings_client.network.max_companies); |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1218 ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES, 3, 50, this, CS_NUMERAL, QSF_NONE); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1219 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1220 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1221 case NSSW_SPECTATORS_TXT: // Click on number of spectators |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1222 this->widget_id = NSSW_SPECTATORS_TXT; |
9451
49dffcace617
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents:
9441
diff
changeset
|
1223 SetDParam(0, _settings_client.network.max_spectators); |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1224 ShowQueryString(STR_JUST_INT, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS, 4, 50, this, CS_NUMERAL, QSF_NONE); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1225 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1226 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1227 case NSSW_LANGUAGE_BTN: { // Language |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1228 uint sel = 0; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1229 for (uint i = 0; i < lengthof(_language_dropdown) - 1; i++) { |
9451
49dffcace617
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents:
9441
diff
changeset
|
1230 if (_language_dropdown[i] == STR_NETWORK_LANG_ANY + _settings_client.network.server_lang) { |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1231 sel = i; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1232 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1233 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1234 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1235 ShowDropDownMenu(this, _language_dropdown, sel, NSSW_LANGUAGE_BTN, 0, 0); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1236 } break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1237 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1238 case NSSW_START: // Start game |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1239 _is_network_server = true; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1240 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1241 if (this->map == NULL) { // start random new game |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1242 ShowGenerateLandscape(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1243 } else { // load a scenario |
11256
f63c1d69ed92
(svn r15605) -Codechange: constify a function
rubidium <rubidium@openttd.org>
parents:
11223
diff
changeset
|
1244 const char *name = FiosBrowseTo(this->map); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1245 if (name != NULL) { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1246 SetFiosType(this->map->type); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1247 _file_to_saveload.filetype = FT_SCENARIO; |
10310
5cefbb1c3fd7
(svn r14555) -Codechange: replace ttd_strlcat and ttd_strlcpy with strecat and strecpy where direct conversion is possible
skidd13 <skidd13@openttd.org>
parents:
10301
diff
changeset
|
1248 strecpy(_file_to_saveload.name, name, lastof(_file_to_saveload.name)); |
5cefbb1c3fd7
(svn r14555) -Codechange: replace ttd_strlcat and ttd_strlcpy with strecat and strecpy where direct conversion is possible
skidd13 <skidd13@openttd.org>
parents:
10301
diff
changeset
|
1249 strecpy(_file_to_saveload.title, this->map->title, lastof(_file_to_saveload.title)); |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1250 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1251 delete this; |
11223
4928ebb36453
(svn r15576) -Codechange: rename SwitchModes to SwitchMode and don't hardcode the values for that enum.
yexo <yexo@openttd.org>
parents:
11218
diff
changeset
|
1252 SwitchToMode(SM_START_SCENARIO); |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1253 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1254 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1255 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1256 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1257 case NSSW_LOAD: // Load game |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1258 _is_network_server = true; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1259 /* XXX - WC_NETWORK_WINDOW (this window) should stay, but if it stays, it gets |
11361
02313cc6114e
(svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents:
11319
diff
changeset
|
1260 * copied all the elements of 'load game' and upon closing that, it segfaults */ |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1261 delete this; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1262 ShowSaveLoadDialog(SLD_LOAD_GAME); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1263 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1264 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1265 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1266 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1267 virtual void OnDropdownSelect(int widget, int index) |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1268 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1269 switch (widget) { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1270 case NSSW_CONNTYPE_BTN: |
9481
cbb53dc04d5b
(svn r13433) -Codechange: remove a now useless global variable.
rubidium <rubidium@openttd.org>
parents:
9462
diff
changeset
|
1271 _settings_client.network.server_advertise = (index != 0); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1272 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1273 case NSSW_LANGUAGE_BTN: |
9451
49dffcace617
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents:
9441
diff
changeset
|
1274 _settings_client.network.server_lang = _language_dropdown[index] - STR_NETWORK_LANG_ANY; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1275 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1276 default: |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1277 NOT_REACHED(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1278 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1279 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1280 this->SetDirty(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1281 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1282 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1283 virtual void OnMouseLoop() |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1284 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1285 if (this->field == NSSW_GAMENAME) this->HandleEditBox(NSSW_GAMENAME); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1286 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1287 |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9274
diff
changeset
|
1288 virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1289 { |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9274
diff
changeset
|
1290 EventState state = ES_NOT_HANDLED; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1291 if (this->field == NSSW_GAMENAME) { |
10295
7ebf43f7c36b
(svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
glx <glx@openttd.org>
parents:
10292
diff
changeset
|
1292 if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == HEBR_CONFIRM) return state; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1293 |
10310
5cefbb1c3fd7
(svn r14555) -Codechange: replace ttd_strlcat and ttd_strlcpy with strecat and strecpy where direct conversion is possible
skidd13 <skidd13@openttd.org>
parents:
10301
diff
changeset
|
1294 strecpy(_settings_client.network.server_name, this->text.buf, lastof(_settings_client.network.server_name)); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1295 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1296 |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9274
diff
changeset
|
1297 return state; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1298 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1299 |
13694
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1300 virtual void OnTimeout() |
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1301 { |
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1302 static const int raise_widgets[] = {NSSW_CLIENTS_BTND, NSSW_CLIENTS_BTNU, NSSW_COMPANIES_BTND, NSSW_COMPANIES_BTNU, NSSW_SPECTATORS_BTND, NSSW_SPECTATORS_BTNU, WIDGET_LIST_END}; |
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1303 for (const int *widget = raise_widgets; *widget != WIDGET_LIST_END; widget++) { |
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1304 if (this->IsWidgetLowered(*widget)) { |
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1305 this->RaiseWidget(*widget); |
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1306 this->SetWidgetDirty(*widget); |
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1307 } |
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1308 } |
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1309 } |
c6a83b1d3775
(svn r18219) -Fix: the up/down buttons in the start network server window didn't work anymore
rubidium <rubidium@openttd.org>
parents:
13693
diff
changeset
|
1310 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1311 virtual void OnQueryTextFinished(char *str) |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1312 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1313 if (str == NULL) return; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1314 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1315 if (this->widget_id == NSSW_SETPWD) { |
10310
5cefbb1c3fd7
(svn r14555) -Codechange: replace ttd_strlcat and ttd_strlcpy with strecat and strecpy where direct conversion is possible
skidd13 <skidd13@openttd.org>
parents:
10301
diff
changeset
|
1316 strecpy(_settings_client.network.server_password, str, lastof(_settings_client.network.server_password)); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1317 } else { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1318 int32 value = atoi(str); |
13034
6eb3f749890a
(svn r17532) -Codechange: Rename several Invalidate functions to SetDirty for more consistency and distinguishability.
frosch <frosch@openttd.org>
parents:
13028
diff
changeset
|
1319 this->SetWidgetDirty(this->widget_id); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1320 switch (this->widget_id) { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1321 default: NOT_REACHED(); |
9451
49dffcace617
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents:
9441
diff
changeset
|
1322 case NSSW_CLIENTS_TXT: _settings_client.network.max_clients = Clamp(value, 2, MAX_CLIENTS); break; |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
1323 case NSSW_COMPANIES_TXT: _settings_client.network.max_companies = Clamp(value, 1, MAX_COMPANIES); break; |
9451
49dffcace617
(svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents:
9441
diff
changeset
|
1324 case NSSW_SPECTATORS_TXT: _settings_client.network.max_spectators = Clamp(value, 0, MAX_CLIENTS); break; |
7439
7ffb3a464c3a
(svn r10886) -Codechange: modify the "start network server" GUI so it can actually handle more than 10 clients/companies/spectators in a nice way, i.e. without making a combobox with 100 players and add 90 new strings to be able to do so.
rubidium <rubidium@openttd.org>
parents:
7363
diff
changeset
|
1325 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1326 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1327 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1328 this->SetDirty(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1329 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1330 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1331 |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1332 static const NWidgetPart _nested_network_start_server_window_widgets[] = { |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1333 NWidget(NWID_HORIZONTAL), |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
1334 NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), |
14046
425d4e2d7cb7
(svn r18589) -Codechange: Add tooltip to some network windows, remove old comment.
alberth <alberth@openttd.org>
parents:
14037
diff
changeset
|
1335 NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_NETWORK_START_SERVER_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1336 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1337 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NSSW_BACKGROUND), |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1338 NWidget(NWID_HORIZONTAL), SetPIP(10, 8, 10), |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1339 NWidget(NWID_VERTICAL), SetPIP(10, 0, 10), |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1340 /* Game name widgets */ |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1341 NWidget(NWID_HORIZONTAL), SetPIP(0, 2, 0), |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1342 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_GAMENAME_LABEL), SetDataTip(STR_NETWORK_START_SERVER_NEW_GAME_NAME, STR_NULL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1343 NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, NSSW_GAMENAME), SetMinimalSize(10, 12), SetFill(1, 0), |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1344 SetDataTip(STR_NETWORK_START_SERVER_NEW_GAME_NAME_OSKTITLE, STR_NETWORK_START_SERVER_NEW_GAME_NAME_TOOLTIP), |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1345 EndContainer(), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1346 /* List of playable scenarios. */ |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1347 NWidget(NWID_SPACER), SetMinimalSize(0, 8), SetFill(1, 0), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1348 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_SELECT_MAP_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_SELECT_MAP, STR_NULL), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1349 NWidget(NWID_SPACER), SetMinimalSize(0, 6), SetFill(1, 0), |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1350 NWidget(NWID_HORIZONTAL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1351 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NSSW_SELMAP), SetMinimalSize(250, 0), SetFill(1, 1), SetDataTip(STR_NULL, STR_NETWORK_START_SERVER_SELECT_MAP_TOOLTIP), EndContainer(), |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1352 NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NSSW_SCROLLBAR), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1353 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1354 EndContainer(), |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1355 NWidget(NWID_VERTICAL), SetPIP(10, 0, 10), |
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1356 /* Password widgets. */ |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1357 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_SETPWD), SetFill(1, 0), |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1358 SetDataTip(STR_NETWORK_START_SERVER_SET_PASSWORD, STR_NETWORK_START_SERVER_PASSWORD_TOOLTIP), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1359 /* Combo/selection boxes to control Connection Type / Max Clients / Max Companies / Max Observers / Language */ |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1360 NWidget(NWID_SPACER), SetFill(1, 1), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1361 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_CONNTYPE_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1362 NWidget(NWID_SPACER), SetMinimalSize(0, 1), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1363 NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, NSSW_CONNTYPE_BTN), SetFill(1, 0), |
13556
e7121cbd5f5a
(svn r18078) -Codechange: remove some duplicate (non translatable) strings
rubidium <rubidium@openttd.org>
parents:
13449
diff
changeset
|
1364 SetDataTip(STR_BLACK_STRING, STR_NETWORK_SERVER_LIST_CONNECTION_TOOLTIP), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1365 |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1366 NWidget(NWID_SPACER), SetMinimalSize(0, 6), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1367 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS, STR_NULL), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1368 NWidget(NWID_SPACER), SetMinimalSize(0, 1), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1369 NWidget(NWID_HORIZONTAL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1370 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_BTND), SetMinimalSize(12, 12), SetFill(0, 1), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1371 SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1372 NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_TXT), SetFill(1, 0), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1373 SetDataTip(STR_NETWORK_START_SERVER_CLIENTS_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1374 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_BTNU), SetMinimalSize(12, 12), SetFill(0, 1), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1375 SetDataTip(SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1376 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1377 |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1378 NWidget(NWID_SPACER), SetMinimalSize(0, 6), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1379 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES, STR_NULL), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1380 NWidget(NWID_SPACER), SetMinimalSize(0, 1), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1381 NWidget(NWID_HORIZONTAL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1382 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_BTND), SetMinimalSize(12, 12), SetFill(0, 1), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1383 SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1384 NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_TXT), SetFill(1, 0), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1385 SetDataTip(STR_NETWORK_START_SERVER_COMPANIES_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1386 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_BTNU), SetMinimalSize(12, 12), SetFill(0, 1), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1387 SetDataTip(SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1388 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1389 |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1390 NWidget(NWID_SPACER), SetMinimalSize(0, 6), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1391 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS, STR_NULL), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1392 NWidget(NWID_SPACER), SetMinimalSize(0, 1), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1393 NWidget(NWID_HORIZONTAL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1394 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_BTND), SetMinimalSize(12, 12), SetFill(0, 1), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1395 SetDataTip(SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1396 NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_TXT), SetFill(1, 0), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1397 SetDataTip(STR_NETWORK_START_SERVER_SPECTATORS_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1398 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_BTNU), SetMinimalSize(12, 12), SetFill(0, 1), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
1399 SetDataTip(SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1400 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1401 |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1402 NWidget(NWID_SPACER), SetMinimalSize(0, 6), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1403 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_LANGUAGE_LABEL), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_LANGUAGE_SPOKEN, STR_NULL), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1404 NWidget(NWID_SPACER), SetMinimalSize(0, 1), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1405 NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, NSSW_LANGUAGE_BTN), SetFill(1, 0), |
13556
e7121cbd5f5a
(svn r18078) -Codechange: remove some duplicate (non translatable) strings
rubidium <rubidium@openttd.org>
parents:
13449
diff
changeset
|
1406 SetDataTip(STR_BLACK_STRING, STR_NETWORK_START_SERVER_LANGUAGE_TOOLTIP), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1407 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1408 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1409 /* Buttons Start / Load / Cancel. */ |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1410 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 5, 10), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1411 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_START), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_START_GAME, STR_NETWORK_START_SERVER_START_GAME_TOOLTIP), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1412 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_LOAD), SetFill(1, 0), SetDataTip(STR_NETWORK_START_SERVER_LOAD_GAME, STR_NETWORK_START_SERVER_LOAD_GAME_TOOLTIP), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1413 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_CANCEL), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1414 EndContainer(), |
13377
8aa346820113
(svn r17886) -Codechange: make the 'start server' window nested
rubidium <rubidium@openttd.org>
parents:
13376
diff
changeset
|
1415 NWidget(NWID_SPACER), SetMinimalSize(0, 10), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1416 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1417 }; |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1418 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1419 static const WindowDesc _network_start_server_window_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
1420 WDP_CENTER, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5669
diff
changeset
|
1421 WC_NETWORK_WINDOW, WC_NONE, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13726
diff
changeset
|
1422 WDF_UNCLICK_BUTTONS, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13556
diff
changeset
|
1423 _nested_network_start_server_window_widgets, lengthof(_nested_network_start_server_window_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1424 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1425 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
5916
diff
changeset
|
1426 static void ShowNetworkStartServerWindow() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1427 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1428 DeleteWindowById(WC_NETWORK_WINDOW, 0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1429 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
1430 new NetworkStartServerWindow(&_network_start_server_window_desc); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1431 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1432 |
7963
c35c4ff096c4
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7961
diff
changeset
|
1433 /** Enum for NetworkLobbyWindow, referring to _network_lobby_window_widgets */ |
c35c4ff096c4
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7961
diff
changeset
|
1434 enum NetworkLobbyWindowWidgets { |
11846
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1435 NLWW_BACKGROUND, ///< Background panel |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1436 NLWW_TEXT, ///< Heading text |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1437 NLWW_HEADER, ///< Header above list of companies |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1438 NLWW_MATRIX, ///< List of companies |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1439 NLWW_SCROLLBAR, ///< Scroll bar |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1440 NLWW_DETAILS, ///< Company details |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1441 NLWW_JOIN, ///< 'Join company' button |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1442 NLWW_NEW, ///< 'New company' button |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1443 NLWW_SPECTATE, ///< 'Spectate game' button |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1444 NLWW_REFRESH, ///< 'Refresh server' button |
b9c21ebc0a28
(svn r16236) -Codechange: Make widget enums complete of various network windows, and add them as comment.
alberth <alberth@openttd.org>
parents:
11773
diff
changeset
|
1445 NLWW_CANCEL, ///< 'Cancel' button |
7963
c35c4ff096c4
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7961
diff
changeset
|
1446 }; |
c35c4ff096c4
(svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents:
7961
diff
changeset
|
1447 |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1448 struct NetworkLobbyWindow : public Window { |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
1449 CompanyID company; ///< Select company |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1450 NetworkGameList *server; ///< Selected server |
10457
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1451 NetworkCompanyInfo company_info[MAX_COMPANIES]; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1452 |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1453 NetworkLobbyWindow(const WindowDesc *desc, NetworkGameList *ngl) : |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1454 Window(), company(INVALID_COMPANY), server(ngl) |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1455 { |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1456 this->InitNested(desc, 0); |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1457 this->OnResize(); |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1458 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1459 |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1460 CompanyID NetworkLobbyFindCompanyIndex(byte pos) const |
10457
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1461 { |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1462 /* Scroll through all this->company_info and get the 'pos' item that is not empty */ |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1463 for (CompanyID i = COMPANY_FIRST; i < MAX_COMPANIES; i++) { |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1464 if (!StrEmpty(this->company_info[i].company_name)) { |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1465 if (pos-- == 0) return i; |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1466 } |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1467 } |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1468 |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1469 return COMPANY_FIRST; |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1470 } |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1471 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
1472 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1473 { |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1474 switch (widget) { |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1475 case NLWW_HEADER: |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1476 size->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM;; |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1477 break; |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1478 |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1479 case NLWW_MATRIX: |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1480 resize->height = WD_MATRIX_TOP + FONT_HEIGHT_NORMAL + WD_MATRIX_BOTTOM; |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1481 size->height = 10 * resize->height; |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1482 break; |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1483 |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1484 case NLWW_DETAILS: |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1485 size->height = 30 + 11 * FONT_HEIGHT_NORMAL; |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1486 break; |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1487 } |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1488 } |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1489 |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1490 virtual void SetStringParameters(int widget) const |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1491 { |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1492 switch (widget) { |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1493 case NLWW_TEXT: |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1494 SetDParamStr(0, this->server->info.server_name); |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1495 break; |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1496 } |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1497 } |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1498 |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1499 virtual void DrawWidget(const Rect &r, int widget) const |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1500 { |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1501 switch (widget) { |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1502 case NLWW_DETAILS: |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1503 this->DrawDetails(r); |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1504 break; |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1505 |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1506 case NLWW_MATRIX: |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1507 this->DrawMatrix(r); |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1508 break; |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1509 } |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1510 } |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1511 |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1512 virtual void OnPaint() |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1513 { |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1514 const NetworkGameInfo *gi = &this->server->info; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1515 |
10696
7edccbb67398
(svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
truebrain <truebrain@openttd.org>
parents:
10647
diff
changeset
|
1516 /* Join button is disabled when no company is selected and for AI companies*/ |
7edccbb67398
(svn r15027) -Merge: tomatos and bananas left to be, here is NoAI for all to see.
truebrain <truebrain@openttd.org>
parents:
10647
diff
changeset
|
1517 this->SetWidgetDisabledState(NLWW_JOIN, this->company == INVALID_COMPANY || GetLobbyCompanyInfo(this->company)->ai); |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1518 /* Cannot start new company if there are too many */ |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1519 this->SetWidgetDisabledState(NLWW_NEW, gi->companies_on >= gi->companies_max); |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1520 /* Cannot spectate if there are too many spectators */ |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1521 this->SetWidgetDisabledState(NLWW_SPECTATE, gi->spectators_on >= gi->spectators_max); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1522 |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
1523 this->vscroll.SetCount(gi->companies_on); |
10480
649ba332458f
(svn r14735) -Codechange: remove a bit of bit-waste in the map array (without changing the map array) and make the CompanyIDs contiguous.
rubidium <rubidium@openttd.org>
parents:
10475
diff
changeset
|
1524 |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1525 /* Draw window widgets */ |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1526 this->DrawWidgets(); |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1527 } |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1528 |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1529 void DrawMatrix(const Rect &r) const |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1530 { |
13651
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1531 bool rtl = _dynlang.text_dir == TD_RTL; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1532 uint left = r.left + WD_FRAMERECT_LEFT; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1533 uint right = r.right - WD_FRAMERECT_RIGHT; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1534 |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1535 uint text_left = left + (rtl ? 20 : 0); |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1536 uint text_right = right - (rtl ? 0 : 20); |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1537 uint blob_left = rtl ? left : right - 10; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1538 uint lock_left = rtl ? left + 10 : right - 20; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1539 |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1540 int y = r.top + WD_MATRIX_TOP; |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1541 /* Draw company list */ |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1542 int pos = this->vscroll.GetPosition(); |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1543 while (pos < this->server->info.companies_on) { |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1544 byte company = NetworkLobbyFindCompanyIndex(pos); |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1545 bool income = false; |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1546 if (this->company == company) { |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1547 GfxFillRect(r.left + 1, y - 2, r.right - 1, y + FONT_HEIGHT_NORMAL, 10); // show highlighted item with a different colour |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1548 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1549 |
13651
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1550 DrawString(text_left, text_right, y, this->company_info[company].company_name, TC_BLACK); |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
1551 if (this->company_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, lock_left, y); |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1552 |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1553 /* If the company's income was positive puts a green dot else a red dot */ |
10457
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1554 if (this->company_info[company].income >= 0) income = true; |
13693
a41d4d5669ba
(svn r18218) -Codechange: make a few network windows big font aware
rubidium <rubidium@openttd.org>
parents:
13688
diff
changeset
|
1555 DrawSprite(SPR_BLOT, income ? PALETTE_TO_GREEN : PALETTE_TO_RED, blob_left, y + (FONT_HEIGHT_NORMAL - 10) / 2); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1556 |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1557 pos++; |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1558 y += this->resize.step_height; |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
1559 if (pos >= this->vscroll.GetPosition() + this->vscroll.GetCapacity()) break; |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1560 } |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1561 } |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1562 |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1563 void DrawDetails(const Rect &r) const |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1564 { |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1565 const int detail_height = 12 + FONT_HEIGHT_NORMAL + 12; |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1566 /* Draw info about selected company when it is selected in the left window */ |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1567 GfxFillRect(r.left + 1, r.top + 1, r.right - 1, r.top + detail_height - 1, 157); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1568 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, r.top + 12, STR_NETWORK_GAME_LOBBY_COMPANY_INFO, TC_FROMSTRING, SA_CENTER); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1569 |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1570 if (this->company == INVALID_COMPANY || StrEmpty(this->company_info[this->company].company_name)) return; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1571 |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1572 int y = r.top + detail_height + 4; |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1573 const NetworkGameInfo *gi = &this->server->info; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1574 |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1575 SetDParam(0, gi->clients_on); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1576 SetDParam(1, gi->clients_max); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1577 SetDParam(2, gi->companies_on); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1578 SetDParam(3, gi->companies_max); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1579 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_SERVER_LIST_CLIENTS); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1580 y += FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1581 |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1582 SetDParamStr(0, this->company_info[this->company].company_name); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1583 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_COMPANY_NAME); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1584 y += FONT_HEIGHT_NORMAL; |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1585 |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1586 SetDParam(0, this->company_info[this->company].inaugurated_year); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1587 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_INAUGURATION_YEAR); // inauguration year |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1588 y += FONT_HEIGHT_NORMAL; |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1589 |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1590 SetDParam(0, this->company_info[this->company].company_value); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1591 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_VALUE); // company value |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1592 y += FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1593 |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1594 SetDParam(0, this->company_info[this->company].money); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1595 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_CURRENT_BALANCE); // current balance |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1596 y += FONT_HEIGHT_NORMAL; |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1597 |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1598 SetDParam(0, this->company_info[this->company].income); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1599 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_LAST_YEARS_INCOME); // last year's income |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1600 y += FONT_HEIGHT_NORMAL; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1601 |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1602 SetDParam(0, this->company_info[this->company].performance); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1603 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_PERFORMANCE); // performance |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1604 y += FONT_HEIGHT_NORMAL; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1605 |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1606 for (uint i = 0; i < lengthof(this->company_info[this->company].num_vehicle); i++) { |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1607 SetDParam(i, this->company_info[this->company].num_vehicle[i]); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1608 } |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1609 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_VEHICLES); // vehicles |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1610 y += FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1611 |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1612 for (uint i = 0; i < lengthof(this->company_info[this->company].num_station); i++) { |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1613 SetDParam(i, this->company_info[this->company].num_station[i]); |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1614 } |
13375
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1615 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_STATIONS); // stations |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1616 y += FONT_HEIGHT_NORMAL; |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1617 |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1618 SetDParamStr(0, this->company_info[this->company].clients); |
681d470b9847
(svn r17884) -Codechange: remove (most) magic numbers from drawing the details of the network lobby and split detail drawing to its own function
rubidium <rubidium@openttd.org>
parents:
13373
diff
changeset
|
1619 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, STR_NETWORK_GAME_LOBBY_PLAYERS); // players |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1620 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1621 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
1622 virtual void OnClick(Point pt, int widget, int click_count) |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1623 { |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1624 switch (widget) { |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1625 case NLWW_CANCEL: // Cancel button |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1626 ShowNetworkGameWindow(); |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1627 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1628 |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1629 case NLWW_MATRIX: { // Company list |
13695
75560523443c
(svn r18220) -Codechange: Reduce number of nested widget dynamic casts.
alberth <alberth@openttd.org>
parents:
13694
diff
changeset
|
1630 uint32 id_v = (pt.y - this->GetWidget<NWidgetBase>(NLWW_MATRIX)->pos_y) / this->resize.step_height; |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1631 |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
1632 if (id_v >= this->vscroll.GetCapacity()) break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1633 |
12878
8ad447b80c42
(svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents:
12789
diff
changeset
|
1634 id_v += this->vscroll.GetPosition(); |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
1635 this->company = (id_v >= this->server->info.companies_on) ? INVALID_COMPANY : NetworkLobbyFindCompanyIndex(id_v); |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1636 this->SetDirty(); |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
1637 |
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
1638 /* FIXME the disabling should go into some InvalidateData, which is called instead of the SetDirty */ |
14410
9a9236bf1a28
(svn r18967) -Fix (r18966): Never trust your copy&paste skills.
frosch <frosch@openttd.org>
parents:
14409
diff
changeset
|
1639 if (click_count > 1 && !this->IsWidgetDisabled(NLWW_JOIN)) this->OnClick(pt, NLWW_JOIN, 1); |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1640 } break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1641 |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1642 case NLWW_JOIN: // Join company |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1643 /* Button can be clicked only when it is enabled */ |
11956
6ec97548e188
(svn r16360) -Codechange: don't use _network_playas as a 'second' _local_company, but only as a storage location for the company you want to join in MP.
rubidium <rubidium@openttd.org>
parents:
11924
diff
changeset
|
1644 NetworkClientConnectGame(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port), this->company); |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1645 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1646 |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1647 case NLWW_NEW: // New company |
11956
6ec97548e188
(svn r16360) -Codechange: don't use _network_playas as a 'second' _local_company, but only as a storage location for the company you want to join in MP.
rubidium <rubidium@openttd.org>
parents:
11924
diff
changeset
|
1648 NetworkClientConnectGame(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port), COMPANY_NEW_COMPANY); |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1649 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1650 |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1651 case NLWW_SPECTATE: // Spectate game |
11956
6ec97548e188
(svn r16360) -Codechange: don't use _network_playas as a 'second' _local_company, but only as a storage location for the company you want to join in MP.
rubidium <rubidium@openttd.org>
parents:
11924
diff
changeset
|
1652 NetworkClientConnectGame(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port), COMPANY_SPECTATOR); |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1653 break; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1654 |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1655 case NLWW_REFRESH: // Refresh |
10822
db2fdef51d46
(svn r15157) -Codechange: wrap the hostname/ip and port into a single structure so we can pass either one of them and not convert an ip to a string and then back again.
rubidium <rubidium@openttd.org>
parents:
10793
diff
changeset
|
1656 NetworkTCPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // company info |
db2fdef51d46
(svn r15157) -Codechange: wrap the hostname/ip and port into a single structure so we can pass either one of them and not convert an ip to a string and then back again.
rubidium <rubidium@openttd.org>
parents:
10793
diff
changeset
|
1657 NetworkUDPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // general data |
10457
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1658 /* Clear the information so removed companies don't remain */ |
11218
2d1dbbac3a74
(svn r15571) -Fix: incorrect use of memset
smatz <smatz@openttd.org>
parents:
11085
diff
changeset
|
1659 memset(this->company_info, 0, sizeof(this->company_info)); |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1660 break; |
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1661 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1662 } |
10049
78cd320f0fc9
(svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents:
9898
diff
changeset
|
1663 |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1664 virtual void OnResize() |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1665 { |
14037
ca29deba0f1a
(svn r18580) -Codechange: Use widget information only for setting scrollbar capacity.
alberth <alberth@openttd.org>
parents:
14035
diff
changeset
|
1666 this->vscroll.SetCapacityFromWidget(this, NLWW_MATRIX); |
ca29deba0f1a
(svn r18580) -Codechange: Use widget information only for setting scrollbar capacity.
alberth <alberth@openttd.org>
parents:
14035
diff
changeset
|
1667 this->GetWidget<NWidgetCore>(NLWW_MATRIX)->widget_data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START); |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1668 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1669 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1670 |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1671 static const NWidgetPart _nested_network_lobby_window_widgets[] = { |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1672 NWidget(NWID_HORIZONTAL), |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
1673 NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE), |
14046
425d4e2d7cb7
(svn r18589) -Codechange: Add tooltip to some network windows, remove old comment.
alberth <alberth@openttd.org>
parents:
14037
diff
changeset
|
1674 NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE), SetDataTip(STR_NETWORK_GAME_LOBBY_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1675 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1676 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NLWW_BACKGROUND), |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1677 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NLWW_TEXT), SetDataTip(STR_NETWORK_GAME_LOBBY_PREPARE_TO_JOIN, STR_NULL), SetResize(1, 0), SetPadding(10, 10, 0, 10), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1678 NWidget(NWID_SPACER), SetMinimalSize(0, 3), |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1679 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 10), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1680 /* Company list. */ |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1681 NWidget(NWID_VERTICAL), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1682 NWidget(WWT_PANEL, COLOUR_WHITE, NLWW_HEADER), SetMinimalSize(146, 0), SetResize(1, 0), SetFill(1, 0), EndContainer(), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1683 NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NLWW_MATRIX), SetMinimalSize(146, 0), SetResize(1, 1), SetFill(1, 1), SetDataTip(0, STR_NETWORK_GAME_LOBBY_COMPANY_LIST_TOOLTIP), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1684 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1685 NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NLWW_SCROLLBAR), |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1686 NWidget(NWID_SPACER), SetMinimalSize(5, 0), SetResize(0, 1), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1687 /* Company info. */ |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1688 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NLWW_DETAILS), SetMinimalSize(232, 0), SetResize(1, 1), SetFill(1, 1), EndContainer(), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1689 EndContainer(), |
12408
a1c0de97cd50
(svn r16842) -Cleanup: add some spaces around a few operators
rubidium <rubidium@openttd.org>
parents:
11956
diff
changeset
|
1690 NWidget(NWID_SPACER), SetMinimalSize(0, 9), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1691 /* Buttons. */ |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1692 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), SetPIP(10, 3, 10), |
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1693 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 3, 0), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1694 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_JOIN), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_GAME_LOBBY_JOIN_COMPANY, STR_NETWORK_GAME_LOBBY_JOIN_COMPANY_TOOLTIP), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1695 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_NEW), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_GAME_LOBBY_NEW_COMPANY, STR_NETWORK_GAME_LOBBY_NEW_COMPANY_TOOLTIP), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1696 EndContainer(), |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1697 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 3, 0), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1698 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_SPECTATE), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_GAME_LOBBY_SPECTATE_GAME, STR_NETWORK_GAME_LOBBY_SPECTATE_GAME_TOOLTIP), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1699 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_REFRESH), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1700 EndContainer(), |
13376
9f1c0925059c
(svn r17885) -Codechange: make the network lobby window nested
rubidium <rubidium@openttd.org>
parents:
13375
diff
changeset
|
1701 NWidget(NWID_VERTICAL, NC_EQUALSIZE), SetPIP(0, 3, 0), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1702 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_CANCEL), SetResize(1, 0), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_NULL), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
1703 NWidget(NWID_SPACER), SetFill(1, 1), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1704 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1705 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1706 NWidget(NWID_SPACER), SetMinimalSize(0, 8), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1707 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1708 }; |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1709 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1710 static const WindowDesc _network_lobby_window_desc( |
13796
3e68f07eb821
(svn r18322) -Codechange: remove the WDP duplication; no need to tell the same twice.
rubidium <rubidium@openttd.org>
parents:
13752
diff
changeset
|
1711 WDP_CENTER, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5669
diff
changeset
|
1712 WC_NETWORK_WINDOW, WC_NONE, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13726
diff
changeset
|
1713 WDF_UNCLICK_BUTTONS, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13556
diff
changeset
|
1714 _nested_network_lobby_window_widgets, lengthof(_nested_network_lobby_window_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
1715 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1716 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1717 /* Show the networklobbywindow with the selected server |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1718 * @param ngl Selected game pointer which is passed to the new window */ |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1719 static void ShowNetworkLobbyWindow(NetworkGameList *ngl) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1720 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1721 DeleteWindowById(WC_NETWORK_WINDOW, 0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1722 |
10822
db2fdef51d46
(svn r15157) -Codechange: wrap the hostname/ip and port into a single structure so we can pass either one of them and not convert an ip to a string and then back again.
rubidium <rubidium@openttd.org>
parents:
10793
diff
changeset
|
1723 NetworkTCPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // company info |
db2fdef51d46
(svn r15157) -Codechange: wrap the hostname/ip and port into a single structure so we can pass either one of them and not convert an ip to a string and then back again.
rubidium <rubidium@openttd.org>
parents:
10793
diff
changeset
|
1724 NetworkUDPQueryServer(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port)); // general data |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1725 |
9177
94a08f9e1061
(svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents:
9165
diff
changeset
|
1726 new NetworkLobbyWindow(&_network_lobby_window_desc, ngl); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1727 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1728 |
10457
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1729 /** |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1730 * Get the company information of a given company to fill for the lobby. |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1731 * @param company the company to get the company info struct from. |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1732 * @return the company info struct to write the (downloaded) data to. |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1733 */ |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1734 NetworkCompanyInfo *GetLobbyCompanyInfo(CompanyID company) |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1735 { |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1736 NetworkLobbyWindow *lobby = dynamic_cast<NetworkLobbyWindow*>(FindWindowById(WC_NETWORK_WINDOW, 0)); |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1737 return (lobby != NULL && company < MAX_COMPANIES) ? &lobby->company_info[company] : NULL; |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1738 } |
7cfe07199455
(svn r14712) -Codechange: split server and client side w.r.t. the storage of network related company information.
rubidium <rubidium@openttd.org>
parents:
10454
diff
changeset
|
1739 |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1740 /* The window below gives information about the connected clients |
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1741 * and also makes able to give money to them, kick them (if server) |
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1742 * and stuff like that. */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1743 |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
1744 extern void DrawCompanyIcon(CompanyID cid, int x, int y); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1745 |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1746 /* Every action must be of this form */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1747 typedef void ClientList_Action_Proc(byte client_no); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1748 |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1749 static const NWidgetPart _nested_client_list_popup_widgets[] = { |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1750 NWidget(WWT_PANEL, COLOUR_GREY, 0), EndContainer(), |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1751 }; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1752 |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1753 static const WindowDesc _client_list_popup_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
1754 WDP_AUTO, 0, 0, |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1755 WC_TOOLBAR_MENU, WC_CLIENT_LIST, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13726
diff
changeset
|
1756 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13556
diff
changeset
|
1757 _nested_client_list_popup_widgets, lengthof(_nested_client_list_popup_widgets) |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1758 ); |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
1759 |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1760 /* Finds the Xth client-info that is active */ |
11578
494219bd4418
(svn r15947) -Codechange: replace uint32 client_ip with NetworkAddress client_address.
rubidium <rubidium@openttd.org>
parents:
11565
diff
changeset
|
1761 static NetworkClientInfo *NetworkFindClientInfo(byte client_no) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1762 { |
11578
494219bd4418
(svn r15947) -Codechange: replace uint32 client_ip with NetworkAddress client_address.
rubidium <rubidium@openttd.org>
parents:
11565
diff
changeset
|
1763 NetworkClientInfo *ci; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1764 |
10464
34c23056ba1d
(svn r14719) -Codechange: replace DEREF_CLIENT with an instance function and replace looping socket structs with info structs when the loop is only interested in the info structs (i.e. not derefing the info from sockets when one can loop info directly and the socket isn't used)
rubidium <rubidium@openttd.org>
parents:
10457
diff
changeset
|
1765 FOR_ALL_CLIENT_INFOS(ci) { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1766 if (client_no == 0) return ci; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1767 client_no--; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1768 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1769 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1770 return NULL; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1771 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1772 |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
1773 /* Here we start to define the options out of the menu */ |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1774 static void ClientList_Kick(byte client_no) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1775 { |
11279
2f792e7a69dd
(svn r15628) -Fix [FS#2705]: kicking/banning a client from the Client list window crashed the server
smatz <smatz@openttd.org>
parents:
11256
diff
changeset
|
1776 const NetworkClientInfo *ci = NetworkFindClientInfo(client_no); |
2f792e7a69dd
(svn r15628) -Fix [FS#2705]: kicking/banning a client from the Client list window crashed the server
smatz <smatz@openttd.org>
parents:
11256
diff
changeset
|
1777 |
2f792e7a69dd
(svn r15628) -Fix [FS#2705]: kicking/banning a client from the Client list window crashed the server
smatz <smatz@openttd.org>
parents:
11256
diff
changeset
|
1778 if (ci == NULL) return; |
2f792e7a69dd
(svn r15628) -Fix [FS#2705]: kicking/banning a client from the Client list window crashed the server
smatz <smatz@openttd.org>
parents:
11256
diff
changeset
|
1779 |
2f792e7a69dd
(svn r15628) -Fix [FS#2705]: kicking/banning a client from the Client list window crashed the server
smatz <smatz@openttd.org>
parents:
11256
diff
changeset
|
1780 NetworkServerKickClient(ci->client_id); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1781 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1782 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1783 static void ClientList_Ban(byte client_no) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1784 { |
11578
494219bd4418
(svn r15947) -Codechange: replace uint32 client_ip with NetworkAddress client_address.
rubidium <rubidium@openttd.org>
parents:
11565
diff
changeset
|
1785 NetworkClientInfo *ci = NetworkFindClientInfo(client_no); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1786 |
11279
2f792e7a69dd
(svn r15628) -Fix [FS#2705]: kicking/banning a client from the Client list window crashed the server
smatz <smatz@openttd.org>
parents:
11256
diff
changeset
|
1787 if (ci == NULL) return; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1788 |
11279
2f792e7a69dd
(svn r15628) -Fix [FS#2705]: kicking/banning a client from the Client list window crashed the server
smatz <smatz@openttd.org>
parents:
11256
diff
changeset
|
1789 NetworkServerBanIP(GetClientIP(ci)); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1790 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1791 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1792 static void ClientList_GiveMoney(byte client_no) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1793 { |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1794 if (NetworkFindClientInfo(client_no) != NULL) { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1795 ShowNetworkGiveMoneyWindow(NetworkFindClientInfo(client_no)->client_playas); |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1796 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1797 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1798 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1799 static void ClientList_SpeakToClient(byte client_no) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1800 { |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1801 if (NetworkFindClientInfo(client_no) != NULL) { |
10454
789e66340e43
(svn r14709) -Codechange: make a clearer distinction between 'unique' client identification ids and the indices into the clients/client info arrays.
rubidium <rubidium@openttd.org>
parents:
10337
diff
changeset
|
1802 ShowNetworkChatQueryWindow(DESTTYPE_CLIENT, NetworkFindClientInfo(client_no)->client_id); |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1803 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1804 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1805 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1806 static void ClientList_SpeakToCompany(byte client_no) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1807 { |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1808 if (NetworkFindClientInfo(client_no) != NULL) { |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1809 ShowNetworkChatQueryWindow(DESTTYPE_TEAM, NetworkFindClientInfo(client_no)->client_playas); |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1810 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1811 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1812 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1813 static void ClientList_SpeakToAll(byte client_no) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1814 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1815 ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1816 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1817 |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1818 /** Popup selection window to chose an action to perform */ |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1819 struct NetworkClientListPopupWindow : Window { |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1820 /** Container for actions that can be executed. */ |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1821 struct ClientListAction { |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1822 StringID name; ///< Name of the action to execute |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1823 ClientList_Action_Proc *proc; ///< Action to execute |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1824 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1825 |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1826 uint sel_index; |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1827 int client_no; |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1828 Point desired_location; |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1829 SmallVector<ClientListAction, 2> actions; ///< Actions to execute |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1830 |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1831 /** |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1832 * Add an action to the list of actions to execute. |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1833 * @param name the name of the action |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1834 * @param proc the procedure to execute for the action |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1835 */ |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1836 inline void AddAction(StringID name, ClientList_Action_Proc *proc) |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1837 { |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1838 ClientListAction *action = this->actions.Append(); |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1839 action->name = name; |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1840 action->proc = proc; |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1841 } |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1842 |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1843 NetworkClientListPopupWindow(const WindowDesc *desc, int x, int y, int client_no) : |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1844 Window(), |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1845 sel_index(0), client_no(client_no) |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1846 { |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1847 this->desired_location.x = x; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1848 this->desired_location.y = y; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1849 |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1850 const NetworkClientInfo *ci = NetworkFindClientInfo(client_no); |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1851 |
10454
789e66340e43
(svn r14709) -Codechange: make a clearer distinction between 'unique' client identification ids and the indices into the clients/client info arrays.
rubidium <rubidium@openttd.org>
parents:
10337
diff
changeset
|
1852 if (_network_own_client_id != ci->client_id) { |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1853 this->AddAction(STR_NETWORK_CLIENTLIST_SPEAK_TO_CLIENT, &ClientList_SpeakToClient); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1854 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1855 |
11924
fccc9cea27a7
(svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents:
11888
diff
changeset
|
1856 if (Company::IsValidID(ci->client_playas) || ci->client_playas == COMPANY_SPECTATOR) { |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1857 this->AddAction(STR_NETWORK_CLIENTLIST_SPEAK_TO_COMPANY, &ClientList_SpeakToCompany); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1858 } |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1859 this->AddAction(STR_NETWORK_CLIENTLIST_SPEAK_TO_ALL, &ClientList_SpeakToAll); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1860 |
10454
789e66340e43
(svn r14709) -Codechange: make a clearer distinction between 'unique' client identification ids and the indices into the clients/client info arrays.
rubidium <rubidium@openttd.org>
parents:
10337
diff
changeset
|
1861 if (_network_own_client_id != ci->client_id) { |
10207
c54d140df948
(svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium <rubidium@openttd.org>
parents:
10180
diff
changeset
|
1862 /* We are no spectator and the company we want to give money to is no spectator and money gifts are allowed */ |
11956
6ec97548e188
(svn r16360) -Codechange: don't use _network_playas as a 'second' _local_company, but only as a storage location for the company you want to join in MP.
rubidium <rubidium@openttd.org>
parents:
11924
diff
changeset
|
1863 if (Company::IsValidID(_local_company) && Company::IsValidID(ci->client_playas) && _settings_game.economy.give_money) { |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1864 this->AddAction(STR_NETWORK_CLIENTLIST_GIVE_MONEY, &ClientList_GiveMoney); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1865 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1866 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1867 |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1868 /* A server can kick clients (but not himself) */ |
10454
789e66340e43
(svn r14709) -Codechange: make a clearer distinction between 'unique' client identification ids and the indices into the clients/client info arrays.
rubidium <rubidium@openttd.org>
parents:
10337
diff
changeset
|
1869 if (_network_server && _network_own_client_id != ci->client_id) { |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1870 this->AddAction(STR_NETWORK_CLIENTLIST_KICK, &ClientList_Kick); |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1871 this->AddAction(STR_NETWORK_CLIENTLIST_BAN, &ClientList_Ban); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1872 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1873 |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1874 this->flags4 &= ~WF_WHITE_BORDER_MASK; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1875 this->InitNested(desc, 0); |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1876 } |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1877 |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1878 virtual Point OnInitialPosition(const WindowDesc *desc, int16 sm_width, int16 sm_height, int window_number) |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1879 { |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1880 return this->desired_location; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1881 } |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1882 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
1883 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1884 { |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1885 Dimension d = *size; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1886 for (const ClientListAction *action = this->actions.Begin(); action != this->actions.End(); action++) { |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1887 d = maxdim(GetStringBoundingBox(action->name), d); |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1888 } |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1889 |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1890 d.height *= this->actions.Length(); |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1891 d.width += WD_FRAMERECT_LEFT + WD_FRAMERECT_RIGHT; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1892 d.height += WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1893 *size = d; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1894 } |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1895 |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1896 virtual void DrawWidget(const Rect &r, int widget) const |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1897 { |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1898 /* Draw the actions */ |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1899 int sel = this->sel_index; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1900 int y = r.top + WD_FRAMERECT_TOP; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1901 for (const ClientListAction *action = this->actions.Begin(); action != this->actions.End(); action++, y += FONT_HEIGHT_NORMAL) { |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1902 TextColour colour; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1903 if (sel-- == 0) { // Selected item, highlight it |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1904 GfxFillRect(r.left + 1, y, r.right - 1, y + FONT_HEIGHT_NORMAL - 1, 0); |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1905 colour = TC_WHITE; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1906 } else { |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1907 colour = TC_BLACK; |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1908 } |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1909 |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1910 DrawString(r.left + WD_FRAMERECT_LEFT, r.right - WD_FRAMERECT_RIGHT, y, action->name, colour); |
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1911 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1912 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1913 |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1914 virtual void OnPaint() |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1915 { |
9273
72a6d2e60834
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents:
9269
diff
changeset
|
1916 this->DrawWidgets(); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1917 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1918 |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1919 virtual void OnMouseLoop() |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1920 { |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1921 /* We selected an action */ |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1922 uint index = (_cursor.pos.y - this->top - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL; |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1923 |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1924 if (_left_button_down) { |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1925 if (index == this->sel_index || index >= this->actions.Length()) return; |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1926 |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1927 this->sel_index = index; |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1928 this->SetDirty(); |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1929 } else { |
13442
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1930 if (index < this->actions.Length() && _cursor.pos.y >= this->top) { |
53a39cddf2be
(svn r17951) -Codechange: simplify making the popup list, remove arbirary limitations and unused code/strings.
rubidium <rubidium@openttd.org>
parents:
13439
diff
changeset
|
1931 this->actions[index].proc(this->client_no); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1932 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1933 |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1934 DeleteWindowById(WC_TOOLBAR_MENU, 0); |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1935 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1936 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1937 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1938 |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1939 /** |
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1940 * Show the popup (action list) |
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1941 */ |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1942 static void PopupClientList(int client_no, int x, int y) |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1943 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1944 DeleteWindowById(WC_TOOLBAR_MENU, 0); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1945 |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1946 if (NetworkFindClientInfo(client_no) == NULL) return; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1947 |
13443
6bfe74de8027
(svn r17952) -Codechange: make the network client list popup nested
rubidium <rubidium@openttd.org>
parents:
13442
diff
changeset
|
1948 new NetworkClientListPopupWindow(&_client_list_popup_desc, x, y, client_no); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1949 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1950 |
13437
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1951 |
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1952 /** Widget numbers of the client list window. */ |
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1953 enum ClientListWidgets { |
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1954 CLW_PANEL, |
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1955 }; |
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1956 |
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1957 static const NWidgetPart _nested_client_list_widgets[] = { |
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1958 NWidget(NWID_HORIZONTAL), |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
1959 NWidget(WWT_CLOSEBOX, COLOUR_GREY), |
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
1960 NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NETWORK_COMPANY_LIST_CLIENT_LIST, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
1961 NWidget(WWT_STICKYBOX, COLOUR_GREY), |
13437
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1962 EndContainer(), |
13439
0e90ffa69389
(svn r17948) -Codechange: remove some magic numbers from the network client list GUIs / use ResizeWindow instead of custom resize code.
rubidium <rubidium@openttd.org>
parents:
13437
diff
changeset
|
1963 NWidget(WWT_PANEL, COLOUR_GREY, CLW_PANEL), SetMinimalSize(250, WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM), SetResize(1, 1), EndContainer(), |
13437
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1964 }; |
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1965 |
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1966 static const WindowDesc _client_list_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
1967 WDP_AUTO, 0, 0, |
13437
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1968 WC_CLIENT_LIST, WC_NONE, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13726
diff
changeset
|
1969 0, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13556
diff
changeset
|
1970 _nested_client_list_widgets, lengthof(_nested_client_list_widgets) |
13437
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1971 ); |
1ab8e5dfef6c
(svn r17946) -Codechange: move the widget definition of the client list closer to the window
rubidium <rubidium@openttd.org>
parents:
13396
diff
changeset
|
1972 |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1973 /** |
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1974 * Main handle for clientlist |
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1975 */ |
13439
0e90ffa69389
(svn r17948) -Codechange: remove some magic numbers from the network client list GUIs / use ResizeWindow instead of custom resize code.
rubidium <rubidium@openttd.org>
parents:
13437
diff
changeset
|
1976 struct NetworkClientListWindow : Window { |
10473
38aa7533364f
(svn r14728) -Fix [FS#2470]: don't select anything when opening the client list.
rubidium <rubidium@openttd.org>
parents:
10467
diff
changeset
|
1977 int selected_item; |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
1978 |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
1979 uint server_client_width; |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
1980 uint company_icon_width; |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
1981 |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1982 NetworkClientListWindow(const WindowDesc *desc, WindowNumber window_number) : |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
1983 Window(), |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
1984 selected_item(-1) |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1985 { |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
1986 this->InitNested(desc, window_number); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1987 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1988 |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1989 /** |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1990 * Finds the amount of clients and set the height correct |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1991 */ |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1992 bool CheckClientListHeight() |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1993 { |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1994 int num = 0; |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1995 const NetworkClientInfo *ci; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
1996 |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
1997 /* Should be replaced with a loop through all clients */ |
10464
34c23056ba1d
(svn r14719) -Codechange: replace DEREF_CLIENT with an instance function and replace looping socket structs with info structs when the loop is only interested in the info structs (i.e. not derefing the info from sockets when one can loop info directly and the socket isn't used)
rubidium <rubidium@openttd.org>
parents:
10457
diff
changeset
|
1998 FOR_ALL_CLIENT_INFOS(ci) { |
10473
38aa7533364f
(svn r14728) -Fix [FS#2470]: don't select anything when opening the client list.
rubidium <rubidium@openttd.org>
parents:
10467
diff
changeset
|
1999 if (ci->client_playas != COMPANY_INACTIVE_CLIENT) num++; |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2000 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2001 |
13439
0e90ffa69389
(svn r17948) -Codechange: remove some magic numbers from the network client list GUIs / use ResizeWindow instead of custom resize code.
rubidium <rubidium@openttd.org>
parents:
13437
diff
changeset
|
2002 num *= FONT_HEIGHT_NORMAL; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2003 |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2004 int diff = (num + WD_FRAMERECT_TOP + WD_FRAMERECT_BOTTOM) - (this->GetWidget<NWidgetBase>(CLW_PANEL)->current_y); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2005 /* If height is changed */ |
13439
0e90ffa69389
(svn r17948) -Codechange: remove some magic numbers from the network client list GUIs / use ResizeWindow instead of custom resize code.
rubidium <rubidium@openttd.org>
parents:
13437
diff
changeset
|
2006 if (diff != 0) { |
0e90ffa69389
(svn r17948) -Codechange: remove some magic numbers from the network client list GUIs / use ResizeWindow instead of custom resize code.
rubidium <rubidium@openttd.org>
parents:
13437
diff
changeset
|
2007 ResizeWindow(this, 0, diff); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2008 return false; |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2009 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2010 return true; |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2011 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
2012 |
13705
8dee47e001b2
(svn r18230) -Codechange: Allow fill stepsize to be set from Window::UpdateWidgetSize().
alberth <alberth@openttd.org>
parents:
13704
diff
changeset
|
2013 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2014 { |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2015 if (widget != CLW_PANEL) return; |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2016 |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2017 this->server_client_width = max(GetStringBoundingBox(STR_NETWORK_SERVER).width, GetStringBoundingBox(STR_NETWORK_CLIENT).width) + WD_FRAMERECT_RIGHT; |
13446
37fb6e7b7eb9
(svn r17955) -Codechange: s/SPR_PLAYER_ICON/SPR_COMPANY_ICON/
rubidium <rubidium@openttd.org>
parents:
13445
diff
changeset
|
2018 this->company_icon_width = GetSpriteSize(SPR_COMPANY_ICON).width + WD_FRAMERECT_LEFT; |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2019 |
13879
1501e8e0b705
(svn r18408) -Fix (r17954): After computing the needed width for the client list, also use it.
frosch <frosch@openttd.org>
parents:
13804
diff
changeset
|
2020 uint width = 100; // Default width |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2021 const NetworkClientInfo *ci; |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2022 FOR_ALL_CLIENT_INFOS(ci) { |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2023 width = max(width, GetStringBoundingBox(ci->client_name).width); |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2024 } |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2025 |
13879
1501e8e0b705
(svn r18408) -Fix (r17954): After computing the needed width for the client list, also use it.
frosch <frosch@openttd.org>
parents:
13804
diff
changeset
|
2026 size->width = WD_FRAMERECT_LEFT + this->server_client_width + this->company_icon_width + width + WD_FRAMERECT_RIGHT; |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2027 } |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2028 |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2029 virtual void OnPaint() |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2030 { |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2031 /* Check if we need to reset the height */ |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2032 if (!this->CheckClientListHeight()) return; |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2033 |
9273
72a6d2e60834
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents:
9269
diff
changeset
|
2034 this->DrawWidgets(); |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2035 } |
8738
723631ab4868
(svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents:
8737
diff
changeset
|
2036 |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2037 virtual void DrawWidget(const Rect &r, int widget) const |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2038 { |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2039 if (widget != CLW_PANEL) return; |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2040 |
13651
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2041 bool rtl = _dynlang.text_dir == TD_RTL; |
13724
6530ffe79d47
(svn r18249) -Codechange: make the network client list big font aware
rubidium <rubidium@openttd.org>
parents:
13705
diff
changeset
|
2042 int icon_y_offset = 1 + (FONT_HEIGHT_NORMAL - 10) / 2; |
13651
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2043 uint y = r.top + WD_FRAMERECT_TOP; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2044 uint left = r.left + WD_FRAMERECT_LEFT; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2045 uint right = r.right - WD_FRAMERECT_RIGHT; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2046 uint type_icon_width = this->server_client_width + this->company_icon_width; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2047 |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2048 |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2049 uint type_left = rtl ? right - this->server_client_width : left; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2050 uint type_right = rtl ? right : left + this->server_client_width - 1; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2051 uint icon_left = rtl ? right - type_icon_width + WD_FRAMERECT_LEFT : left + this->server_client_width; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2052 uint name_left = rtl ? left : left + type_icon_width; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2053 uint name_right = rtl ? right - type_icon_width : right; |
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2054 |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2055 int i = 0; |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2056 const NetworkClientInfo *ci; |
10464
34c23056ba1d
(svn r14719) -Codechange: replace DEREF_CLIENT with an instance function and replace looping socket structs with info structs when the loop is only interested in the info structs (i.e. not derefing the info from sockets when one can loop info directly and the socket isn't used)
rubidium <rubidium@openttd.org>
parents:
10457
diff
changeset
|
2057 FOR_ALL_CLIENT_INFOS(ci) { |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2058 TextColour colour; |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2059 if (this->selected_item == i++) { // Selected item, highlight it |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2060 GfxFillRect(r.left + 1, y, r.right - 1, y + FONT_HEIGHT_NORMAL - 1, 0); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2061 colour = TC_WHITE; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2062 } else { |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2063 colour = TC_BLACK; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2064 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2065 |
10454
789e66340e43
(svn r14709) -Codechange: make a clearer distinction between 'unique' client identification ids and the indices into the clients/client info arrays.
rubidium <rubidium@openttd.org>
parents:
10337
diff
changeset
|
2066 if (ci->client_id == CLIENT_ID_SERVER) { |
13651
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2067 DrawString(type_left, type_right, y, STR_NETWORK_SERVER, colour); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2068 } else { |
13651
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2069 DrawString(type_left, type_right, y, STR_NETWORK_CLIENT, colour); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2070 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2071 |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2072 /* Filter out spectators */ |
13724
6530ffe79d47
(svn r18249) -Codechange: make the network client list big font aware
rubidium <rubidium@openttd.org>
parents:
13705
diff
changeset
|
2073 if (Company::IsValidID(ci->client_playas)) DrawCompanyIcon(ci->client_playas, icon_left, y + icon_y_offset); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2074 |
13651
5a604d7988c1
(svn r18175) -Codechange: make the network lobby and client list RTL aware
rubidium <rubidium@openttd.org>
parents:
13628
diff
changeset
|
2075 DrawString(name_left, name_right, y, ci->client_name, colour); |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2076 |
13439
0e90ffa69389
(svn r17948) -Codechange: remove some magic numbers from the network client list GUIs / use ResizeWindow instead of custom resize code.
rubidium <rubidium@openttd.org>
parents:
13437
diff
changeset
|
2077 y += FONT_HEIGHT_NORMAL; |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2078 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2079 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2080 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
2081 virtual void OnClick(Point pt, int widget, int click_count) |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2082 { |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2083 /* Show the popup with option */ |
10473
38aa7533364f
(svn r14728) -Fix [FS#2470]: don't select anything when opening the client list.
rubidium <rubidium@openttd.org>
parents:
10467
diff
changeset
|
2084 if (this->selected_item != -1) { |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2085 PopupClientList(this->selected_item, pt.x + this->left, pt.y + this->top); |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2086 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2087 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2088 |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2089 virtual void OnMouseOver(Point pt, int widget) |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2090 { |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2091 /* -1 means we left the current window */ |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2092 if (pt.y == -1) { |
10473
38aa7533364f
(svn r14728) -Fix [FS#2470]: don't select anything when opening the client list.
rubidium <rubidium@openttd.org>
parents:
10467
diff
changeset
|
2093 this->selected_item = -1; |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2094 this->SetDirty(); |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2095 return; |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2096 } |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2097 |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2098 /* Find the new selected item (if any) */ |
13445
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2099 pt.y -= this->GetWidget<NWidgetBase>(CLW_PANEL)->pos_y; |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2100 int item = -1; |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2101 if (IsInsideMM(pt.y, WD_FRAMERECT_TOP, this->GetWidget<NWidgetBase>(CLW_PANEL)->current_y - WD_FRAMERECT_BOTTOM)) { |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2102 item = (pt.y - WD_FRAMERECT_TOP) / FONT_HEIGHT_NORMAL; |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2103 } |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2104 |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2105 /* It did not change.. no update! */ |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2106 if (item == this->selected_item) return; |
c38047a5bdfb
(svn r17954) -Codechange: make the network client list nested
rubidium <rubidium@openttd.org>
parents:
13443
diff
changeset
|
2107 this->selected_item = item; |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2108 |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2109 /* Repaint */ |
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2110 this->SetDirty(); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2111 } |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2112 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2113 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
5916
diff
changeset
|
2114 void ShowClientList() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2115 { |
9242
b400b0761465
(svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents:
9241
diff
changeset
|
2116 AllocateWindowDescFront<NetworkClientListWindow>(&_client_list_desc, 0); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2117 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2118 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2119 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2120 static NetworkPasswordType pw_type; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2121 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2122 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2123 void ShowNetworkNeedPassword(NetworkPasswordType npt) |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2124 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2125 StringID caption; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2126 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2127 pw_type = npt; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2128 switch (npt) { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2129 default: NOT_REACHED(); |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2130 case NETWORK_GAME_PASSWORD: caption = STR_NETWORK_NEED_GAME_PASSWORD_CAPTION; break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2131 case NETWORK_COMPANY_PASSWORD: caption = STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION; break; |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2132 } |
10145
dbe302da93a8
(svn r14331) -Codechange: use an enum as additional parameter for ShowQueryString()
smatz <smatz@openttd.org>
parents:
10061
diff
changeset
|
2133 ShowQueryString(STR_EMPTY, caption, 20, 180, FindWindowById(WC_NETWORK_STATUS_WINDOW, 0), CS_ALPHANUMERAL, QSF_NONE); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2134 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2135 |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
2136 /* Vars needed for the join-GUI */ |
9428
ba7cdcf21f4c
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium <rubidium@openttd.org>
parents:
9420
diff
changeset
|
2137 NetworkJoinStatus _network_join_status; |
ba7cdcf21f4c
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium <rubidium@openttd.org>
parents:
9420
diff
changeset
|
2138 uint8 _network_join_waiting; |
10771
44e71a85349d
(svn r15104) -Codechange: unify the resolving of the xyz kbytes/megabytes strings.
rubidium <rubidium@openttd.org>
parents:
10696
diff
changeset
|
2139 uint32 _network_join_bytes; |
44e71a85349d
(svn r15104) -Codechange: unify the resolving of the xyz kbytes/megabytes strings.
rubidium <rubidium@openttd.org>
parents:
10696
diff
changeset
|
2140 uint32 _network_join_bytes_total; |
9428
ba7cdcf21f4c
(svn r13343) -Codechange: reorder/move variable/functions in the network headers so that nothing from the network directory needs to include basically all network headers.
rubidium <rubidium@openttd.org>
parents:
9420
diff
changeset
|
2141 |
11430
c1e93c7799b6
(svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents:
11427
diff
changeset
|
2142 /** Widgets used for the join status window. */ |
c1e93c7799b6
(svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents:
11427
diff
changeset
|
2143 enum NetworkJoinStatusWidgets { |
c1e93c7799b6
(svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents:
11427
diff
changeset
|
2144 NJSW_BACKGROUND, ///< Background |
c1e93c7799b6
(svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents:
11427
diff
changeset
|
2145 NJSW_CANCELOK, ///< Cancel/OK button |
c1e93c7799b6
(svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents:
11427
diff
changeset
|
2146 }; |
c1e93c7799b6
(svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents:
11427
diff
changeset
|
2147 |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2148 struct NetworkJoinStatusWindow : Window { |
13449
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2149 NetworkJoinStatusWindow(const WindowDesc *desc) : Window() |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2150 { |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2151 this->parent = FindWindowById(WC_NETWORK_WINDOW, 0); |
13449
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2152 this->InitNested(desc, 0); |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2153 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2154 |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2155 virtual void OnPaint() |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2156 { |
13449
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2157 this->DrawWidgets(); |
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2158 } |
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2159 |
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2160 virtual void DrawWidget(const Rect &r, int widget) const |
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2161 { |
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2162 if (widget != NJSW_BACKGROUND) return; |
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2163 |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2164 uint8 progress; // used for progress bar |
13449
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2165 DrawString(r.left + 2, r.right - 2, r.top + 20, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_FROMSTRING, SA_CENTER); |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2166 switch (_network_join_status) { |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2167 case NETWORK_JOIN_STATUS_CONNECTING: case NETWORK_JOIN_STATUS_AUTHORIZING: |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2168 case NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO: |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2169 progress = 10; // first two stages 10% |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2170 break; |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2171 case NETWORK_JOIN_STATUS_WAITING: |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2172 SetDParam(0, _network_join_waiting); |
13449
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2173 DrawString(r.left + 2, r.right - 2, r.top + 20 + FONT_HEIGHT_NORMAL, STR_NETWORK_CONNECTING_WAITING, TC_FROMSTRING, SA_CENTER); |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2174 progress = 15; // third stage is 15% |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2175 break; |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2176 case NETWORK_JOIN_STATUS_DOWNLOADING: |
10771
44e71a85349d
(svn r15104) -Codechange: unify the resolving of the xyz kbytes/megabytes strings.
rubidium <rubidium@openttd.org>
parents:
10696
diff
changeset
|
2177 SetDParam(0, _network_join_bytes); |
44e71a85349d
(svn r15104) -Codechange: unify the resolving of the xyz kbytes/megabytes strings.
rubidium <rubidium@openttd.org>
parents:
10696
diff
changeset
|
2178 SetDParam(1, _network_join_bytes_total); |
13449
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2179 DrawString(r.left + 2, r.right - 2, r.top + 20 + FONT_HEIGHT_NORMAL, STR_NETWORK_CONNECTING_DOWNLOADING, TC_FROMSTRING, SA_CENTER); |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2180 /* Fallthrough */ |
11368
82c90cd591ab
(svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents:
11361
diff
changeset
|
2181 default: // Waiting is 15%, so the resting receivement of map is maximum 70% |
10771
44e71a85349d
(svn r15104) -Codechange: unify the resolving of the xyz kbytes/megabytes strings.
rubidium <rubidium@openttd.org>
parents:
10696
diff
changeset
|
2182 progress = 15 + _network_join_bytes * (100 - 15) / _network_join_bytes_total; |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2183 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2184 |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2185 /* Draw nice progress bar :) */ |
13449
a59eb51c3f11
(svn r17958) -Codechange: make the join progress window nested
rubidium <rubidium@openttd.org>
parents:
13446
diff
changeset
|
2186 DrawFrameRect(r.left + 20, r.top + 5, (int)((this->width - 20) * progress / 100), r.top + 15, COLOUR_MAUVE, FR_NONE); |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2187 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2188 |
13726
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2189 virtual void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2190 { |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2191 if (widget != NJSW_BACKGROUND) return; |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2192 |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2193 size->height = 25 + 2 * FONT_HEIGHT_NORMAL; |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2194 |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2195 /* Account for the statuses */ |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2196 uint width = 0; |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2197 for (uint i = 0; i < NETWORK_JOIN_STATUS_END; i++) { |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2198 width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_1 + i).width); |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2199 } |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2200 |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2201 /* For the number of waiting (other) players */ |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2202 SetDParam(0, 255); |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2203 width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_WAITING).width); |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2204 |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2205 /* Account for downloading ~ 10 MiB */ |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2206 SetDParam(0, 10000000); |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2207 SetDParam(1, 10000000); |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2208 width = max(width, GetStringBoundingBox(STR_NETWORK_CONNECTING_DOWNLOADING).width); |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2209 |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2210 /* Give a bit more clearing for the widest strings than strictly needed */ |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2211 size->width = width + WD_FRAMERECT_LEFT + WD_FRAMERECT_BOTTOM + 10; |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2212 } |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2213 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
2214 virtual void OnClick(Point pt, int widget, int click_count) |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2215 { |
11430
c1e93c7799b6
(svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents:
11427
diff
changeset
|
2216 if (widget == NJSW_CANCELOK) { // Disconnect button |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2217 NetworkDisconnect(); |
11223
4928ebb36453
(svn r15576) -Codechange: rename SwitchModes to SwitchMode and don't hardcode the values for that enum.
yexo <yexo@openttd.org>
parents:
11218
diff
changeset
|
2218 SwitchToMode(SM_MENU); |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2219 ShowNetworkGameWindow(); |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2220 } |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2221 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2222 |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2223 virtual void OnQueryTextFinished(char *str) |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2224 { |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2225 if (StrEmpty(str)) { |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2226 NetworkDisconnect(); |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2227 ShowNetworkGameWindow(); |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2228 } else { |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2229 SEND_COMMAND(PACKET_CLIENT_PASSWORD)(pw_type, str); |
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2230 } |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2231 } |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2232 }; |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2233 |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2234 static const NWidgetPart _nested_network_join_status_window_widgets[] = { |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
2235 NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_NETWORK_CONNECTING_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
2236 NWidget(WWT_PANEL, COLOUR_GREY), |
13726
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2237 NWidget(WWT_EMPTY, COLOUR_GREY, NJSW_BACKGROUND), |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2238 NWidget(NWID_HORIZONTAL), |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2239 NWidget(NWID_SPACER), SetMinimalSize(75, 0), SetFill(1, 0), |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2240 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NJSW_CANCELOK), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_CONNECTION_DISCONNECT, STR_NULL), |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2241 NWidget(NWID_SPACER), SetMinimalSize(75, 0), SetFill(1, 0), |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2242 EndContainer(), |
1ec9b9de9e12
(svn r18251) -Codechange: make the join status window big font aware
rubidium <rubidium@openttd.org>
parents:
13724
diff
changeset
|
2243 NWidget(NWID_SPACER), SetMinimalSize(0, 4), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2244 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2245 }; |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2246 |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
2247 static const WindowDesc _network_join_status_window_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
2248 WDP_CENTER, 0, 0, |
5893
8547517ef719
(svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents:
5669
diff
changeset
|
2249 WC_NETWORK_STATUS_WINDOW, WC_NONE, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13726
diff
changeset
|
2250 WDF_MODAL, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13556
diff
changeset
|
2251 _nested_network_join_status_window_widgets, lengthof(_nested_network_join_status_window_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
2252 ); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2253 |
6247
57363e064324
(svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents:
5916
diff
changeset
|
2254 void ShowJoinStatusWindow() |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2255 { |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2256 DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0); |
9269
9ba3a5bccb10
(svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents:
9242
diff
changeset
|
2257 new NetworkJoinStatusWindow(&_network_join_status_window_desc); |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2258 } |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2259 |
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2260 |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2261 /** Enum for NetworkGameWindow, referring to _network_game_window_widgets */ |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2262 enum NetworkCompanyPasswordWindowWidgets { |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2263 NCPWW_BACKGROUND, ///< The background of the interface |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2264 NCPWW_LABEL, ///< Label in front of the password field |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2265 NCPWW_PASSWORD, ///< Input field for the password |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2266 NCPWW_SAVE_AS_DEFAULT_PASSWORD, ///< Toggle 'button' for saving the current password as default password |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2267 NCPWW_CANCEL, ///< Close the window without changing anything |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2268 NCPWW_OK, ///< Safe the password etc. |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2269 }; |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2270 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2271 struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow { |
13367
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2272 NetworkCompanyPasswordWindow(const WindowDesc *desc, Window *parent) : QueryStringBaseWindow(lengthof(_settings_client.network.default_company_pass)) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2273 { |
13367
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2274 this->InitNested(desc, 0); |
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2275 |
9241
8299dc138e1c
(svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx <glx@openttd.org>
parents:
9182
diff
changeset
|
2276 this->parent = parent; |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2277 this->afilter = CS_ALPHANUMERAL; |
9897
5b558ce6cb0e
(svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents:
9827
diff
changeset
|
2278 InitializeTextBuffer(&this->text, this->edit_str_buf, this->edit_str_size, 0); |
11081
0a26df8849a2
(svn r15424) -Codechange: make it possible to have multiple windows with edit box open simultaniously (Zuu).
rubidium <rubidium@openttd.org>
parents:
11069
diff
changeset
|
2279 this->SetFocusedWidget(NCPWW_PASSWORD); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2280 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2281 |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2282 void OnOk() |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2283 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2284 if (this->IsWidgetLowered(NCPWW_SAVE_AS_DEFAULT_PASSWORD)) { |
9420
ec47ec544964
(svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium <rubidium@openttd.org>
parents:
9416
diff
changeset
|
2285 snprintf(_settings_client.network.default_company_pass, lengthof(_settings_client.network.default_company_pass), "%s", this->edit_str_buf); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2286 } |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2287 |
14504
95e338145e97
(svn r19075) -Codechange: unhackify NetworkChangeCompanyPassword()
smatz <smatz@openttd.org>
parents:
14410
diff
changeset
|
2288 NetworkChangeCompanyPassword(this->edit_str_buf); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2289 } |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2290 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2291 virtual void OnPaint() |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2292 { |
9273
72a6d2e60834
(svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium <rubidium@openttd.org>
parents:
9269
diff
changeset
|
2293 this->DrawWidgets(); |
13041
c00a3e3c405b
(svn r17539) -Codechange: Replace a magic number.
frosch <frosch@openttd.org>
parents:
13034
diff
changeset
|
2294 this->DrawEditBox(NCPWW_PASSWORD); |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2295 } |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2296 |
14409
1eaefde497fd
(svn r18966) -Codechange: Remove Window::OnDoubleClick() in favour of a parameter for OnClick().
frosch <frosch@openttd.org>
parents:
14258
diff
changeset
|
2297 virtual void OnClick(Point pt, int widget, int click_count) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2298 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2299 switch (widget) { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2300 case NCPWW_OK: |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2301 this->OnOk(); |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2302 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2303 /* FALL THROUGH */ |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2304 case NCPWW_CANCEL: |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2305 delete this; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2306 break; |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2307 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2308 case NCPWW_SAVE_AS_DEFAULT_PASSWORD: |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2309 this->ToggleWidgetLoweredState(NCPWW_SAVE_AS_DEFAULT_PASSWORD); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2310 this->SetDirty(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2311 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2312 } |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2313 } |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2314 |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2315 virtual void OnMouseLoop() |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2316 { |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2317 this->HandleEditBox(4); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2318 } |
8087
4537e595b8b6
(svn r11648) -Fix [FS#1560]: the company password was not set when one pressed the enter key.
rubidium <rubidium@openttd.org>
parents:
8082
diff
changeset
|
2319 |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9274
diff
changeset
|
2320 virtual EventState OnKeyPress(uint16 key, uint16 keycode) |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2321 { |
11319
340c5c4473f7
(svn r15669) -Change: Key presses that are not handles by an input box are no longer marked as handled but given to other OnKeyPress handlers. This makes the global shortcuts like F1 work again when an input box is open.
yexo <yexo@openttd.org>
parents:
11279
diff
changeset
|
2322 EventState state = ES_NOT_HANDLED; |
14052
a2be9df79ee0
(svn r18595) -Fix (r18277): one couldn't enter test via the keyboard in the company password window. Also replace a magic number with a enumified constant.
rubidium <rubidium@openttd.org>
parents:
14046
diff
changeset
|
2323 switch (this->HandleEditBoxKey(NCPWW_PASSWORD, key, keycode, state)) { |
10295
7ebf43f7c36b
(svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
glx <glx@openttd.org>
parents:
10292
diff
changeset
|
2324 default: break; |
7ebf43f7c36b
(svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
glx <glx@openttd.org>
parents:
10292
diff
changeset
|
2325 |
7ebf43f7c36b
(svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
glx <glx@openttd.org>
parents:
10292
diff
changeset
|
2326 case HEBR_CONFIRM: |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2327 this->OnOk(); |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2328 /* FALL THROUGH */ |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2329 |
10295
7ebf43f7c36b
(svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
glx <glx@openttd.org>
parents:
10292
diff
changeset
|
2330 case HEBR_CANCEL: |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2331 delete this; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2332 break; |
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2333 } |
9285
3b3f13cb6db6
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents:
9274
diff
changeset
|
2334 return state; |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2335 } |
10547
0b7be1ee92c5
(svn r14804) -Codechange: unify opening the OSK (Zuu)
rubidium <rubidium@openttd.org>
parents:
10480
diff
changeset
|
2336 |
0b7be1ee92c5
(svn r14804) -Codechange: unify opening the OSK (Zuu)
rubidium <rubidium@openttd.org>
parents:
10480
diff
changeset
|
2337 virtual void OnOpenOSKWindow(int wid) |
0b7be1ee92c5
(svn r14804) -Codechange: unify opening the OSK (Zuu)
rubidium <rubidium@openttd.org>
parents:
10480
diff
changeset
|
2338 { |
0b7be1ee92c5
(svn r14804) -Codechange: unify opening the OSK (Zuu)
rubidium <rubidium@openttd.org>
parents:
10480
diff
changeset
|
2339 ShowOnScreenKeyboard(this, wid, NCPWW_CANCEL, NCPWW_OK); |
0b7be1ee92c5
(svn r14804) -Codechange: unify opening the OSK (Zuu)
rubidium <rubidium@openttd.org>
parents:
10480
diff
changeset
|
2340 } |
9179
3b7b689031d6
(svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents:
9178
diff
changeset
|
2341 }; |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2342 |
13367
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2343 static const NWidgetPart _nested_network_company_password_window_widgets[] = { |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2344 NWidget(NWID_HORIZONTAL), |
13752
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
2345 NWidget(WWT_CLOSEBOX, COLOUR_GREY), |
517d77f53919
(svn r18277) -Codechange: remove unneeded widget indices for close, resize and sticky boxes and for window captions
rubidium <rubidium@openttd.org>
parents:
13749
diff
changeset
|
2346 NWidget(WWT_CAPTION, COLOUR_GREY), SetDataTip(STR_COMPANY_PASSWORD_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2347 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2348 NWidget(WWT_PANEL, COLOUR_GREY, NCPWW_BACKGROUND), |
13367
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2349 NWidget(NWID_VERTICAL), SetPIP(5, 5, 5), |
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2350 NWidget(NWID_HORIZONTAL), SetPIP(5, 5, 5), |
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2351 NWidget(WWT_TEXT, COLOUR_GREY, NCPWW_LABEL), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_NULL), |
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2352 NWidget(WWT_EDITBOX, COLOUR_GREY, NCPWW_PASSWORD), SetMinimalSize(194, 12), SetDataTip(STR_COMPANY_VIEW_SET_PASSWORD, STR_NULL), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2353 EndContainer(), |
13367
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2354 NWidget(NWID_HORIZONTAL), SetPIP(5, 0, 5), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2355 NWidget(NWID_SPACER), SetFill(1, 0), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2356 NWidget(WWT_TEXTBTN, COLOUR_GREY, NCPWW_SAVE_AS_DEFAULT_PASSWORD), SetMinimalSize(194, 12), |
12632
e41943276802
(svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents:
12619
diff
changeset
|
2357 SetDataTip(STR_COMPANY_PASSWORD_MAKE_DEFAULT, STR_COMPANY_PASSWORD_MAKE_DEFAULT_TOOLTIP), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2358 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2359 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2360 EndContainer(), |
13367
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2361 NWidget(NWID_HORIZONTAL, NC_EQUALSIZE), |
13704
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2362 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, NCPWW_CANCEL), SetFill(1, 0), SetDataTip(STR_BUTTON_CANCEL, STR_COMPANY_PASSWORD_CANCEL), |
af90d4bf0785
(svn r18229) -Codechange: Make fill_x, fill_y a number instead of a bool.
alberth <alberth@openttd.org>
parents:
13695
diff
changeset
|
2363 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, NCPWW_OK), SetFill(1, 0), SetDataTip(STR_BUTTON_OK, STR_COMPANY_PASSWORD_OK), |
11847
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2364 EndContainer(), |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2365 }; |
add0648f33b0
(svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents:
11846
diff
changeset
|
2366 |
13367
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2367 static const WindowDesc _network_company_password_window_desc( |
13798
6f820ae12bb3
(svn r18324) -Codechange: there's no need for a default size when the window isn't resizable
rubidium <rubidium@openttd.org>
parents:
13796
diff
changeset
|
2368 WDP_AUTO, 0, 0, |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2369 WC_COMPANY_PASSWORD_WINDOW, WC_NONE, |
13749
fc3ab8256c95
(svn r18274) -Codechange: remove the unused WDF flags
rubidium <rubidium@openttd.org>
parents:
13726
diff
changeset
|
2370 WDF_UNCLICK_BUTTONS, |
13564
bae287664b02
(svn r18086) -Codechange: remove 'widget' from WindowDesc
rubidium <rubidium@openttd.org>
parents:
13556
diff
changeset
|
2371 _nested_network_company_password_window_widgets, lengthof(_nested_network_company_password_window_widgets) |
11373
474ba6cc0946
(svn r15723) -Codechange: use a constructor for WindowDescs as that makes expanding them much easier (Alberth)
rubidium <rubidium@openttd.org>
parents:
11368
diff
changeset
|
2372 ); |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2373 |
9241
8299dc138e1c
(svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx <glx@openttd.org>
parents:
9182
diff
changeset
|
2374 void ShowNetworkCompanyPasswordWindow(Window *parent) |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2375 { |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2376 DeleteWindowById(WC_COMPANY_PASSWORD_WINDOW, 0); |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2377 |
13367
4f4c452950cc
(svn r17876) -Codechange: make the network company password window nested
rubidium <rubidium@openttd.org>
parents:
13344
diff
changeset
|
2378 new NetworkCompanyPasswordWindow(&_network_company_password_window_desc, parent); |
7998
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2379 } |
c23b6367e55b
(svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents:
7997
diff
changeset
|
2380 |
5584
4b26bd55bd24
(svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff
changeset
|
2381 #endif /* ENABLE_NETWORK */ |