annotate src/network/network_gui.cpp @ 13028:30e0feabeff8 draft

(svn r17526) -Codechange: use QSortT instead of qsort for sorting the language list in the network GUI
author rubidium <rubidium@openttd.org>
date Sun, 13 Sep 2009 17:38:07 +0000
parents 8ad447b80c42
children 6eb3f749890a
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
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"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
14 #include "../openttd.h"
8114
2d6af5d7a142 (svn r11675) -Codechange: split the string types from the string functions.
rubidium <rubidium@openttd.org>
parents: 8107
diff changeset
15 #include "../strings_func.h"
8140
fb8a05d579da (svn r11702) -Codechange: move all date related stuff to date*.
rubidium <rubidium@openttd.org>
parents: 8131
diff changeset
16 #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
17 #include "../fios.h"
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
18 #include "network_internal.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
19 #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
20 #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
21 #include "network_gamelist.h"
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_server.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
24 #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
25 #include "../window_func.h"
8214
6385dffc0b37 (svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium <rubidium@openttd.org>
parents: 8213
diff changeset
26 #include "../string_func.h"
8224
c45446125bf0 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium <rubidium@openttd.org>
parents: 8214
diff changeset
27 #include "../gfx_func.h"
8270
5613b863190d (svn r11834) -Codechange: only include settings_type.h if needed.
rubidium <rubidium@openttd.org>
parents: 8264
diff changeset
28 #include "../settings_type.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
29 #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
30 #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
31 #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
32 #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
33 #include "../company_func.h"
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
34 #include "../core/sort_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
35
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
36 #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
37 #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
38
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
39
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 5916
diff changeset
40 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
41 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
42 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
43
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
44 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
45 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
46 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
47 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
48 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
49
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
50 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
51 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
52 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
53 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
54 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
55
6796
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
56 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
57
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
58 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
59 {
6796
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
60 /* Init the strings */
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
61 if (_language_dropdown[0] == STR_NULL) {
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
62 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
63 _language_dropdown[NETLANG_COUNT] = INVALID_STRING_ID;
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
64 }
6793
30657c4af0fb (svn r10032) -Add: sort the strings in server language dropdown
glx <glx@openttd.org>
parents: 6780
diff changeset
65
6796
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
66 /* 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
67 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
68 }
6780
05ca25dd9fa4 (svn r10017) -Add (FS#790): more languages flags for servers
glx <glx@openttd.org>
parents: 6531
diff changeset
69
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
70 enum {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
71 NET_PRC__OFFSET_TOP_WIDGET = 54,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
72 NET_PRC__OFFSET_TOP_WIDGET_COMPANY = 52,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
73 NET_PRC__SIZE_OF_ROW = 14,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
74 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
75
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
76 /** 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
77 * 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
78 * @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
79 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
80 {
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
81 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
82 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
83
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
84 /** 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
85 enum NetworkGameWindowWidgets {
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
86 NGWW_CLOSE, ///< Close 'X' 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
87 NGWW_CAPTION, ///< Caption of the window
11374
f58902ec450d (svn r15724) -Codechange: some widget documentation/fixing of enumified constant names (Alberth)
rubidium <rubidium@openttd.org>
parents: 11373
diff changeset
88 NGWW_MAIN, ///< Main panel
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
89
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
90 NGWW_CONNECTION, ///< Label in from of connection droplist
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
91 NGWW_CONN_BTN, ///< 'Connection' droplist button
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
92 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
93
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
94 NGWW_NAME, ///< 'Name' button
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
95 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
96 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
97 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
98 NGWW_YEARS, ///< 'Years' button
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
99 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
100
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
101 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
102 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
103
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
104 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
105 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
106
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
107 NGWW_DETAILS, ///< Panel with game details
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
108 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
109 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
110 NGWW_NEWGRF, ///< 'NewGRF Settings' button
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
111
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
112 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
113 NGWW_ADD, ///< 'Add server' button
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
114 NGWW_START, ///< 'Start server' button
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
115 NGWW_CANCEL, ///< 'Cancel' button
11374
f58902ec450d (svn r15724) -Codechange: some widget documentation/fixing of enumified constant names (Alberth)
rubidium <rubidium@openttd.org>
parents: 11373
diff changeset
116
f58902ec450d (svn r15724) -Codechange: some widget documentation/fixing of enumified constant names (Alberth)
rubidium <rubidium@openttd.org>
parents: 11373
diff changeset
117 NGWW_RESIZE, ///< Resize button
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
118 };
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
119
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
120 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
121 typedef uint16 ServerListPosition;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
122 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
123
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
124 class NetworkGameWindow : public QueryStringBaseWindow {
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
125 protected:
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
126 /* Runtime saved values */
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
127 static Listing last_sorting;
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
128
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
129 /* Constants for sorting servers */
11376
b9b2391afd1a (svn r15726) -Codechange: unify coding style for const pointers
smatz <smatz@openttd.org>
parents: 11374
diff changeset
130 static GUIGameServerList::SortFunction * const sorter_funcs[];
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
131
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
132 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
133 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
134 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
135 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
136 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
137
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
138 /**
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
139 * (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
140 * 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
141 */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
142 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
143 {
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
144 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
145
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
146 /* 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
147 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
148
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
149 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
150 *this->servers.Append() = ngl;
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
151 }
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
152
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
153 this->servers.Compact();
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
154 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
155 this->vscroll.SetCount(this->servers.Length());
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
156 }
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
157
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
158 /** Sort servers by name. */
10647
592ae9307430 (svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents: 10641
diff changeset
159 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
160 {
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
161 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
162 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
163
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
164 /** 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
165 * 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
166 * higher maximum is preferred. */
10647
592ae9307430 (svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents: 10641
diff changeset
167 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
168 {
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
169 /* 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
170 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
171
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
172 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
173 if (r == 0) r = NGameNameSorter(a, b);
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
174
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
175 return r;
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
176 }
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
177
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
178 /** Sort servers by map size */
10647
592ae9307430 (svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents: 10641
diff changeset
179 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
180 {
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
181 /* 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
182 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
183
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
184 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
185 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
186 }
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
187
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
188 /** Sort servers by current date */
10647
592ae9307430 (svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents: 10641
diff changeset
189 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
190 {
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
191 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
192 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
193 }
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
194
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
195 /** 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
196 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
197 {
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
198 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
199 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
200 }
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
201
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
202 /** 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
203 * same, prefer the non-passworded server first. */
10647
592ae9307430 (svn r14949) -Cleanup: pointer coding style
rubidium <rubidium@openttd.org>
parents: 10641
diff changeset
204 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
205 {
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
206 /* 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
207 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
208
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
209 /* 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
210 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
211 /* 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
212 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
213 /* Passworded servers should be below unpassworded servers */
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
214 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
215 /* 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
216 if (r == 0) r = NGameNameSorter(a, b);
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
217
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
218 return r;
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
219 }
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
220
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
221 /** 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
222 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
223 {
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
224 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
225
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
226 /* 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
227 * 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
228 * 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
229 * 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
230 this->list_pos = SLP_INVALID;
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
231 _network_game_list = this->servers[0];
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
232 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
233 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
234 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
235 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
236 item = item->next;
10279
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
237 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
238 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
239 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
240 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
241
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
242 /**
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
243 * 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
244 * @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
245 * @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
246 * @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
247 */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
248 void DrawServerLine(const NetworkGameList *cur_item, uint y, bool highlight)
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
249 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
250 /* show highlighted item with a different colour */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
251 if (highlight) GfxFillRect(this->widget[NGWW_NAME].left + 1, y - 2, this->widget[NGWW_INFO].right - 1, y + 9, 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
252
11773
f6383e56f993 (svn r16163) -Codechange: instead of SetDParamStr(0, string); DrawString(..., STR_JUST_RAW_STRING, ...) use DrawString(..., string, ...).
rubidium <rubidium@openttd.org>
parents: 11772
diff changeset
253 DrawString(this->widget[NGWW_NAME].left + 5, this->widget[NGWW_NAME].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
254
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
255 /* 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
256 if (cur_item->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
257 SetDParam(0, cur_item->info.clients_on);
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
258 SetDParam(1, cur_item->info.clients_max);
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
259 SetDParam(2, cur_item->info.companies_on);
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
260 SetDParam(3, cur_item->info.companies_max);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
261 DrawString(this->widget[NGWW_CLIENTS].left, this->widget[NGWW_CLIENTS].right, y, STR_NETWORK_SERVER_LIST_GENERAL_ONLINE, 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
262
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
263 /* 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
264 if (!this->IsWidgetHidden(NGWW_MAPSIZE)) {
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
265 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
266 SetDParam(1, cur_item->info.map_height);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
267 DrawString(this->widget[NGWW_MAPSIZE].left, this->widget[NGWW_MAPSIZE].right, 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
268 }
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
269
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
270 /* current 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
271 if (!this->IsWidgetHidden(NGWW_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
272 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
273 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
274 SetDParam(0, ymd.year);
11432
a20dd0000d96 (svn r15790) -Codechange: remove the *Centered part of the old text drawing API.
rubidium <rubidium@openttd.org>
parents: 11430
diff changeset
275 DrawString(this->widget[NGWW_DATE].left, this->widget[NGWW_DATE].right, 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
276 }
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
277
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
278 /* number of years the game is running */
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
279 if (!this->IsWidgetHidden(NGWW_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
280 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
281 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
282 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
283 SetDParam(0, ymd_cur.year - ymd_start.year);
11432
a20dd0000d96 (svn r15790) -Codechange: remove the *Centered part of the old text drawing API.
rubidium <rubidium@openttd.org>
parents: 11430
diff changeset
284 DrawString(this->widget[NGWW_YEARS].left, this->widget[NGWW_YEARS].right, 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
285 }
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
286
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
287 /* draw a lock if the server is password protected */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
288 if (cur_item->info.use_password) DrawSprite(SPR_LOCK, PAL_NONE, this->widget[NGWW_INFO].left + 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
289
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
290 /* draw red or green icon, depending on compatibility with 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
291 DrawSprite(SPR_BLOT, (cur_item->info.compatible ? PALETTE_TO_GREEN : (cur_item->info.version_compatible ? PALETTE_TO_YELLOW : PALETTE_TO_RED)), this->widget[NGWW_INFO].left + 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
292
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
293 /* draw flag according to server 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
294 DrawSprite(SPR_FLAGS_BASE + cur_item->info.server_lang, PAL_NONE, this->widget[NGWW_INFO].left + 25, y);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
295 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
296 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
297
10279
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
298 /**
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
299 * 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
300 * 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
301 * 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
302 * 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
303 * 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
304 */
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
305 void ScrollToSelectedServer()
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
306 {
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
307 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
308 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
309 }
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
310
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
311 public:
11612
08cce3f5e118 (svn r15988) -Fix: inconsistency between using NETWORK_NAME_LENGTH and NETWORK_CLIENT_NAME_LENGTH for the length of client names.
rubidium <rubidium@openttd.org>
parents: 11608
diff changeset
312 NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_CLIENT_NAME_LENGTH, desc)
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
313 {
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
314 this->widget[NGWW_CLIENTS].left = this->widget[NGWW_NAME].right + 1;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
315 this->widget[NGWW_MAPSIZE].left = this->widget[NGWW_NAME].right + 1;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
316 this->widget[NGWW_DATE].left = this->widget[NGWW_NAME].right + 1;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
317 this->widget[NGWW_YEARS].left = this->widget[NGWW_NAME].right + 1;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
318
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
319 this->widget[NGWW_CLIENTS].right = this->widget[NGWW_INFO].left - 1;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
320 this->widget[NGWW_MAPSIZE].right = this->widget[NGWW_INFO].left - 1;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
321 this->widget[NGWW_DATE].right = this->widget[NGWW_INFO].left - 1 - 20;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
322 this->widget[NGWW_YEARS].right = this->widget[NGWW_INFO].left - 1 - 20;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
323
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
324 this->widget[NGWW_NAME].display_flags &= ~RESIZE_LRTB;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
325 this->widget[NGWW_CLIENTS].display_flags &= ~RESIZE_LRTB;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
326 this->widget[NGWW_MAPSIZE].display_flags &= ~RESIZE_LRTB;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
327 this->widget[NGWW_DATE].display_flags &= ~RESIZE_LRTB;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
328 this->widget[NGWW_YEARS].display_flags &= ~RESIZE_LRTB;
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
329
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
330 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
331 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
332 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
333 this->SetFocusedWidget(NGWW_CLIENT);
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
334
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
335 UpdateNetworkGameWindow(true);
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
336
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
337 this->vscroll.SetCapacity(11);
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
338 this->resize.step_height = NET_PRC__SIZE_OF_ROW;
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
339
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
340 this->field = NGWW_CLIENT;
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
341 this->server = NULL;
10279
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
342 this->list_pos = SLP_INVALID;
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
343
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
344 this->last_joined = NetworkGameListAddItem(NetworkAddress(_settings_client.network.last_host, _settings_client.network.last_port));
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
345
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
346 this->servers.SetListing(this->last_sorting);
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
347 this->servers.SetSortFuncs(this->sorter_funcs);
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
348 this->servers.ForceRebuild();
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
349 this->SortNetworkGameList();
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
350
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
351 this->FindWindowPlacementAndResize(desc);
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
352 }
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
353
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
354 ~NetworkGameWindow()
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
355 {
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
356 this->last_sorting = this->servers.GetListing();
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
357 }
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
358
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
359 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
360 {
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
361 NetworkGameList *sel = this->server;
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
362 const SortButtonState arrow = this->servers.IsDescSortOrder() ? SBS_DOWN : SBS_UP;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
363
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
364 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
365 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
366 }
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
367 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
368
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
369 /* '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
370 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
371 /* '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
372 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
373 !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
374 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
375 !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
376
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
377 /* 'NewGRF Settings' button invisible if no NewGRF is used */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
378 this->SetWidgetHiddenState(NGWW_NEWGRF, 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
379 !sel->online ||
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
380 sel->info.grfconfig == 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
381
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
382 SetDParam(0, 0x00);
9420
ec47ec544964 (svn r13334) -Codechange: move the network settings variables from network/network_internal to settings.
rubidium <rubidium@openttd.org>
parents: 9416
diff changeset
383 SetDParam(1, _lan_internet_types_dropdown[_settings_client.network.lan_internet]);
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
384 this->DrawWidgets();
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
385
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
386 /* 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
387 this->DrawEditBox(NGWW_CLIENT);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
388
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
389 DrawString(0, this->widget[NGWW_CLIENT].left - 5, 23, STR_NETWORK_SERVER_LIST_PLAYER_NAME, TC_FROMSTRING, SA_RIGHT);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
390
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
391 /* Sort based on widgets: name, clients, compatibility */
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
392 switch (this->servers.SortType()) {
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
393 case NGWW_NAME - NGWW_NAME: this->DrawSortButtonState(NGWW_NAME, arrow); break;
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
394 case NGWW_CLIENTS - NGWW_NAME: this->DrawSortButtonState(NGWW_CLIENTS, arrow); break;
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 case NGWW_MAPSIZE - NGWW_NAME: if (!this->IsWidgetHidden(NGWW_MAPSIZE)) this->DrawSortButtonState(NGWW_MAPSIZE, arrow); break;
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
396 case NGWW_DATE - NGWW_NAME: if (!this->IsWidgetHidden(NGWW_DATE)) this->DrawSortButtonState(NGWW_DATE, arrow); break;
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
397 case NGWW_YEARS - NGWW_NAME: if (!this->IsWidgetHidden(NGWW_YEARS)) this->DrawSortButtonState(NGWW_YEARS, arrow); break;
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
398 case NGWW_INFO - NGWW_NAME: this->DrawSortButtonState(NGWW_INFO, arrow); 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
399 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
400
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
401 uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 3;
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
402
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
403 const int max = min(this->vscroll.GetPosition() + this->vscroll.GetCapacity(), (int)this->servers.Length());
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
404
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
405 for (int i = this->vscroll.GetPosition(); i < max; ++i) {
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
406 const NetworkGameList *ngl = this->servers[i];
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
407 this->DrawServerLine(ngl, y, ngl == sel);
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
408 y += NET_PRC__SIZE_OF_ROW;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
409 }
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
410
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
411 /* Draw the last joined server, if any */
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
412 if (this->last_joined != NULL) this->DrawServerLine(this->last_joined, y = this->widget[NGWW_LASTJOINED].top + 3, this->last_joined == sel);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
413
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
414 /* Draw the right 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
415 GfxFillRect(this->widget[NGWW_DETAILS].left + 1, 43, this->widget[NGWW_DETAILS].right - 1, 92, 157);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
416 if (sel == NULL) {
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
417 DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 58, STR_NETWORK_SERVER_LIST_GAME_INFO, TC_FROMSTRING, SA_CENTER);
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
418 } else if (!sel->online) {
11773
f6383e56f993 (svn r16163) -Codechange: instead of SetDParamStr(0, string); DrawString(..., STR_JUST_RAW_STRING, ...) use DrawString(..., string, ...).
rubidium <rubidium@openttd.org>
parents: 11772
diff changeset
419 DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 68, sel->info.server_name, TC_ORANGE, SA_CENTER); // game name
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
420
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
421 DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 132, STR_NETWORK_SERVER_LIST_SERVER_OFFLINE, TC_FROMSTRING, SA_CENTER); // server offline
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 } else { // show game info
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
423 uint16 y = 100;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
424 const uint16 x = this->widget[NGWW_DETAILS].left + 5;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
426 DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 48, STR_NETWORK_SERVER_LIST_GAME_INFO, TC_FROMSTRING, SA_CENTER);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
427
11773
f6383e56f993 (svn r16163) -Codechange: instead of SetDParamStr(0, string); DrawString(..., STR_JUST_RAW_STRING, ...) use DrawString(..., string, ...).
rubidium <rubidium@openttd.org>
parents: 11772
diff changeset
428 DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, sel->info.server_name, TC_ORANGE, SA_CENTER); // game name
f6383e56f993 (svn r16163) -Codechange: instead of SetDParamStr(0, string); DrawString(..., STR_JUST_RAW_STRING, ...) use DrawString(..., string, ...).
rubidium <rubidium@openttd.org>
parents: 11772
diff changeset
429 DrawString(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, sel->info.map_name, TC_BLACK, SA_CENTER); // map name
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
430
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
431 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
432 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
433 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
434 SetDParam(3, sel->info.companies_max);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
435 DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_SERVER_LIST_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
436 y += 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
437
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
438 SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
439 DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_SERVER_LIST_LANGUAGE); // server language
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
440 y += 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
441
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
442 SetDParam(0, STR_CHEAT_SWITCH_CLIMATE_TEMPERATE_LANDSCAPE + sel->info.map_set);
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
443 DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_SERVER_LIST_TILESET); // tileset
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
444 y += 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
445
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
446 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
447 SetDParam(1, sel->info.map_height);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
448 DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_SERVER_LIST_MAP_SIZE); // map size
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
449 y += 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
450
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
451 SetDParamStr(0, sel->info.server_revision);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
452 DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_SERVER_LIST_SERVER_VERSION); // server version
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
453 y += 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
454
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
455 SetDParamStr(0, sel->address.GetAddressAsString());
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
456 DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_SERVER_LIST_SERVER_ADDRESS); // 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
457 y += 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
458
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
459 SetDParam(0, sel->info.start_date);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
460 DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_SERVER_LIST_START_DATE); // start date
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
461 y += 10;
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
462
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
463 SetDParam(0, sel->info.game_date);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
464 DrawString(x, this->widget[NGWW_DETAILS].right, y, STR_NETWORK_SERVER_LIST_CURRENT_DATE); // current date
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
465 y += 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
466
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
467 y += 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
468
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
469 if (!sel->info.compatible) {
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
470 DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 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
471 } 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
472 /* Show: server full, when clients_on == 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
473 DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 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
474 } else if (sel->info.use_password) {
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
475 DrawString(this->widget[NGWW_DETAILS].left + 1, this->widget[NGWW_DETAILS].right - 1, 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
476 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
477
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
478 y += 10;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
479 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
480 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
481
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
482 virtual void OnClick(Point pt, int 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
483 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
484 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
485 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
486 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
487 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
488 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
489
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
490 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
491 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
492 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
493
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
494 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
495 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
496 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
497 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
498 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
499 case NGWW_INFO: // Connectivity (green dot)
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
500 if (this->servers.SortType() == widget - NGWW_NAME) {
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
501 this->servers.ToggleSortOrder();
10279
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
502 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
503 } else {
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
504 this->servers.SetSortType(widget - NGWW_NAME);
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
505 this->servers.ForceResort();
10279
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
506 this->SortNetworkGameList();
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
507 }
10279
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
508 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
509 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
510 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
511
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
512 case NGWW_MATRIX: { // Matrix to show networkgames
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
513 uint32 id_v = (pt.y - NET_PRC__OFFSET_TOP_WIDGET) / NET_PRC__SIZE_OF_ROW;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
514
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
515 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
516 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
517
9415
195a505bb0f4 (svn r13328) -Fix (r13327): Don't access an item when there isn't any
skidd13 <skidd13@openttd.org>
parents: 9414
diff changeset
518 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
519 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
520 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
521 } 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
522
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
523 case NGWW_LASTJOINED: {
11551
939f22f810ef (svn r15916) -Codechange: let the network game list use NetworkAddress
rubidium <rubidium@openttd.org>
parents: 11524
diff changeset
524 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
525 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
526 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
527
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
528 /* 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
529 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
530 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
531 this->list_pos = i;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
532 break;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
533 }
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
534 }
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
535 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
536 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
537 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
538 } 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
539
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
540 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
541 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
542 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
543 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
544 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
545 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
546
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
547 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
548 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
549 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
550 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
551 STR_NETWORK_SERVER_LIST_ENTER_IP,
11860
ebf5beca420e (svn r16254) -Fix [FS#2886]: Magic constant removed.
frosch <frosch@openttd.org>
parents: 11847
diff changeset
552 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
553 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
554 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
555 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
556
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
557 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
558 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
559 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
560
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
561 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
562 if (this->server != NULL) {
11551
939f22f810ef (svn r15916) -Codechange: let the network game list use NetworkAddress
rubidium <rubidium@openttd.org>
parents: 11524
diff changeset
563 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
564 _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
565 ShowNetworkLobbyWindow(this->server);
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
566 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
567 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
568
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 case NGWW_REFRESH: // Refresh
11551
939f22f810ef (svn r15916) -Codechange: let the network game list use NetworkAddress
rubidium <rubidium@openttd.org>
parents: 11524
diff changeset
570 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
571 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
572
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
573 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
574 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
575 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
576 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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
10049
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
579 virtual void OnDoubleClick(Point pt, int widget)
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
580 {
10061
a2adf1e62010 (svn r14228) -Fix (r14209): double click on the 'last joined' server didn't work
smatz <smatz@openttd.org>
parents: 10049
diff changeset
581 if (widget == NGWW_MATRIX || widget == NGWW_LASTJOINED) {
10049
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
582 /* is the Join button enabled? */
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
583 if (!this->IsWidgetDisabled(NGWW_JOIN)) this->OnClick(pt, NGWW_JOIN);
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
584 }
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
585 }
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
586
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
587 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
588 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
589 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
590 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
591 _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
592 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
593
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
594 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
595 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
596 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
597
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
598 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
599 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
600
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
601 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
602 {
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
603 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
604 }
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
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
606 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
607 {
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
608 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
609 /* 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
610 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
611 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
612 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
613 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
614
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
615 /* 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
616 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
617 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
618 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
619 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
620 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
621 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
622
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
623 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
624 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
625 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
626 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
627 }
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
628
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
629 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
630 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
631 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
632 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
633 }
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
634
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
635 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
636 }
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
637 break;
10279
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
638 }
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
639 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
640 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
641 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
642
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
643 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
644 {
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
645 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
646
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
647 /* 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
648 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
649 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
650 switch (keycode) {
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
651 case WKC_UP:
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
652 /* scroll up by one */
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
653 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
654 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
655 break;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
656 case WKC_DOWN:
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
657 /* scroll down by one */
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
658 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
659 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
660 break;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
661 case WKC_PAGEUP:
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
662 /* scroll up a page */
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
663 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
664 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
665 break;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
666 case WKC_PAGEDOWN:
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
667 /* scroll down a page */
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
668 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
669 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
670 break;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
671 case WKC_HOME:
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
672 /* jump to beginning */
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
673 this->list_pos = 0;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
674 break;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
675 case WKC_END:
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
676 /* jump to end */
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
677 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
678 break;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
679 default: break;
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
680 }
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
681
10641
94cbc9a0158b (svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents: 10559
diff changeset
682 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
683
10641
94cbc9a0158b (svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents: 10559
diff changeset
684 /* 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
685 this->ScrollToSelectedServer();
10279
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
686
10641
94cbc9a0158b (svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents: 10559
diff changeset
687 /* redraw window */
94cbc9a0158b (svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents: 10559
diff changeset
688 this->SetDirty();
94cbc9a0158b (svn r14943) -Cleanup: remove some rogue spaces/replace some rogue tabs with spaces
rubidium <rubidium@openttd.org>
parents: 10559
diff changeset
689 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
690 }
10279
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
691
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
692 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
693 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
694 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
695 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
696 this->server = NULL;
10279
63bfb33e1a12 (svn r14517) -Feature: arrow key scrolling in the server list (Roujin)
rubidium <rubidium@openttd.org>
parents: 10208
diff changeset
697 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
698 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 }
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
700 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
701 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
702
10295
7ebf43f7c36b (svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
glx <glx@openttd.org>
parents: 10292
diff changeset
703 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
704
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
705 /* 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
706 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
707 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
708 } 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
709 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
710 }
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
711 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
712 }
7343
76fcc58cd6c7 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium <rubidium@openttd.org>
parents: 7341
diff changeset
713
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
714 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
715 {
12543
ea54644136d4 (svn r16981) -Fix [FS#3062]: the last manually added server would not be saved
rubidium <rubidium@openttd.org>
parents: 12493
diff changeset
716 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
717 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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
11524
420a4f0b4e0b (svn r15885) -Codechange: Removed new_size parameter of Window::OnResize() callback
alberth <alberth@openttd.org>
parents: 11467
diff changeset
719 virtual void OnResize(Point delta)
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
720 {
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
721 this->vscroll.UpdateCapacity(delta.y / (int)this->resize.step_height);
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
722 this->widget[NGWW_MATRIX].data = (this->vscroll.GetCapacity() << MAT_ROW_START) + (1 << MAT_COL_START);
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
723
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
724 /* Additional colums in server list */
11361
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11319
diff changeset
725 if (this->width > NetworkGameWindow::MIN_EXTRA_COLUMNS_WIDTH + GetWidgetWidth(NGWW_MAPSIZE) +
02313cc6114e (svn r15711) -Codechange: lots of whitespace cleanup/fixes
rubidium <rubidium@openttd.org>
parents: 11319
diff changeset
726 GetWidgetWidth(NGWW_DATE) + GetWidgetWidth(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
727 /* show columns 'Map size', 'Date' and '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
728 this->SetWidgetsHiddenState(false, NGWW_MAPSIZE, NGWW_DATE, NGWW_YEARS, WIDGET_LIST_END);
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
729 AlignWidgetRight(NGWW_YEARS, NGWW_INFO);
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
730 AlignWidgetRight(NGWW_DATE, NGWW_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
731 AlignWidgetRight(NGWW_MAPSIZE, NGWW_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
732 AlignWidgetRight(NGWW_CLIENTS, NGWW_MAPSIZE);
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
733 } else if (this->width > NetworkGameWindow::MIN_EXTRA_COLUMNS_WIDTH + GetWidgetWidth(NGWW_MAPSIZE) + GetWidgetWidth(NGWW_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
734 /* show columns 'Map size' and '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
735 this->SetWidgetsHiddenState(false, NGWW_MAPSIZE, NGWW_DATE, WIDGET_LIST_END);
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
736 this->HideWidget(NGWW_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
737 AlignWidgetRight(NGWW_DATE, NGWW_INFO);
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
738 AlignWidgetRight(NGWW_MAPSIZE, NGWW_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
739 AlignWidgetRight(NGWW_CLIENTS, NGWW_MAPSIZE);
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
740 } else if (this->width > NetworkGameWindow::MIN_EXTRA_COLUMNS_WIDTH + GetWidgetWidth(NGWW_MAPSIZE)) {
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
741 /* show column '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
742 this->ShowWidget(NGWW_MAPSIZE);
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
743 this->SetWidgetsHiddenState(true, NGWW_DATE, NGWW_YEARS, WIDGET_LIST_END);
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
744 AlignWidgetRight(NGWW_MAPSIZE, NGWW_INFO);
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
745 AlignWidgetRight(NGWW_CLIENTS, NGWW_MAPSIZE);
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
746 } else {
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
747 /* hide columns 'Map size', 'Date' and '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
748 this->SetWidgetsHiddenState(true, NGWW_MAPSIZE, NGWW_DATE, NGWW_YEARS, WIDGET_LIST_END);
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
749 AlignWidgetRight(NGWW_CLIENTS, NGWW_INFO);
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
750 }
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
751 this->widget[NGWW_NAME].right = this->widget[NGWW_CLIENTS].left - 1;
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
752
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
753 /* BOTTOM */
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
754 int widget_width = this->widget[NGWW_FIND].right - this->widget[NGWW_FIND].left;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
755 int space = (this->width - 4 * widget_width - 25) / 3;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
757 int offset = 10;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 for (uint i = 0; i < 4; 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
759 this->widget[NGWW_FIND + i].left = offset;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 offset += widget_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
761 this->widget[NGWW_FIND + i].right = offset;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 offset += space;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
764 }
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
765
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
766 static const int MIN_EXTRA_COLUMNS_WIDTH = 550; ///< default width of the window
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
767 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
768
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
769 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
770 GUIGameServerList::SortFunction * const NetworkGameWindow::sorter_funcs[] = {
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
771 &NGameNameSorter,
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
772 &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
773 &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
774 &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
775 &NGameYearsSorter,
9414
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
776 &NGameAllowedSorter
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
777 };
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
778
ca0680949f89 (svn r13327) -Codechange: NetworkGameWindow uses GUILists Sort() now
skidd13 <skidd13@openttd.org>
parents: 9413
diff changeset
779
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
780 static const Widget _network_game_window_widgets[] = {
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
781 /* TOP */
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11682
diff changeset
782 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_LIGHT_BLUE, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW}, // NGWW_CLOSE
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
783 { WWT_CAPTION, RESIZE_RIGHT, COLOUR_LIGHT_BLUE, 11, 449, 0, 13, STR_NETWORK_SERVER_LIST_CAPTION, STR_NULL}, // NGWW_CAPTION
11374
f58902ec450d (svn r15724) -Codechange: some widget documentation/fixing of enumified constant names (Alberth)
rubidium <rubidium@openttd.org>
parents: 11373
diff changeset
784 { WWT_PANEL, RESIZE_RB, COLOUR_LIGHT_BLUE, 0, 449, 14, 263, 0x0, STR_NULL}, // NGWW_MAIN
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
785
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
786 { WWT_TEXT, RESIZE_NONE, COLOUR_LIGHT_BLUE, 9, 85, 23, 35, STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL}, // NGWW_CONNECTION
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
787 { WWT_DROPDOWN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 90, 181, 22, 33, STR_NETWORK_START_SERVER_LAN_INTERNET_COMBO, STR_NETWORK_SERVER_LIST_CONNECTION_TOOLTIP}, // NGWW_CONN_BTN
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
788
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
789 { WWT_EDITBOX, RESIZE_LR, COLOUR_LIGHT_BLUE, 290, 440, 22, 33, STR_NETWORK_SERVER_LIST_PLAYER_NAME_OSKTITLE, STR_NETWORK_SERVER_LIST_ENTER_NAME_TOOLTIP}, // NGWW_CLIENT
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
790
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
791 /* LEFT SIDE */
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
792 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 10, 70, 42, 53, STR_NETWORK_SERVER_LIST_GAME_NAME, STR_NETWORK_SERVER_LIST_GAME_NAME_TOOLTIP}, // NGWW_NAME
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
793 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 71, 150, 42, 53, STR_NETWORK_SERVER_LIST_CLIENTS_CAPTION, STR_NETWORK_SERVER_LIST_CLIENTS_CAPTION_TOOLTIP}, // NGWW_CLIENTS
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
794 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 71, 150, 42, 53, STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION, STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION_TOOLTIP}, // NGWW_MAPSIZE
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
795 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 71, 130, 42, 53, STR_NETWORK_SERVER_LIST_DATE_CAPTION, STR_NETWORK_SERVER_LIST_DATE_CAPTION_TOOLTIP}, // NGWW_DATE
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
796 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 71, 130, 42, 53, STR_NETWORK_SERVER_LIST_YEARS_CAPTION, STR_NETWORK_SERVER_LIST_YEARS_CAPTION_TOOLTIP}, // NGWW_YEARS
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
797 { WWT_PUSHTXTBTN, RESIZE_LR, COLOUR_WHITE, 151, 190, 42, 53, STR_EMPTY, STR_NETWORK_SERVER_LIST_INFO_ICONS_TOOLTIP}, // NGWW_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
798
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
799 { WWT_MATRIX, RESIZE_RB, COLOUR_LIGHT_BLUE, 10, 190, 54, 208, (11 << 8) + 1, STR_NETWORK_SERVER_LIST_CLICK_GAME_TO_SELECT}, // NGWW_MATRIX
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11682
diff changeset
800 { WWT_SCROLLBAR, RESIZE_LRB, COLOUR_LIGHT_BLUE, 191, 202, 42, 208, 0x0, STR_TOOLTIP_VSCROLL_BAR_SCROLLS_LIST}, // NGWW_SCROLLBAR
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
801 { WWT_TEXT, RESIZE_RTB, COLOUR_LIGHT_BLUE, 10, 190, 211, 222, STR_NETWORK_SERVER_LIST_LAST_JOINED_SERVER, STR_NULL}, // NGWW_LASTJOINED_LABEL
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
802 { WWT_PANEL, RESIZE_RTB, COLOUR_LIGHT_BLUE, 10, 190, 223, 236, 0x0, STR_NETWORK_SERVER_LIST_CLICK_TO_SELECT_LAST}, // NGWW_LASTJOINED
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
803
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
804 /* RIGHT SIDE */
9827
ebe07a67945e (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas <belugas@openttd.org>
parents: 9770
diff changeset
805 { WWT_PANEL, RESIZE_LRB, COLOUR_LIGHT_BLUE, 210, 440, 42, 236, 0x0, STR_NULL}, // NGWW_DETAILS
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
806
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
807 { WWT_PUSHTXTBTN, RESIZE_LRTB, COLOUR_WHITE, 215, 315, 215, 226, STR_NETWORK_SERVER_LIST_JOIN_GAME, STR_NULL}, // NGWW_JOIN
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
808 { WWT_PUSHTXTBTN, RESIZE_LRTB, COLOUR_WHITE, 330, 435, 215, 226, STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP}, // NGWW_REFRESH
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
809
12619
2f530108f787 (svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents: 12543
diff changeset
810 { WWT_PUSHTXTBTN, RESIZE_LRTB, COLOUR_WHITE, 330, 435, 197, 208, STR_INTRO_NEWGRF_SETTINGS, STR_NULL}, // NGWW_NEWGRF
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
811
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
812 /* BOTTOM */
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
813 { WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_WHITE, 10, 110, 246, 257, STR_NETWORK_SERVER_LIST_FIND_SERVER, STR_NETWORK_SERVER_LIST_FIND_SERVER_TOOLTIP}, // NGWW_FIND
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
814 { WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_WHITE, 118, 218, 246, 257, STR_NETWORK_SERVER_LIST_ADD_SERVER, STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP}, // NGWW_ADD
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
815 { WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_WHITE, 226, 326, 246, 257, STR_NETWORK_SERVER_LIST_START_SERVER, STR_NETWORK_SERVER_LIST_START_SERVER_TOOLTIP}, // NGWW_START
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
816 { WWT_PUSHTXTBTN, RESIZE_TB, COLOUR_WHITE, 334, 434, 246, 257, STR_BUTTON_CANCEL, STR_NULL}, // NGWW_CANCEL
7343
76fcc58cd6c7 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium <rubidium@openttd.org>
parents: 7341
diff changeset
817
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
818 { WWT_RESIZEBOX, RESIZE_LRTB, COLOUR_LIGHT_BLUE, 438, 449, 252, 263, 0x0, STR_TOOLTIP_RESIZE }, // NGWW_RESIZE
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
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
820 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
821 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
822
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
823 /* Generates incorrect display_flags for widgets NGWW_NAME, and incorrect
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
824 * display_flags and/or left/right side for the overlapping widgets
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
825 * NGWW_CLIENTS through NGWW_YEARS.
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
826 */
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
827 NWidgetPart _nested_network_game_widgets[] = {
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
828 /* TOP */
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
829 NWidget(NWID_HORIZONTAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
830 NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, NGWW_CLOSE),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
831 NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, NGWW_CAPTION), SetMinimalSize(439, 14), SetDataTip(STR_NETWORK_SERVER_LIST_CAPTION, STR_NULL), // XXX Add default caption tooltip!
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
832 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
833 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_MAIN),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
834 NWidget(NWID_SPACER), SetMinimalSize(0, 8), SetResize(1, 0),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
835 NWidget(NWID_HORIZONTAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
836 NWidget(NWID_SPACER), SetMinimalSize(9, 0),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
837 NWidget(NWID_VERTICAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
838 NWidget(NWID_SPACER), SetMinimalSize(0,1), // Text is one pixel further down
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
839 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NGWW_CONNECTION), SetMinimalSize(77, 13), SetDataTip(STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
840 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
841 NWidget(NWID_SPACER), SetMinimalSize(4, 0),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
842 NWidget(NWID_VERTICAL),
11467
e500d1b181c9 (svn r15825) -Codechange: remove the WWT_DROPDOWNIN widget type and replace it with WWT_DROPDOWN.
yexo <yexo@openttd.org>
parents: 11464
diff changeset
843 NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, NGWW_CONN_BTN), SetMinimalSize(92, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
844 SetDataTip(STR_NETWORK_START_SERVER_LAN_INTERNET_COMBO, STR_NETWORK_SERVER_LIST_CONNECTION_TOOLTIP),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
845 NWidget(NWID_SPACER), SetMinimalSize(0,2), // Text ends two pixels further down
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
846 EndContainer(),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
847 NWidget(NWID_SPACER), SetMinimalSize(108, 0), SetFill(true, false), SetResize(1,0),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
848 NWidget(NWID_VERTICAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
849 NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, NGWW_CLIENT), SetMinimalSize(151, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
850 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
851 NWidget(NWID_SPACER), SetMinimalSize(0,2), // Text ends two pixels further down
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
852 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
853 NWidget(NWID_SPACER), SetMinimalSize(9, 0),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
854 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
855 NWidget(NWID_SPACER), SetMinimalSize(0, 6), SetResize(1, 0),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
856 NWidget(NWID_HORIZONTAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
857 /* LEFT SIDE */
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
858 NWidget(NWID_SPACER), SetMinimalSize(10, 0), SetResize(0, 1),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
859 NWidget(NWID_VERTICAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
860 NWidget(NWID_HORIZONTAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
861 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_NAME), SetMinimalSize(61, 12), SetResize(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
862 SetDataTip(STR_NETWORK_SERVER_LIST_GAME_NAME, STR_NETWORK_SERVER_LIST_GAME_NAME_TOOLTIP),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
863 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_CLIENTS), SetMinimalSize(20, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
864 SetDataTip(STR_NETWORK_SERVER_LIST_CLIENTS_CAPTION, STR_NETWORK_SERVER_LIST_CLIENTS_CAPTION_TOOLTIP),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
865 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_MAPSIZE), SetMinimalSize(20, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
866 SetDataTip(STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION, STR_NETWORK_SERVER_LIST_MAP_SIZE_CAPTION_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
867 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_DATE), SetMinimalSize(20, 12), SetDataTip(STR_NETWORK_SERVER_LIST_DATE_CAPTION, STR_NETWORK_SERVER_LIST_DATE_CAPTION_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
868 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_YEARS), SetMinimalSize(20, 12), SetDataTip(STR_NETWORK_SERVER_LIST_YEARS_CAPTION, STR_NETWORK_SERVER_LIST_YEARS_CAPTION_TOOLTIP),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
869 NWidget(NWID_SPACER), SetMinimalSize(0, 0), SetFill(false, false), SetResize(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
870 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_INFO), SetMinimalSize(40, 12), SetDataTip(STR_EMPTY, STR_NETWORK_SERVER_LIST_INFO_ICONS_TOOLTIP),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
871 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
872 NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NGWW_MATRIX), SetMinimalSize(181, 155), SetResize(1,1),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
873 SetDataTip((11 << 8) + 1, STR_NETWORK_SERVER_LIST_CLICK_GAME_TO_SELECT),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
874 NWidget(NWID_SPACER), SetMinimalSize(0, 2), SetResize(1, 0),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
875 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NGWW_LASTJOINED_LABEL), SetMinimalSize(181, 12), SetFill(true, false),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
876 SetDataTip(STR_NETWORK_SERVER_LIST_LAST_JOINED_SERVER, STR_NULL), SetResize(1, 0),
12789
dd7db20331f6 (svn r17271) -Fix: SetFill sometimes used 1/0 when it should be using true/false
rubidium <rubidium@openttd.org>
parents: 12778
diff changeset
877 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_LASTJOINED), SetMinimalSize(181, 14), SetFill(true, false), SetResize(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
878 SetDataTip(0x0, STR_NETWORK_SERVER_LIST_CLICK_TO_SELECT_LAST),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
879 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
880 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
881 NWidget(NWID_VERTICAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
882 NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NGWW_SCROLLBAR), SetMinimalSize(12, 165),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
883 NWidget(NWID_SPACER), SetMinimalSize(0,28),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
884 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
885 NWidget(NWID_SPACER), SetMinimalSize(7, 0), SetResize(0, 1),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
886 /* RIGHT SIDE */
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
887 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NGWW_DETAILS),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
888 NWidget(NWID_SPACER), SetMinimalSize(0, 155), SetResize(0, 1),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
889 NWidget(NWID_HORIZONTAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
890 NWidget(NWID_SPACER), SetMinimalSize(120, 0),
12619
2f530108f787 (svn r17062) -Change: unify the naming of some 125 strings
rubidium <rubidium@openttd.org>
parents: 12543
diff changeset
891 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_NEWGRF), SetMinimalSize(106, 12), SetDataTip(STR_INTRO_NEWGRF_SETTINGS, STR_NULL),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
892 NWidget(NWID_SPACER), SetMinimalSize(5, 0),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
893 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
894 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
895 NWidget(NWID_HORIZONTAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
896 NWidget(NWID_SPACER), SetMinimalSize(5, 0),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
897 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_JOIN), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_SERVER_LIST_JOIN_GAME, STR_NULL),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
898 NWidget(NWID_SPACER), SetMinimalSize(14, 0),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
899 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_REFRESH), SetMinimalSize(106, 12), SetDataTip(STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
900 NWidget(NWID_SPACER), SetMinimalSize(5, 0),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
901 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
902 NWidget(NWID_SPACER), SetMinimalSize(0, 10),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
903 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
904 NWidget(NWID_SPACER), SetMinimalSize(9, 0), SetResize(0, 1),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
905 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
906 NWidget(NWID_SPACER), SetMinimalSize(0, 9), SetResize(1, 0),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
907 /* BOTTOM */
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
908 NWidget(NWID_HORIZONTAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
909 NWidget(NWID_SPACER), SetMinimalSize(10, 0),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
910 NWidget(NWID_VERTICAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
911 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
912 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_FIND), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_SERVER_LIST_FIND_SERVER, STR_NETWORK_SERVER_LIST_FIND_SERVER_TOOLTIP),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
913 NWidget(NWID_SPACER), SetMinimalSize(7, 0),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
914 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_ADD), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_SERVER_LIST_ADD_SERVER, STR_NETWORK_SERVER_LIST_ADD_SERVER_TOOLTIP),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
915 NWidget(NWID_SPACER), SetMinimalSize(7, 0),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
916 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_START), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_SERVER_LIST_START_SERVER, STR_NETWORK_SERVER_LIST_START_SERVER_TOOLTIP),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
917 NWidget(NWID_SPACER), SetMinimalSize(7, 0),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
918 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NGWW_CANCEL), SetMinimalSize(101, 12), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
919 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
920 NWidget(NWID_SPACER), SetMinimalSize(0,6),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
921 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
922 NWidget(NWID_SPACER), SetMinimalSize(3, 0), SetResize(1, 0),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
923 NWidget(NWID_VERTICAL),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
924 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
925 NWidget(WWT_RESIZEBOX, COLOUR_LIGHT_BLUE, NGWW_RESIZE),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
926 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
927 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
928 EndContainer(),
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
929 };
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
930
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
931 static const WindowDesc _network_game_window_desc(
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
932 WDP_CENTER, WDP_CENTER, 450, 264, 780, 264,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5669
diff changeset
933 WC_NETWORK_WINDOW, WC_NONE,
7343
76fcc58cd6c7 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium <rubidium@openttd.org>
parents: 7341
diff changeset
934 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
11462
043d6b6bf604 (svn r15820) -Codechange: Some windows using nested widgets
alberth <alberth@openttd.org>
parents: 11454
diff changeset
935 _network_game_window_widgets, _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
936 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
937
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 5916
diff changeset
938 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
939 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
940 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
941 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
942
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
943 /* 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
944 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
945 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
946 /* 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
947 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
948 NetworkAddServer(*iter);
cf37aec7c469 (svn r15931) -Codechange: let the host and ban lists use of SmallVector.
rubidium <rubidium@openttd.org>
parents: 11551
diff changeset
949 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
950 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
951
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
952 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
953 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
954
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
955 enum {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
956 NSSWND_START = 64,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
957 NSSWND_ROWSIZE = 12
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
958 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
959
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
960 /** 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
961 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
962 NSSW_CLOSE, ///< Close 'X' 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
963 NSSW_CAPTION,
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
964 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
965 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
966 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
967 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
968 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
969 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
970 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
971 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
972 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
973 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
974 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
975 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
976 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
977 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
978 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
979 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
980 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
981 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
982 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
983 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
984 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
985
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
986 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
987 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
988 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
989 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
990 NSSW_CANCEL, ///< 'Cancel' button
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
991 };
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
992
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
993 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
994 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
995 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
996 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
997
9897
5b558ce6cb0e (svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents: 9827
diff changeset
998 NetworkStartServerWindow(const WindowDesc *desc) : QueryStringBaseWindow(NETWORK_NAME_LENGTH, desc)
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
999 {
9897
5b558ce6cb0e (svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents: 9827
diff changeset
1000 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
1001
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
1002 _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
1003 BuildFileList();
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1004 this->vscroll.SetCapacity(12);
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1005 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
1006
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
1007 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
1008 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
1009 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
1010
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1011 this->field = 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
1012
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1013 this->FindWindowPlacementAndResize(desc);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1014 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1015
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
1016 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
1017 {
9441
e899ed594e7c (svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13 <skidd13@openttd.org>
parents: 9428
diff changeset
1018 int y = NSSWND_START;
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
1019 const FiosItem *item;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1020
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
1021 /* draw basic widgets */
9481
cbb53dc04d5b (svn r13433) -Codechange: remove a now useless global variable.
rubidium <rubidium@openttd.org>
parents: 9462
diff changeset
1022 SetDParam(1, _connection_types_dropdown[_settings_client.network.server_advertise]);
9451
49dffcace617 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents: 9441
diff changeset
1023 SetDParam(2, _settings_client.network.max_clients);
49dffcace617 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents: 9441
diff changeset
1024 SetDParam(3, _settings_client.network.max_companies);
49dffcace617 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents: 9441
diff changeset
1025 SetDParam(4, _settings_client.network.max_spectators);
49dffcace617 (svn r13369) -Codechange: remove duplication of network configuration settings between NetworkSettings and NetworkGameInfo.
rubidium <rubidium@openttd.org>
parents: 9441
diff changeset
1026 SetDParam(5, STR_NETWORK_LANG_ANY + _settings_client.network.server_lang);
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
1027 this->DrawWidgets();
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1028
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
1029 /* 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
1030 this->DrawEditBox(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
1031
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1032 /* if password is set, draw red '*' next to 'Set password' button */
11436
caf4456fbbf3 (svn r15794) -Codechange: remove the DoDrawString part of the old text drawing API
rubidium <rubidium@openttd.org>
parents: 11432
diff changeset
1033 if (!StrEmpty(_settings_client.network.server_password)) DrawString(408, this->width - 2, 23, "*", TC_RED);
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1034
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
1035 /* draw list of maps */
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
1036 GfxFillRect(this->widget[NSSW_SELMAP].left + 1, this->widget[NSSW_SELMAP].top + 1, this->widget[NSSW_SELMAP].right - 1, this->widget[NSSW_SELMAP].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
1037
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1038 for (uint pos = this->vscroll.GetPosition(); pos < _fios_items.Length() + 1; pos++) {
9441
e899ed594e7c (svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13 <skidd13@openttd.org>
parents: 9428
diff changeset
1039 item = _fios_items.Get(pos - 1);
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
1040 if (item == this->map || (pos == 0 && this->map == NULL)) {
56ddb993f77d (svn r15822) -Codechange: replace some magic numbers and improve alignment of the start server window.
rubidium <rubidium@openttd.org>
parents: 11462
diff changeset
1041 GfxFillRect(this->widget[NSSW_SELMAP].left + 1, y - 1, this->widget[NSSW_SELMAP].right - 1, y + 10, 155); // show highlighted item with a different colour
56ddb993f77d (svn r15822) -Codechange: replace some magic numbers and improve alignment of the start server window.
rubidium <rubidium@openttd.org>
parents: 11462
diff changeset
1042 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1043
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
1044 if (pos == 0) {
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1045 DrawString(this->widget[NSSW_SELMAP].left + 4, this->widget[NSSW_SELMAP].right - 4, 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
1046 } else {
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
1047 DrawString(this->widget[NSSW_SELMAP].left + 4, this->widget[NSSW_SELMAP].right - 4, 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
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 y += NSSWND_ROWSIZE;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1050
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1051 if (y >= this->vscroll.GetCapacity() * NSSWND_ROWSIZE + NSSWND_START) 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
1052 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1054
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 virtual void OnClick(Point pt, int 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
1056 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1057 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
1058 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
1059 case NSSW_CLOSE: // Close 'X'
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
1061 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
1062 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1063
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
1064 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
1065 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
1066 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
1067 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
1068 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1069
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
1070 case NSSW_SELMAP: { // Select 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
1071 int y = (pt.y - NSSWND_START) / NSSWND_ROWSIZE;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1072
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1073 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
1074 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
1075
9441
e899ed594e7c (svn r13359) -Codechange: convert _fios_items to a SmallVector
skidd13 <skidd13@openttd.org>
parents: 9428
diff changeset
1076 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
1077 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
1078 } 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
1079
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1080 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
1081 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
1082 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
1083
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
1084 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
1085 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
1086 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
1087 /* 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
1088 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
1089 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
1090 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
1091 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
1092 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
1093 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
1094 _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
1095 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
1096 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
1097 _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
1098 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
1099 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
1100 _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
1101 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1102 }
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
1103 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1104 _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
1105 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1106
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
1107 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
1108 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
1109 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
1110 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
1111 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1112
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
1113 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
1114 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
1115 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
1116 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
1117 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1118
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
1119 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
1120 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
1121 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
1122 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
1123 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1124
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
1125 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
1126 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
1127 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
1128 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
1129 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
1130 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1131 }
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
1132 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1133 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
1134 } break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1135
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
1136 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
1137 _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
1138
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
1139 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
1140 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
1141 } else { // load a scenario
11256
f63c1d69ed92 (svn r15605) -Codechange: constify a function
rubidium <rubidium@openttd.org>
parents: 11223
diff changeset
1142 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
1143 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
1144 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
1145 _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
1146 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
1147 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
1148
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 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
1150 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
1151 }
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
1152 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1153 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1154
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 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
1156 _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
1157 /* 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
1158 * 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
1159 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
1160 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
1161 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
1162 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1164
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
1165 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
1166 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
1168 case NSSW_CONNTYPE_BTN:
9481
cbb53dc04d5b (svn r13433) -Codechange: remove a now useless global variable.
rubidium <rubidium@openttd.org>
parents: 9462
diff changeset
1169 _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
1170 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
1171 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
1172 _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
1173 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
1174 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
1175 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
1176 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1177
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
1178 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
1179 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1180
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
1181 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
1182 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1183 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
1184 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1185
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
1186 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
1187 {
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
1188 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
1189 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
1190 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
1191
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
1192 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
1193 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1194
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
1195 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
1196 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
1199 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
1201
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
1202 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
1203 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
1204 } 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
1205 int32 value = atoi(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
1206 this->InvalidateWidget(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
1207 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
1208 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
1209 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
1210 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
1211 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
1212 }
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 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
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 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
1216 }
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
1217 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1218
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1219 static const Widget _network_start_server_window_widgets[] = {
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
1220 /* Window decoration and background panel */
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
1221 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_LIGHT_BLUE, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW }, // NSSW_CLOSE
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1222 { WWT_CAPTION, RESIZE_NONE, COLOUR_LIGHT_BLUE, 11, 419, 0, 13, STR_NETWORK_START_SERVER_CAPTION, STR_NULL}, // NSSW_CAPTION
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
1223 { WWT_PANEL, RESIZE_NONE, COLOUR_LIGHT_BLUE, 0, 419, 14, 243, 0x0, STR_NULL}, // NSSW_BACKGROUND
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1224
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
1225 /* Set game name and password widgets */
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1226 { WWT_TEXT, RESIZE_NONE, COLOUR_LIGHT_BLUE, 10, 90, 22, 34, STR_NETWORK_START_SERVER_NEW_GAME_NAME, STR_NULL}, // NSSW_GAMENAME_LABEL
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1227 { WWT_EDITBOX, RESIZE_NONE, COLOUR_LIGHT_BLUE, 100, 272, 22, 33, STR_NETWORK_START_SERVER_NEW_GAME_NAME_OSKTITLE, STR_NETWORK_START_SERVER_NEW_GAME_NAME_TOOLTIP}, // NSSW_GAMENAME
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1228 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 285, 405, 22, 33, STR_NETWORK_START_SERVER_SET_PASSWORD, STR_NETWORK_START_SERVER_PASSWORD_TOOLTIP}, // NSSW_SETPWD
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1229
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
1230 /* List of playable scenarios */
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1231 { WWT_TEXT, RESIZE_NONE, COLOUR_LIGHT_BLUE, 10, 110, 43, 55, STR_NETWORK_START_SERVER_SELECT_MAP, STR_NULL}, // NSSW_SELECT_MAP_LABEL
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1232 { WWT_INSET, RESIZE_NONE, COLOUR_LIGHT_BLUE, 10, 271, 62, 216, STR_NULL, STR_NETWORK_START_SERVER_SELECT_MAP_TOOLTIP}, // NSSW_SELMAP
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
1233 { WWT_SCROLLBAR, RESIZE_NONE, COLOUR_LIGHT_BLUE, 259, 270, 63, 215, 0x0, STR_TOOLTIP_VSCROLL_BAR_SCROLLS_LIST}, // NSSW_SCROLLBAR
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
1234
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
1235 /* Combo/selection boxes to control Connection Type / Max Clients / Max Companies / Max Observers / Language */
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1236 { WWT_TEXT, RESIZE_NONE, COLOUR_LIGHT_BLUE, 280, 410, 63, 75, STR_NETWORK_SERVER_LIST_CONNECTION, STR_NULL}, // NSSW_CONNTYPE_LABEL
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1237 { WWT_DROPDOWN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 280, 410, 77, 88, STR_NETWORK_START_SERVER_LAN_INTERNET_COMBO, STR_NETWORK_SERVER_LIST_CONNECTION_TOOLTIP}, // NSSW_CONNTYPE_BTN
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
1238
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1239 { WWT_TEXT, RESIZE_NONE, COLOUR_LIGHT_BLUE, 280, 410, 95, 107, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS, STR_NULL}, // NSSW_CLIENTS_LABEL
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1240 { WWT_IMGBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 280, 291, 109, 120, SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP}, // NSSW_CLIENTS_BTND
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1241 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 292, 397, 109, 120, STR_NETWORK_START_SERVER_CLIENTS_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP}, // NSSW_CLIENTS_TXT
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1242 { WWT_IMGBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 398, 410, 109, 120, SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP}, // NSSW_CLIENTS_BTNU
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
1243
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1244 { WWT_TEXT, RESIZE_NONE, COLOUR_LIGHT_BLUE, 280, 410, 127, 139, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES, STR_NULL}, // NSSW_COMPANIES_LABEL
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1245 { WWT_IMGBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 280, 291, 141, 152, SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP}, // NSSW_COMPANIES_BTND
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1246 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 292, 397, 141, 152, STR_NETWORK_START_SERVER_COMPANIES_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP}, // NSSW_COMPANIES_TXT
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1247 { WWT_IMGBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 398, 410, 141, 152, SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP}, // NSSW_COMPANIES_BTNU
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1248
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1249 { WWT_TEXT, RESIZE_NONE, COLOUR_LIGHT_BLUE, 280, 410, 159, 171, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS, STR_NULL}, // NSSW_SPECTATORS_LABEL
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1250 { WWT_IMGBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 280, 291, 173, 184, SPR_ARROW_DOWN, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP}, // NSSW_SPECTATORS_BTND
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1251 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 292, 397, 173, 184, STR_NETWORK_START_SERVER_SPECTATORS_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP}, // NSSW_SPECTATORS_TXT
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1252 { WWT_IMGBTN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 398, 410, 173, 184, SPR_ARROW_UP, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP}, // NSSW_SPECTATORS_BTNU
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
1253
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1254 { WWT_TEXT, RESIZE_NONE, COLOUR_LIGHT_BLUE, 280, 410, 191, 203, STR_NETWORK_START_SERVER_LANGUAGE_SPOKEN, STR_NULL}, // NSSW_LANGUAGE_LABEL
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1255 { WWT_DROPDOWN, RESIZE_NONE, COLOUR_LIGHT_BLUE, 280, 410, 205, 216, STR_NETWORK_START_SERVER_LANGUAGE_COMBO, STR_NETWORK_START_SERVER_LANGUAGE_TOOLTIP}, // NSSW_LANGUAGE_BTN
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
1256
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
1257 /* Buttons Start / Load / Cancel */
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1258 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 40, 140, 224, 235, STR_NETWORK_START_SERVER_START_GAME, STR_NETWORK_START_SERVER_START_GAME_TOOLTIP}, // NSSW_START
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1259 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 150, 250, 224, 235, STR_NETWORK_START_SERVER_LOAD_GAME, STR_NETWORK_START_SERVER_LOAD_GAME_TOOLTIP}, // NSSW_LOAD
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1260 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 260, 360, 224, 235, STR_BUTTON_CANCEL, STR_NULL}, // NSSW_CANCEL
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
1261
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1262 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1263 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1264
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1265 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
1266 NWidget(NWID_HORIZONTAL),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1267 NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, NSSW_CLOSE),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1268 NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, NSSW_CAPTION), SetDataTip(STR_NETWORK_START_SERVER_CAPTION, STR_NULL),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1269 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1270 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NSSW_BACKGROUND),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1271 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
1272 /* Set game name and password widgets. */
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1273 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 14),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1274 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_GAMENAME_LABEL), SetMinimalSize(81, 13), SetDataTip(STR_NETWORK_START_SERVER_NEW_GAME_NAME, STR_NULL),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1275 NWidget(WWT_EDITBOX, COLOUR_LIGHT_BLUE, NSSW_GAMENAME), SetMinimalSize(173, 12), SetPadding(0, 0, 1, 9),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1276 SetDataTip(STR_NETWORK_START_SERVER_NEW_GAME_NAME_OSKTITLE, STR_NETWORK_START_SERVER_NEW_GAME_NAME_TOOLTIP),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1277 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_SETPWD), SetMinimalSize(121, 12), SetPadding(0, 0, 1, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1278 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
1279 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1280 NWidget(NWID_HORIZONTAL), SetPIP(10, 8, 9),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1281 NWidget(NWID_VERTICAL),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1282 /* List of playable scenarios. */
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1283 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
1284 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1285 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_SELECT_MAP_LABEL), SetMinimalSize(101, 13), SetDataTip(STR_NETWORK_START_SERVER_SELECT_MAP, STR_NULL),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1286 NWidget(NWID_SPACER), SetFill(true, false),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1287 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1288 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1289 NWidget(WWT_INSET, COLOUR_LIGHT_BLUE, NSSW_SELMAP), SetDataTip(STR_NULL, STR_NETWORK_START_SERVER_SELECT_MAP_TOOLTIP),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1290 NWidget(NWID_HORIZONTAL),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1291 NWidget(NWID_SPACER), SetMinimalSize(249, 155),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1292 NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NSSW_SCROLLBAR), SetPadding(1, 1, 1, 0),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1293 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1294 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1295 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1296 NWidget(NWID_VERTICAL),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1297 /* Combo/selection boxes to control Connection Type / Max Clients / Max Companies / Max Observers / Language */
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1298 NWidget(NWID_SPACER), SetMinimalSize(0, 28),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1299 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_CONNTYPE_LABEL), SetMinimalSize(131, 13), 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
1300 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
1301 NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, NSSW_CONNTYPE_BTN), SetMinimalSize(131, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1302 SetDataTip(STR_NETWORK_START_SERVER_LAN_INTERNET_COMBO, 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
1303
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1304 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1305 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_LABEL), SetMinimalSize(131, 13), 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
1306 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
1307 NWidget(NWID_HORIZONTAL),
12408
a1c0de97cd50 (svn r16842) -Cleanup: add some spaces around a few operators
rubidium <rubidium@openttd.org>
parents: 11956
diff changeset
1308 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_BTND), SetMinimalSize(12, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1309 SetDataTip(SPR_ARROW_DOWN, 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
1310 NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_TXT), SetMinimalSize(106, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1311 SetDataTip(STR_NETWORK_START_SERVER_CLIENTS_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_CLIENTS_TOOLTIP),
12408
a1c0de97cd50 (svn r16842) -Cleanup: add some spaces around a few operators
rubidium <rubidium@openttd.org>
parents: 11956
diff changeset
1312 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_CLIENTS_BTNU), SetMinimalSize(13, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1313 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
1314 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1315
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1316 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1317 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_LABEL), SetMinimalSize(131, 13), 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
1318 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
1319 NWidget(NWID_HORIZONTAL),
12408
a1c0de97cd50 (svn r16842) -Cleanup: add some spaces around a few operators
rubidium <rubidium@openttd.org>
parents: 11956
diff changeset
1320 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_BTND), SetMinimalSize(12, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1321 SetDataTip(SPR_ARROW_DOWN, 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
1322 NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_TXT), SetMinimalSize(106, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1323 SetDataTip(STR_NETWORK_START_SERVER_COMPANIES_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_COMPANIES_TOOLTIP),
12408
a1c0de97cd50 (svn r16842) -Cleanup: add some spaces around a few operators
rubidium <rubidium@openttd.org>
parents: 11956
diff changeset
1324 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_COMPANIES_BTNU), SetMinimalSize(13, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1325 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
1326 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1327
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1328 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1329 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_LABEL), SetMinimalSize(131, 13), 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
1330 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
1331 NWidget(NWID_HORIZONTAL),
12408
a1c0de97cd50 (svn r16842) -Cleanup: add some spaces around a few operators
rubidium <rubidium@openttd.org>
parents: 11956
diff changeset
1332 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_BTND), SetMinimalSize(12, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1333 SetDataTip(SPR_ARROW_DOWN, 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
1334 NWidget(WWT_PUSHTXTBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_TXT), SetMinimalSize(106, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1335 SetDataTip(STR_NETWORK_START_SERVER_SPECTATORS_SELECT, STR_NETWORK_START_SERVER_NUMBER_OF_SPECTATORS_TOOLTIP),
12408
a1c0de97cd50 (svn r16842) -Cleanup: add some spaces around a few operators
rubidium <rubidium@openttd.org>
parents: 11956
diff changeset
1336 NWidget(WWT_IMGBTN, COLOUR_LIGHT_BLUE, NSSW_SPECTATORS_BTNU), SetMinimalSize(13, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1337 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
1338 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1339
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1340 NWidget(NWID_SPACER), SetMinimalSize(0, 6),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1341 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NSSW_LANGUAGE_LABEL), SetMinimalSize(131, 13), 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
1342 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
1343 NWidget(WWT_DROPDOWN, COLOUR_LIGHT_BLUE, NSSW_LANGUAGE_BTN), SetMinimalSize(131, 12),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1344 SetDataTip(STR_NETWORK_START_SERVER_LANGUAGE_COMBO, 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
1345 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1346 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1347
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1348 /* Buttons Start / Load / Cancel. */
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1349 NWidget(NWID_SPACER), SetMinimalSize(0, 7),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1350 NWidget(NWID_HORIZONTAL), SetPIP(40, 9, 59),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1351 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_START), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_START_SERVER_START_GAME, STR_NETWORK_START_SERVER_START_GAME_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1352 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_LOAD), SetMinimalSize(101, 12), SetDataTip(STR_NETWORK_START_SERVER_LOAD_GAME, STR_NETWORK_START_SERVER_LOAD_GAME_TOOLTIP),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1353 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NSSW_CANCEL), SetMinimalSize(101, 12), 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
1354 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1355 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
1356 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1357 };
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1358
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
1359 static const WindowDesc _network_start_server_window_desc(
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7321
diff changeset
1360 WDP_CENTER, WDP_CENTER, 420, 244, 420, 244,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5669
diff changeset
1361 WC_NETWORK_WINDOW, WC_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
1362 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1363 _network_start_server_window_widgets, _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
1364 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1365
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 5916
diff changeset
1366 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
1367 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1368 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
1369
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
1370 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
1371 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1372
7963
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1373 /** 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
1374 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
1375 NLWW_CLOSE, ///< Close 'X' 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
1376 NLWW_CAPTION, ///< Titlebar
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
1377 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
1378 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
1379 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
1380 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
1381 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
1382 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
1383 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
1384 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
1385 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
1386 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
1387 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
1388 };
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1389
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1390 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
1391 CompanyID company; ///< Select company
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1392 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
1393 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
1394
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1395 NetworkLobbyWindow(const WindowDesc *desc, NetworkGameList *ngl) :
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
1396 Window(desc), company(INVALID_COMPANY), server(ngl)
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1397 {
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1398 this->vscroll.SetCapacity(10);
9178
708347596d9a (svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium <rubidium@openttd.org>
parents: 9177
diff changeset
1399
708347596d9a (svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium <rubidium@openttd.org>
parents: 9177
diff changeset
1400 this->FindWindowPlacementAndResize(desc);
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1401 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1402
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
1403 CompanyID NetworkLobbyFindCompanyIndex(byte pos)
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
1404 {
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
1405 /* 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
1406 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
1407 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
1408 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
1409 }
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
1410 }
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
1411
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
1412 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
1413 }
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
1414
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1415 virtual void OnPaint()
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1416 {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1417 const NetworkGameInfo *gi = &this->server->info;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1418 int y = NET_PRC__OFFSET_TOP_WIDGET_COMPANY, pos;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1419
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
1420 /* 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
1421 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
1422 /* 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
1423 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
1424 /* 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
1425 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
1426
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1427 /* Draw window widgets */
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1428 SetDParamStr(0, gi->server_name);
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
1429 this->DrawWidgets();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1430
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1431 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
1432
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1433 /* Draw company list */
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1434 pos = this->vscroll.GetPosition();
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1435 while (pos < gi->companies_on) {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1436 byte company = NetworkLobbyFindCompanyIndex(pos);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1437 bool income = false;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1438 if (this->company == company) {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1439 GfxFillRect(11, y - 1, 154, y + 10, 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
1440 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1441
11427
4ca1f733c741 (svn r15785) -Codechange: remove the *Truncated part of the old text drawing API.
rubidium <rubidium@openttd.org>
parents: 11426
diff changeset
1442 DrawString(13, 135, y, this->company_info[company].company_name, TC_BLACK);
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
1443 if (this->company_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, 135, y);
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1444
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1445 /* 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
1446 if (this->company_info[company].income >= 0) income = true;
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1447 DrawSprite(SPR_BLOT, income ? PALETTE_TO_GREEN : PALETTE_TO_RED, 145, 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
1448
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1449 pos++;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1450 y += NET_PRC__SIZE_OF_ROW;
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1451 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
1452 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1453
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1454 /* Draw info about selected company when it is selected in the left window */
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1455 GfxFillRect(174, 39, 403, 75, 157);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1456 DrawString(this->widget[NLWW_DETAILS].left + 10, this->widget[NLWW_DETAILS].right - 10, 50, STR_NETWORK_GAME_LOBBY_COMPANY_INFO, TC_FROMSTRING, SA_CENTER);
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
1457 if (this->company != INVALID_COMPANY && !StrEmpty(this->company_info[this->company].company_name)) {
11432
a20dd0000d96 (svn r15790) -Codechange: remove the *Centered part of the old text drawing API.
rubidium <rubidium@openttd.org>
parents: 11430
diff changeset
1458 const uint x = this->widget[NLWW_DETAILS].left + 10;
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1459 y = 80;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1460
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1461 SetDParam(0, gi->clients_on);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1462 SetDParam(1, gi->clients_max);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1463 SetDParam(2, gi->companies_on);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1464 SetDParam(3, gi->companies_max);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1465 DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_SERVER_LIST_CLIENTS);
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1466 y += 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
1467
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
1468 SetDParamStr(0, this->company_info[this->company].company_name);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1469 DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_GAME_LOBBY_COMPANY_NAME);
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1470 y += 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
1471
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
1472 SetDParam(0, this->company_info[this->company].inaugurated_year);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1473 DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_GAME_LOBBY_INAUGURATION_YEAR); // inauguration year
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1474 y += 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
1475
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
1476 SetDParam(0, this->company_info[this->company].company_value);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1477 DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_GAME_LOBBY_VALUE); // company value
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1478 y += 10;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1479
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
1480 SetDParam(0, this->company_info[this->company].money);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1481 DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_GAME_LOBBY_CURRENT_BALANCE); // current balance
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1482 y += 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
1483
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
1484 SetDParam(0, this->company_info[this->company].income);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1485 DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_GAME_LOBBY_LAST_YEARS_INCOME); // last year's income
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1486 y += 10;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1487
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
1488 SetDParam(0, this->company_info[this->company].performance);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1489 DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_GAME_LOBBY_PERFORMANCE); // performance
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1490 y += 10;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1491
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
1492 SetDParam(0, this->company_info[this->company].num_vehicle[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
1493 SetDParam(1, this->company_info[this->company].num_vehicle[1]);
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
1494 SetDParam(2, this->company_info[this->company].num_vehicle[2]);
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
1495 SetDParam(3, this->company_info[this->company].num_vehicle[3]);
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
1496 SetDParam(4, this->company_info[this->company].num_vehicle[4]);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1497 DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_GAME_LOBBY_VEHICLES); // vehicles
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1498 y += 10;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1499
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
1500 SetDParam(0, this->company_info[this->company].num_station[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
1501 SetDParam(1, this->company_info[this->company].num_station[1]);
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
1502 SetDParam(2, this->company_info[this->company].num_station[2]);
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
1503 SetDParam(3, this->company_info[this->company].num_station[3]);
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
1504 SetDParam(4, this->company_info[this->company].num_station[4]);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1505 DrawString(x, this->widget[NLWW_DETAILS].right, y, STR_NETWORK_GAME_LOBBY_STATIONS); // stations
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1506 y += 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
1507
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
1508 SetDParamStr(0, this->company_info[this->company].clients);
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1509 DrawString(x, this->widget[NLWW_DETAILS].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
1510 }
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1511 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1512
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1513 virtual void OnClick(Point pt, int widget)
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1514 {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1515 switch (widget) {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1516 case NLWW_CLOSE: // Close 'X'
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1517 case NLWW_CANCEL: // Cancel button
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1518 ShowNetworkGameWindow();
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1519 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1520
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1521 case NLWW_MATRIX: { // Company list
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1522 uint32 id_v = (pt.y - NET_PRC__OFFSET_TOP_WIDGET_COMPANY) / NET_PRC__SIZE_OF_ROW;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1523
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1524 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
1525
12878
8ad447b80c42 (svn r17370) -Codechange: make the saveload and network GUIs use the scrollbar wrappers
rubidium <rubidium@openttd.org>
parents: 12789
diff changeset
1526 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
1527 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
1528 this->SetDirty();
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1529 } break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1530
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1531 case NLWW_JOIN: // Join company
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1532 /* 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
1533 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
1534 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1535
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1536 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
1537 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
1538 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1539
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1540 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
1541 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
1542 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1543
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1544 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
1545 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
1546 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
1547 /* 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
1548 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
1549 break;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1550 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1551 }
10049
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
1552
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
1553 virtual void OnDoubleClick(Point pt, int widget)
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
1554 {
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
1555 if (widget == NLWW_MATRIX) {
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
1556 /* is the Join button enabled? */
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
1557 if (!this->IsWidgetDisabled(NLWW_JOIN)) this->OnClick(pt, NLWW_JOIN);
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
1558 }
78cd320f0fc9 (svn r14209) -Feature(tte): doubleclick to join selected server/company
smatz <smatz@openttd.org>
parents: 9898
diff changeset
1559 }
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1560 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1561
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1562 static const Widget _network_lobby_window_widgets[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11682
diff changeset
1563 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_LIGHT_BLUE, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW }, // NLWW_CLOSE
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1564 { WWT_CAPTION, RESIZE_NONE, COLOUR_LIGHT_BLUE, 11, 419, 0, 13, STR_NETWORK_GAME_LOBBY_CAPTION, STR_NULL}, // NLWW_CAPTION
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
1565 { WWT_PANEL, RESIZE_NONE, COLOUR_LIGHT_BLUE, 0, 419, 14, 234, 0x0, STR_NULL}, // NLWW_BACKGROUND
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1566 { WWT_TEXT, RESIZE_NONE, COLOUR_LIGHT_BLUE, 10, 419, 22, 34, STR_NETWORK_GAME_LOBBY_PREPARE_TO_JOIN, STR_NULL}, // NLWW_TEXT
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1567
7963
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1568 /* company list */
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
1569 { WWT_PANEL, RESIZE_NONE, COLOUR_WHITE, 10, 155, 38, 49, 0x0, STR_NULL}, // NLWW_HEADER
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1570 { WWT_MATRIX, RESIZE_NONE, COLOUR_LIGHT_BLUE, 10, 155, 50, 190, (10 << 8) + 1, STR_NETWORK_GAME_LOBBY_COMPANY_LIST_TOOLTIP}, // NLWW_MATRIX
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
1571 { WWT_SCROLLBAR, RESIZE_NONE, COLOUR_LIGHT_BLUE, 156, 167, 38, 190, 0x0, STR_TOOLTIP_VSCROLL_BAR_SCROLLS_LIST}, // NLWW_SCROLLBAR
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1572
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
1573 /* company info */
9827
ebe07a67945e (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas <belugas@openttd.org>
parents: 9770
diff changeset
1574 { WWT_PANEL, RESIZE_NONE, COLOUR_LIGHT_BLUE, 173, 404, 38, 190, 0x0, STR_NULL}, // NLWW_DETAILS
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1575
7963
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1576 /* buttons */
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1577 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 10, 151, 200, 211, STR_NETWORK_GAME_LOBBY_JOIN_COMPANY, STR_NETWORK_GAME_LOBBY_JOIN_COMPANY_TOOLTIP}, // NLWW_JOIN
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1578 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 10, 151, 215, 226, STR_NETWORK_GAME_LOBBY_NEW_COMPANY, STR_NETWORK_GAME_LOBBY_NEW_COMPANY_TOOLTIP}, // NLWW_NEW
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1579 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 158, 268, 200, 211, STR_NETWORK_GAME_LOBBY_SPECTATE_GAME, STR_NETWORK_GAME_LOBBY_SPECTATE_GAME_TOOLTIP}, // NLWW_SPECTATE
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1580 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 158, 268, 215, 226, STR_NETWORK_SERVER_LIST_REFRESH, STR_NETWORK_SERVER_LIST_REFRESH_TOOLTIP}, // NLWW_REFRESH
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1581 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 278, 388, 200, 211, STR_BUTTON_CANCEL, STR_NULL}, // NLWW_CANCEL
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1582
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1583 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1584 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1585
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1586 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
1587 NWidget(NWID_HORIZONTAL),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1588 NWidget(WWT_CLOSEBOX, COLOUR_LIGHT_BLUE, NLWW_CLOSE),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1589 NWidget(WWT_CAPTION, COLOUR_LIGHT_BLUE, NLWW_CAPTION), SetDataTip(STR_NETWORK_GAME_LOBBY_CAPTION, STR_NULL),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1590 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1591 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NLWW_BACKGROUND),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1592 NWidget(WWT_TEXT, COLOUR_LIGHT_BLUE, NLWW_TEXT), SetDataTip(STR_NETWORK_GAME_LOBBY_PREPARE_TO_JOIN, STR_NULL), SetMinimalSize(410, 13), SetPadding(8, 0, 0, 10),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1593 NWidget(NWID_SPACER), SetMinimalSize(0, 3),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1594 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 15),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1595 /* Company list. */
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1596 NWidget(NWID_VERTICAL),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1597 NWidget(WWT_PANEL, COLOUR_WHITE, NLWW_HEADER), SetMinimalSize(146, 12), SetFill(false, false), EndContainer(),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1598 NWidget(WWT_MATRIX, COLOUR_LIGHT_BLUE, NLWW_MATRIX), SetMinimalSize(146, 141), SetDataTip((10 << 8) + 1, 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
1599 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1600 NWidget(WWT_SCROLLBAR, COLOUR_LIGHT_BLUE, NLWW_SCROLLBAR),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1601 NWidget(NWID_SPACER), SetMinimalSize(5, 0),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1602 /* Company info. */
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1603 NWidget(WWT_PANEL, COLOUR_LIGHT_BLUE, NLWW_DETAILS), SetMinimalSize(232, 153), SetFill(false, false), EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1604 EndContainer(),
12408
a1c0de97cd50 (svn r16842) -Cleanup: add some spaces around a few operators
rubidium <rubidium@openttd.org>
parents: 11956
diff changeset
1605 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
1606 /* Buttons. */
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1607 NWidget(NWID_HORIZONTAL), SetPIP(10, 0, 31),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1608 NWidget(NWID_VERTICAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1609 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_JOIN), SetMinimalSize(142, 12), SetDataTip(STR_NETWORK_GAME_LOBBY_JOIN_COMPANY, STR_NETWORK_GAME_LOBBY_JOIN_COMPANY_TOOLTIP),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1610 NWidget(NWID_SPACER), SetMinimalSize(0, 3),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1611 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_NEW), SetMinimalSize(142, 12), 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
1612 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1613 NWidget(NWID_VERTICAL), SetPadding(0, 0, 0, 6),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1614 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_SPECTATE), SetMinimalSize(111, 12), SetDataTip(STR_NETWORK_GAME_LOBBY_SPECTATE_GAME, STR_NETWORK_GAME_LOBBY_SPECTATE_GAME_TOOLTIP),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1615 NWidget(NWID_SPACER), SetMinimalSize(0, 3),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1616 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_REFRESH), SetMinimalSize(111, 12), 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
1617 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1618 NWidget(NWID_VERTICAL), SetPadding(0, 0, 0, 9),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1619 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NLWW_CANCEL), SetMinimalSize(111, 12), SetDataTip(STR_BUTTON_CANCEL, STR_NULL),
12408
a1c0de97cd50 (svn r16842) -Cleanup: add some spaces around a few operators
rubidium <rubidium@openttd.org>
parents: 11956
diff changeset
1620 NWidget(NWID_SPACER), SetMinimalSize(0, 15),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1621 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1622 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1623 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
1624 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1625 };
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1626
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
1627 static const WindowDesc _network_lobby_window_desc(
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7321
diff changeset
1628 WDP_CENTER, WDP_CENTER, 420, 235, 420, 235,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5669
diff changeset
1629 WC_NETWORK_WINDOW, WC_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
1630 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1631 _network_lobby_window_widgets, _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
1632 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1633
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1634 /* 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
1635 * @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
1636 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
1637 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1638 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
1639
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
1640 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
1641 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
1642
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1643 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
1644 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1645
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
1646 /**
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
1647 * 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
1648 * @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
1649 * @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
1650 */
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
1651 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
1652 {
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
1653 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
1654 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
1655 }
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
1656
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
1657 /* 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
1658 * 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
1659 * 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
1660
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
1661 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
1662
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
1663 /* 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
1664 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
1665
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
1666 /* Max 10 actions per client */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1667 #define MAX_CLIENTLIST_ACTION 10
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1668
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1669 enum {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1670 CLNWND_OFFSET = 16,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1671 CLNWND_ROWSIZE = 10
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1672 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1673
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
1674 /** Widget numbers of the client list window. */
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
1675 enum ClientListWidgets {
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
1676 CLW_CLOSE,
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
1677 CLW_CAPTION,
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
1678 CLW_STICKY,
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
1679 CLW_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
1680 };
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
1681
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1682 static const Widget _client_list_widgets[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11682
diff changeset
1683 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW},
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1684 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 237, 0, 13, STR_NETWORK_COMPANY_LIST_CLIENT_LIST, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS},
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1685 { WWT_STICKYBOX, RESIZE_NONE, COLOUR_GREY, 238, 249, 0, 13, STR_NULL, STR_TOOLTIP_STICKY},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1686
9827
ebe07a67945e (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas <belugas@openttd.org>
parents: 9770
diff changeset
1687 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 249, 14, 14 + CLNWND_ROWSIZE + 1, 0x0, STR_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
1688 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1689 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1690
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1691 static const NWidgetPart _nested_client_list_widgets[] = {
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1692 NWidget(NWID_HORIZONTAL),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1693 NWidget(WWT_CLOSEBOX, COLOUR_GREY, CLW_CLOSE),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
1694 NWidget(WWT_CAPTION, COLOUR_GREY, CLW_CAPTION), SetDataTip(STR_NETWORK_COMPANY_LIST_CLIENT_LIST, 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
1695 NWidget(WWT_STICKYBOX, COLOUR_GREY, CLW_STICKY),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1696 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1697 NWidget(WWT_PANEL, COLOUR_GREY, CLW_PANEL), SetMinimalSize(250, CLNWND_ROWSIZE + 2), EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1698 };
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1699
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1700 static const Widget _client_list_popup_widgets[] = {
9827
ebe07a67945e (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas <belugas@openttd.org>
parents: 9770
diff changeset
1701 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 99, 0, 0, 0, STR_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
1702 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1703 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1704
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1705 static const NWidgetPart _nested_client_list_popup_widgets[] = {
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1706 NWidget(WWT_PANEL, COLOUR_GREY, 0), SetMinimalSize(100, 1), EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1707 };
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1708
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
1709 static const WindowDesc _client_list_desc(
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7321
diff changeset
1710 WDP_AUTO, WDP_AUTO, 250, 1, 250, 1,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5669
diff changeset
1711 WC_CLIENT_LIST, WC_NONE,
7029
ce8b6783be37 (svn r10293) -Add [FS#885]: a sticky button for the client list window (oxygene)
truelight <truelight@openttd.org>
parents: 7002
diff changeset
1712 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
11861
83bb9f5543fc (svn r16255) -Fix [FS#2887] (r16237): Nested widgets of client list window used incorrect length.
alberth <alberth@openttd.org>
parents: 11860
diff changeset
1713 _client_list_widgets, _nested_client_list_widgets, lengthof(_nested_client_list_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
1714 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1715
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
1716 /* 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
1717 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
1718 {
11578
494219bd4418 (svn r15947) -Codechange: replace uint32 client_ip with NetworkAddress client_address.
rubidium <rubidium@openttd.org>
parents: 11565
diff changeset
1719 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
1720
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
1721 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
1722 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
1723 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
1724 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1725
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1726 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
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
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
1729 /* 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
1730 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
1731 {
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
1732 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
1733
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
1734 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
1735
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
1736 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
1737 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1738
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1739 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
1740 {
11578
494219bd4418 (svn r15947) -Codechange: replace uint32 client_ip with NetworkAddress client_address.
rubidium <rubidium@openttd.org>
parents: 11565
diff changeset
1741 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
1742
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
1743 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
1744
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
1745 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
1746 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1747
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1748 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
1749 {
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1750 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
1751 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
1752 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1753 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1754
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1755 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
1756 {
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1757 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
1758 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
1759 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1760 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1761
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1762 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
1763 {
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1764 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
1765 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
1766 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1767 }
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 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
1770 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1771 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
1772 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1773
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_None(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 {
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1776 /* No action ;) */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1777 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1778
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1779
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1780
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1781 struct NetworkClientListPopupWindow : Window {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1782 int sel_index;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1783 int client_no;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1784 char action[MAX_CLIENTLIST_ACTION][50];
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1785 ClientList_Action_Proc *proc[MAX_CLIENTLIST_ACTION];
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1786
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1787 NetworkClientListPopupWindow(int x, int y, const Widget *widgets, int client_no) :
9301
686aa69d2fcd (svn r13169) -Codechange: remove a (now) unneeded parameter of one of the Window constructors.
rubidium <rubidium@openttd.org>
parents: 9285
diff changeset
1788 Window(x, y, 150, 100, WC_TOOLBAR_MENU, widgets),
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1789 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
1790 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1791 /*
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1792 * Fill the actions this client has.
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1793 * Watch is, max 50 chars long!
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1794 */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1795
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1796 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
1797
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1798 int i = 0;
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
1799 if (_network_own_client_id != ci->client_id) {
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1800 GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_CLIENT, lastof(this->action[i]));
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1801 this->proc[i++] = &ClientList_SpeakToClient;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1802 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1803
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11888
diff changeset
1804 if (Company::IsValidID(ci->client_playas) || ci->client_playas == COMPANY_SPECTATOR) {
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1805 GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_COMPANY, lastof(this->action[i]));
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1806 this->proc[i++] = &ClientList_SpeakToCompany;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1807 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1808 GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_ALL, lastof(this->action[i]));
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1809 this->proc[i++] = &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
1810
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
1811 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
1812 /* 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
1813 if (Company::IsValidID(_local_company) && Company::IsValidID(ci->client_playas) && _settings_game.economy.give_money) {
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1814 GetString(this->action[i], STR_NETWORK_CLIENTLIST_GIVE_MONEY, lastof(this->action[i]));
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1815 this->proc[i++] = &ClientList_GiveMoney;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1816 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1817 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1818
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1819 /* 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
1820 if (_network_server && _network_own_client_id != ci->client_id) {
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1821 GetString(this->action[i], STR_NETWORK_CLIENTLIST_KICK, lastof(this->action[i]));
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1822 this->proc[i++] = &ClientList_Kick;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1823
10301
2dc5b1b8f525 (svn r14542) -Codechange: replace some sprintf with s[en]printf to make sure they will not overflow their buffers.
rubidium <rubidium@openttd.org>
parents: 10295
diff changeset
1824 seprintf(this->action[i], lastof(this->action[i]), "Ban"); // XXX GetString?
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1825 this->proc[i++] = &ClientList_Ban;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1826 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1827
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1828 if (i == 0) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1829 GetString(this->action[i], STR_NETWORK_CLIENTLIST_NONE, lastof(this->action[i]));
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1830 this->proc[i++] = &ClientList_None;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1831 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1832
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1833 /* Calculate the height */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1834 int h = ClientListPopupHeight();
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1835
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1836 /* Allocate the popup */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1837 this->widget[0].bottom = this->widget[0].top + h;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1838 this->widget[0].right = this->widget[0].left + 150;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1839
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1840 this->flags4 &= ~WF_WHITE_BORDER_MASK;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1841
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1842 this->FindWindowPlacementAndResize(150, h + 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
1843 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1844
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1845 /**
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1846 * An action is clicked! What do we do?
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1847 */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1848 void HandleClientListPopupClick(byte index)
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1849 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1850 /* A click on the Popup of the ClientList.. handle the command */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1851 if (index < MAX_CLIENTLIST_ACTION && this->proc[index] != NULL) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1852 this->proc[index](this->client_no);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1853 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1854 }
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1855
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1856 /**
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1857 * Finds the amount of actions in the popup 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
1858 */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1859 uint ClientListPopupHeight()
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1860 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1861 int num = 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
1862
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
1863 /* Find the amount of actions */
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1864 for (int i = 0; i < MAX_CLIENTLIST_ACTION; i++) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1865 if (this->action[i][0] == '\0') continue;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1866 if (this->proc[i] == NULL) continue;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1867 num++;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1868 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1869
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1870 num *= CLNWND_ROWSIZE;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1871
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1872 return num + 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
1873 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1874
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1875
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1876 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
1877 {
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
1878 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
1879
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1880 /* Draw the actions */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1881 int sel = this->sel_index;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1882 int y = 1;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1883 for (int i = 0; i < MAX_CLIENTLIST_ACTION; i++, y += CLNWND_ROWSIZE) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1884 if (this->action[i][0] == '\0') continue;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1885 if (this->proc[i] == NULL) continue;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1886
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1887 TextColour colour;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1888 if (sel-- == 0) { // Selected item, highlight it
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1889 GfxFillRect(1, y, 150 - 2, y + CLNWND_ROWSIZE - 1, 0);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1890 colour = TC_WHITE;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1891 } else {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1892 colour = TC_BLACK;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1893 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1894
11436
caf4456fbbf3 (svn r15794) -Codechange: remove the DoDrawString part of the old text drawing API
rubidium <rubidium@openttd.org>
parents: 11432
diff changeset
1895 DrawString(4, this->width - 4, y, this->action[i], colour);
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1896 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1897 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1898
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1899 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
1900 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1901 /* We selected an action */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1902 int index = (_cursor.pos.y - this->top) / CLNWND_ROWSIZE;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1903
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1904 if (_left_button_down) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1905 if (index == -1 || index == this->sel_index) return;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1906
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1907 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
1908 this->SetDirty();
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1909 } else {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1910 if (index >= 0 && _cursor.pos.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
1911 HandleClientListPopupClick(index);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1912 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1913
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1914 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
1915 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1916 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1917 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1918
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1919 /**
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1920 * 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
1921 */
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1922 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
1923 {
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1924 static Widget *generated_client_list_popup_widgets = NULL;
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1925
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1926 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
1927
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1928 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
1929
11888
e9b0ac8343f1 (svn r16288) -Fix (r16237): crash after clicking in the ClientList window
smatz <smatz@openttd.org>
parents: 11861
diff changeset
1930 const Widget *wid = InitializeWidgetArrayFromNestedWidgets(
e9b0ac8343f1 (svn r16288) -Fix (r16237): crash after clicking in the ClientList window
smatz <smatz@openttd.org>
parents: 11861
diff changeset
1931 _nested_client_list_popup_widgets, lengthof(_nested_client_list_popup_widgets),
e9b0ac8343f1 (svn r16288) -Fix (r16237): crash after clicking in the ClientList window
smatz <smatz@openttd.org>
parents: 11861
diff changeset
1932 _client_list_popup_widgets, &generated_client_list_popup_widgets
e9b0ac8343f1 (svn r16288) -Fix (r16237): crash after clicking in the ClientList window
smatz <smatz@openttd.org>
parents: 11861
diff changeset
1933 );
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1934
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
1935 new NetworkClientListPopupWindow(x, y, wid, 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
1936 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1937
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1938 /**
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1939 * Main handle for clientlist
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1940 */
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1941 struct NetworkClientListWindow : Window
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1942 {
10473
38aa7533364f (svn r14728) -Fix [FS#2470]: don't select anything when opening the client list.
rubidium <rubidium@openttd.org>
parents: 10467
diff changeset
1943 int selected_item;
38aa7533364f (svn r14728) -Fix [FS#2470]: don't select anything when opening the client list.
rubidium <rubidium@openttd.org>
parents: 10467
diff changeset
1944 int selected_y;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
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 NetworkClientListWindow(const WindowDesc *desc, WindowNumber window_number) :
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1947 Window(desc, window_number),
10473
38aa7533364f (svn r14728) -Fix [FS#2470]: don't select anything when opening the client list.
rubidium <rubidium@openttd.org>
parents: 10467
diff changeset
1948 selected_item(-1),
38aa7533364f (svn r14728) -Fix [FS#2470]: don't select anything when opening the client list.
rubidium <rubidium@openttd.org>
parents: 10467
diff changeset
1949 selected_y(0)
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1950 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1951 this->FindWindowPlacementAndResize(desc);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1952 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1953
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1954 /**
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1955 * 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
1956 */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1957 bool CheckClientListHeight()
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1958 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1959 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
1960 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
1961
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1962 /* 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
1963 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
1964 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
1965 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1966
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1967 num *= CLNWND_ROWSIZE;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1968
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1969 /* If height is changed */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1970 if (this->height != CLNWND_OFFSET + num + 1) {
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
1971 /* XXX - magic unfortunately; (num + 2) has to be one bigger than heigh (num + 1) */
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1972 this->SetDirty();
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1973 this->widget[3].bottom = this->widget[3].top + num + 2;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1974 this->height = CLNWND_OFFSET + num + 1;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1975 this->SetDirty();
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1976 return false;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1977 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1978 return true;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1979 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1980
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1981 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
1982 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1983 NetworkClientInfo *ci;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1984 int i = 0;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1985
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1986 /* 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
1987 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
1988
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
1989 this->DrawWidgets();
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1990
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1991 int y = CLNWND_OFFSET;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1992
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
1993 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
1994 TextColour colour;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1995 if (this->selected_item == i++) { // Selected item, highlight it
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1996 GfxFillRect(1, y, 248, y + CLNWND_ROWSIZE - 1, 0);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1997 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
1998 } else {
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1999 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
2000 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2001
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
2002 if (ci->client_id == CLIENT_ID_SERVER) {
11454
9bfb4cdd8e22 (svn r15812) -Codechange: use the new DrawString API in another set of GUIs
rubidium <rubidium@openttd.org>
parents: 11436
diff changeset
2003 DrawString(4, 81, 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
2004 } else {
11454
9bfb4cdd8e22 (svn r15812) -Codechange: use the new DrawString API in another set of GUIs
rubidium <rubidium@openttd.org>
parents: 11436
diff changeset
2005 DrawString(4, 81, 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
2006 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2007
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2008 /* Filter out spectators */
11924
fccc9cea27a7 (svn r16327) -Codechange: replace IsValidPoolItemID(index) by PoolItem::IsValidID(index)
smatz <smatz@openttd.org>
parents: 11888
diff changeset
2009 if (Company::IsValidID(ci->client_playas)) DrawCompanyIcon(ci->client_playas, 64, y + 1);
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2010
11436
caf4456fbbf3 (svn r15794) -Codechange: remove the DoDrawString part of the old text drawing API
rubidium <rubidium@openttd.org>
parents: 11432
diff changeset
2011 DrawString(81, this->width - 2, 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
2012
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2013 y += CLNWND_ROWSIZE;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2014 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2015 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2016
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2017 virtual void OnClick(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
2018 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2019 /* 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
2020 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
2021 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
2022 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2023 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2024
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2025 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
2026 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2027 /* -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
2028 if (pt.y == -1) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2029 this->selected_y = 0;
10473
38aa7533364f (svn r14728) -Fix [FS#2470]: don't select anything when opening the client list.
rubidium <rubidium@openttd.org>
parents: 10467
diff changeset
2030 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
2031 this->SetDirty();
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2032 return;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2033 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2034 /* It did not change.. no update! */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2035 if (pt.y == this->selected_y) return;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2036
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2037 /* Find the new selected item (if any) */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2038 this->selected_y = pt.y;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2039 if (pt.y > CLNWND_OFFSET) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2040 this->selected_item = (pt.y - CLNWND_OFFSET) / CLNWND_ROWSIZE;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2041 } else {
10473
38aa7533364f (svn r14728) -Fix [FS#2470]: don't select anything when opening the client list.
rubidium <rubidium@openttd.org>
parents: 10467
diff changeset
2042 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
2043 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2044
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2045 /* Repaint */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2046 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
2047 }
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2048 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2049
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 5916
diff changeset
2050 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
2051 {
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
2052 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
2053 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2054
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2055
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2056 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
2057
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2058
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2059 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
2060 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2061 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
2062
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2063 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
2064 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
2065 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
2066 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
2067 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
2068 }
10145
dbe302da93a8 (svn r14331) -Codechange: use an enum as additional parameter for ShowQueryString()
smatz <smatz@openttd.org>
parents: 10061
diff changeset
2069 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
2070 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2071
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
2072 /* 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
2073 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
2074 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
2075 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
2076 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
2077
11430
c1e93c7799b6 (svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents: 11427
diff changeset
2078 /** 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
2079 enum NetworkJoinStatusWidgets {
c1e93c7799b6 (svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents: 11427
diff changeset
2080 NJSW_CAPTION, ///< Caption of the window
c1e93c7799b6 (svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents: 11427
diff changeset
2081 NJSW_BACKGROUND, ///< Background
c1e93c7799b6 (svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents: 11427
diff changeset
2082 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
2083 };
c1e93c7799b6 (svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents: 11427
diff changeset
2084
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2085 struct NetworkJoinStatusWindow : Window {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2086 NetworkJoinStatusWindow(const WindowDesc *desc) : Window(desc)
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2087 {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2088 this->parent = FindWindowById(WC_NETWORK_WINDOW, 0);
10827
72c4b7e010b8 (svn r15162) -Fix: the join status window didn't get properly created
rubidium <rubidium@openttd.org>
parents: 10822
diff changeset
2089 this->FindWindowPlacementAndResize(desc);
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2090 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2091
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2092 virtual void OnPaint()
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2093 {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2094 uint8 progress; // used for progress bar
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
2095 this->DrawWidgets();
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2096
11772
f9d1c79376bc (svn r16162) -Codechange: remove needless TC_ colours from DrawString when they are part of strings and add some colours to a few strings.
rubidium <rubidium@openttd.org>
parents: 11730
diff changeset
2097 DrawString(this->widget[NJSW_BACKGROUND].left + 2, this->widget[NJSW_BACKGROUND].right - 2, 35, 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
2098 switch (_network_join_status) {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2099 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
2100 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
2101 progress = 10; // first two stages 10%
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2102 break;
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2103 case NETWORK_JOIN_STATUS_WAITING:
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2104 SetDParam(0, _network_join_waiting);
11772
f9d1c79376bc (svn r16162) -Codechange: remove needless TC_ colours from DrawString when they are part of strings and add some colours to a few strings.
rubidium <rubidium@openttd.org>
parents: 11730
diff changeset
2105 DrawString(this->widget[NJSW_BACKGROUND].left + 2, this->widget[NJSW_BACKGROUND].right - 2, 46, 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
2106 progress = 15; // third stage is 15%
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2107 break;
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2108 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
2109 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
2110 SetDParam(1, _network_join_bytes_total);
11772
f9d1c79376bc (svn r16162) -Codechange: remove needless TC_ colours from DrawString when they are part of strings and add some colours to a few strings.
rubidium <rubidium@openttd.org>
parents: 11730
diff changeset
2111 DrawString(this->widget[NJSW_BACKGROUND].left + 2, this->widget[NJSW_BACKGROUND].right - 2, 46, 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
2112 /* 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
2113 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
2114 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
2115 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2116
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2117 /* Draw nice progress bar :) */
9770
9f72f4a2aee0 (svn r13907) -Codechange: Replace a number with Colours enum on DrawFrameRect usage
belugas <belugas@openttd.org>
parents: 9690
diff changeset
2118 DrawFrameRect(20, 18, (int)((this->width - 20) * progress / 100), 28, COLOUR_MAUVE, FR_NONE);
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2119 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2120
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2121 virtual void OnClick(Point pt, int widget)
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2122 {
11430
c1e93c7799b6 (svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents: 11427
diff changeset
2123 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
2124 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
2125 SwitchToMode(SM_MENU);
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2126 ShowNetworkGameWindow();
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2127 }
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2128 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2129
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2130 virtual void OnQueryTextFinished(char *str)
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2131 {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2132 if (StrEmpty(str)) {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2133 NetworkDisconnect();
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2134 ShowNetworkGameWindow();
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2135 } else {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2136 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
2137 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2138 }
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
2139 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2140
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2141 static const Widget _network_join_status_window_widget[] = {
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2142 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 0, 249, 0, 13, STR_NETWORK_CONNECTING_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS}, // NJSW_CAPTION
11430
c1e93c7799b6 (svn r15788) -Codechange: enumify the network join status widgets and use them.
rubidium <rubidium@openttd.org>
parents: 11427
diff changeset
2143 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 249, 14, 84, 0x0, STR_NULL}, // NJSW_BACKGROUND
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2144 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_WHITE, 75, 175, 69, 80, STR_NETWORK_CONNECTION_DISCONNECT, STR_NULL}, // NJSW_CANCELOK
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2145 { WIDGETS_END},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2146 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2147
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2148 static const NWidgetPart _nested_network_join_status_window_widgets[] = {
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2149 NWidget(WWT_CAPTION, COLOUR_GREY, NJSW_CAPTION), SetDataTip(STR_NETWORK_CONNECTING_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
2150 NWidget(WWT_PANEL, COLOUR_GREY, NJSW_BACKGROUND),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2151 NWidget(WWT_PUSHTXTBTN, COLOUR_WHITE, NJSW_CANCELOK), SetMinimalSize(101, 12), SetPadding(55, 74, 4, 75), SetDataTip(STR_NETWORK_CONNECTION_DISCONNECT, STR_NULL),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2152 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2153 };
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2154
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
2155 static const WindowDesc _network_join_status_window_desc(
7341
549c757023fc (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium <rubidium@openttd.org>
parents: 7321
diff changeset
2156 WDP_CENTER, WDP_CENTER, 250, 85, 250, 85,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5669
diff changeset
2157 WC_NETWORK_STATUS_WINDOW, WC_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
2158 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL,
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2159 _network_join_status_window_widget, _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
2160 );
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2161
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 5916
diff changeset
2162 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
2163 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2164 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
2165 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
2166 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2167
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2168
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2169 /** 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
2170 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
2171 NCPWW_CLOSE, ///< Close 'X' button
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2172 NCPWW_CAPTION, ///< Caption of the whole window
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2173 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
2174 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
2175 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
2176 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
2177 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
2178 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
2179 };
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2180
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
2181 struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
9897
5b558ce6cb0e (svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents: 9827
diff changeset
2182 NetworkCompanyPasswordWindow(const WindowDesc *desc, Window *parent) : QueryStringBaseWindow(lengthof(_settings_client.network.default_company_pass), desc)
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
2183 {
9241
8299dc138e1c (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx <glx@openttd.org>
parents: 9182
diff changeset
2184 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
2185 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
2186 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
2187 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
2188
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
2189 this->FindWindowPlacementAndResize(desc);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
2190 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
2191
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
2192 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
2193 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
2194 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
2195 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
2196 }
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2197
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
2198 /* empty password is a '*' because of console argument */
9897
5b558ce6cb0e (svn r14046) -Codechange: make the size of querystring "widgets" more configurable.
rubidium <rubidium@openttd.org>
parents: 9827
diff changeset
2199 if (StrEmpty(this->edit_str_buf)) snprintf(this->edit_str_buf, this->edit_str_size, "*");
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
2200 char *password = this->edit_str_buf;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
2201 NetworkChangeCompanyPassword(1, &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
2202 }
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2203
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
2204 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
2205 {
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
2206 this->DrawWidgets();
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
2207 this->DrawEditBox(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
2208 }
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2209
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
2210 virtual void OnClick(Point pt, int 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
2211 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
2212 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
2213 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
2214 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
2215
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
2216 /* 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
2217 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
2218 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
2219 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
2220
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
2221 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
2222 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
2223 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
2224 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
2225 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
2226 }
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2227
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
2228 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
2229 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
2230 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
2231 }
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
2232
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
2233 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
2234 {
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
2235 EventState state = ES_NOT_HANDLED;
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
2236 switch (this->HandleEditBoxKey(4, 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
2237 default: break;
7ebf43f7c36b (svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
glx <glx@openttd.org>
parents: 10292
diff changeset
2238
7ebf43f7c36b (svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
glx <glx@openttd.org>
parents: 10292
diff changeset
2239 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
2240 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
2241 /* 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
2242
10295
7ebf43f7c36b (svn r14534) -Codechange [FS#2382]: Enumify magic return values of HandleEditBox function (Zuu)
glx <glx@openttd.org>
parents: 10292
diff changeset
2243 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
2244 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
2245 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
2246 }
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
2247 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
2248 }
10547
0b7be1ee92c5 (svn r14804) -Codechange: unify opening the OSK (Zuu)
rubidium <rubidium@openttd.org>
parents: 10480
diff changeset
2249
0b7be1ee92c5 (svn r14804) -Codechange: unify opening the OSK (Zuu)
rubidium <rubidium@openttd.org>
parents: 10480
diff changeset
2250 virtual void OnOpenOSKWindow(int wid)
0b7be1ee92c5 (svn r14804) -Codechange: unify opening the OSK (Zuu)
rubidium <rubidium@openttd.org>
parents: 10480
diff changeset
2251 {
0b7be1ee92c5 (svn r14804) -Codechange: unify opening the OSK (Zuu)
rubidium <rubidium@openttd.org>
parents: 10480
diff changeset
2252 ShowOnScreenKeyboard(this, wid, NCPWW_CANCEL, NCPWW_OK);
0b7be1ee92c5 (svn r14804) -Codechange: unify opening the OSK (Zuu)
rubidium <rubidium@openttd.org>
parents: 10480
diff changeset
2253 }
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
2254 };
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2255
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2256 static const Widget _ncp_window_widgets[] = {
11730
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11682
diff changeset
2257 { WWT_CLOSEBOX, RESIZE_NONE, COLOUR_GREY, 0, 10, 0, 13, STR_BLACK_CROSS, STR_TOOLTIP_CLOSE_WINDOW},
a39da1e4c1f5 (svn r16118) -Change/cleanup: remove the hexadecimal 'in TTD the string had this ID' from 'some' strings and replace the string name with something more sensible.
rubidium <rubidium@openttd.org>
parents: 11682
diff changeset
2258 { WWT_CAPTION, RESIZE_NONE, COLOUR_GREY, 11, 299, 0, 13, STR_COMPANY_PASSWORD_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS},
9827
ebe07a67945e (svn r13970) -Codechange: Replace numbers with Colours enum on network, toolbar and dropdown guis.
belugas <belugas@openttd.org>
parents: 9770
diff changeset
2259 { WWT_PANEL, RESIZE_NONE, COLOUR_GREY, 0, 299, 14, 50, 0x0, STR_NULL},
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2260 { WWT_TEXT, RESIZE_NONE, COLOUR_GREY, 5, 100, 19, 30, STR_COMPANY_VIEW_PASSWORD, STR_NULL},
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2261 { WWT_EDITBOX, RESIZE_NONE, COLOUR_GREY, 101, 294, 19, 30, STR_COMPANY_VIEW_SET_PASSWORD, STR_NULL},
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2262 { WWT_TEXTBTN, RESIZE_NONE, COLOUR_GREY, 101, 294, 35, 46, STR_COMPANY_PASSWORD_MAKE_DEFAULT, STR_COMPANY_PASSWORD_MAKE_DEFAULT_TOOLTIP},
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2263 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 0, 149, 51, 62, STR_BUTTON_CANCEL, STR_COMPANY_PASSWORD_CANCEL},
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2264 { WWT_PUSHTXTBTN, RESIZE_NONE, COLOUR_GREY, 150, 299, 51, 62, STR_BUTTON_OK, STR_COMPANY_PASSWORD_OK},
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2265 { WIDGETS_END},
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2266 };
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2267
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2268 static const NWidgetPart _nested_ncp_window_widgets[] = {
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2269 NWidget(NWID_HORIZONTAL),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2270 NWidget(WWT_CLOSEBOX, COLOUR_GREY, NCPWW_CLOSE),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2271 NWidget(WWT_CAPTION, COLOUR_GREY, NCPWW_CAPTION), SetDataTip(STR_COMPANY_PASSWORD_CAPTION, STR_TOOLTIP_WINDOW_TITLE_DRAG_THIS),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2272 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2273 NWidget(WWT_PANEL, COLOUR_GREY, NCPWW_BACKGROUND),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2274 NWidget(NWID_SPACER), SetMinimalSize(0, 5),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2275 NWidget(NWID_HORIZONTAL), SetPIP(5, 0, 5),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2276 NWidget(NWID_VERTICAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2277 NWidget(WWT_TEXT, COLOUR_GREY, NCPWW_LABEL), SetMinimalSize(96, 12), SetDataTip(STR_COMPANY_VIEW_PASSWORD, STR_NULL),
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2278 NWidget(NWID_SPACER), SetFill(false, true),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2279 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2280 NWidget(NWID_VERTICAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2281 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
2282 NWidget(NWID_SPACER), SetMinimalSize(0, 4),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2283 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
2284 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
2285 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2286 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2287 NWidget(NWID_SPACER), SetMinimalSize(0, 4),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2288 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2289 NWidget(NWID_HORIZONTAL),
12632
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2290 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, NCPWW_CANCEL), SetMinimalSize(150, 12), SetDataTip(STR_BUTTON_CANCEL, STR_COMPANY_PASSWORD_CANCEL),
e41943276802 (svn r17075) -Codechange: rename ~750 strings to be more uniform with their relatives
rubidium <rubidium@openttd.org>
parents: 12619
diff changeset
2291 NWidget(WWT_PUSHTXTBTN, COLOUR_GREY, NCPWW_OK), SetMinimalSize(150, 12), 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
2292 EndContainer(),
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2293 };
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2294
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
2295 static const WindowDesc _ncp_window_desc(
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 WDP_AUTO, WDP_AUTO, 300, 63, 300, 63,
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2297 WC_COMPANY_PASSWORD_WINDOW, WC_NONE,
8019
9e262ce81acf (svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas <belugas@openttd.org>
parents: 8018
diff changeset
2298 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
11847
add0648f33b0 (svn r16237) -Codechange: Add nested widgets to remaining network windows.
alberth <alberth@openttd.org>
parents: 11846
diff changeset
2299 _ncp_window_widgets, _nested_ncp_window_widgets, lengthof(_nested_ncp_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
2300 );
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2301
9241
8299dc138e1c (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx <glx@openttd.org>
parents: 9182
diff changeset
2302 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
2303 {
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2304 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
2305
9241
8299dc138e1c (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx <glx@openttd.org>
parents: 9182
diff changeset
2306 new NetworkCompanyPasswordWindow(&_ncp_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
2307 }
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2308
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2309 #endif /* ENABLE_NETWORK */