annotate src/network/network_gui.cpp @ 9365:5a3d3513930c draft

(svn r13266) -Codechange: Use SmallVector in GUIList
author peter1138 <peter1138@openttd.org>
date Mon, 26 May 2008 16:23:23 +0000 (2008-05-26)
parents 2b0c6e62535e
children 63db12fa3721
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
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
3 /** @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
4
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
5 #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
6 #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
7 #include "../openttd.h"
8114
2d6af5d7a142 (svn r11675) -Codechange: split the string types from the string functions.
rubidium <rubidium@openttd.org>
parents: 8107
diff changeset
8 #include "../strings_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
9 #include "network.h"
8140
fb8a05d579da (svn r11702) -Codechange: move all date related stuff to date*.
rubidium <rubidium@openttd.org>
parents: 8131
diff changeset
10 #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
11 #include "../fios.h"
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
12 #include "network_data.h"
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 "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
14 #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
15 #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
16 #include "../gui.h"
8107
f65cf2bc3255 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents: 8106
diff changeset
17 #include "../window_gui.h"
f65cf2bc3255 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium <rubidium@openttd.org>
parents: 8106
diff changeset
18 #include "../textbuf_gui.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 "../variables.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_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
21 #include "network_udp.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 "../town.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 "../newgrf.h"
8131
e300ac8001ae (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium <rubidium@openttd.org>
parents: 8130
diff changeset
24 #include "../functions.h"
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"
8213
87c85bb42d6f (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium <rubidium@openttd.org>
parents: 8208
diff changeset
26 #include "../core/alloc_func.hpp"
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
27 #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
28 #include "../gfx_func.h"
8254
7d580c9c41fb (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium <rubidium@openttd.org>
parents: 8224
diff changeset
29 #include "../player_func.h"
8270
5613b863190d (svn r11834) -Codechange: only include settings_type.h if needed.
rubidium <rubidium@openttd.org>
parents: 8264
diff changeset
30 #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
31 #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
32 #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
33 #include "../sortlist_type.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
34
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
35 #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
36 #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
37
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
38 #define BGC 5
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
39 #define BTC 15
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
40
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
41 /* Global to remember sorting after window has been closed */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
42 static Listing _ng_sorting;
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 bool _chat_tab_completion_active;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
45
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 5916
diff changeset
46 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
47 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
48 extern void SwitchMode(int new_mode);
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 _connection_types_dropdown[] = {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
51 STR_NETWORK_LAN_INTERNET,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
52 STR_NETWORK_INTERNET_ADVERTISE,
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
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
56 static const StringID _lan_internet_types_dropdown[] = {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
57 STR_NETWORK_LAN,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
58 STR_NETWORK_INTERNET,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
59 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
60 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
61
6796
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
62 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
63
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
64 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
65 {
6796
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
66 /* Init the strings */
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
67 if (_language_dropdown[0] == STR_NULL) {
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
68 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
69 _language_dropdown[NETLANG_COUNT] = INVALID_STRING_ID;
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
70 }
6793
30657c4af0fb (svn r10032) -Add: sort the strings in server language dropdown
glx <glx@openttd.org>
parents: 6780
diff changeset
71
6796
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
72 /* Sort the strings (we don't move 'any' and the 'invalid' one) */
fe8894bfa8ab (svn r10035) -Change: simplified network language string sorting
glx <glx@openttd.org>
parents: 6793
diff changeset
73 qsort(&_language_dropdown[1], NETLANG_COUNT - 1, sizeof(StringID), &StringIDSorter);
6793
30657c4af0fb (svn r10032) -Add: sort the strings in server language dropdown
glx <glx@openttd.org>
parents: 6780
diff changeset
74 }
6780
05ca25dd9fa4 (svn r10017) -Add (FS#790): more languages flags for servers
glx <glx@openttd.org>
parents: 6531
diff changeset
75
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
76 enum {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
77 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
78 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
79 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
80 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
81
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
82 /** 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
83 * 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
84 * @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
85 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
86 {
9165
74f7b3aef71a (svn r13028) -Codechange: WE_MESSAGE and WE_INVALIDATE_DATA were doing the same thing.
rubidium <rubidium@openttd.org>
parents: 9164
diff changeset
87 InvalidateWindowData(WC_NETWORK_WINDOW, 0, unselect);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
88 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
89
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
90 static bool _internal_sort_order; // Used for Qsort order-flipping
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
91 typedef int CDECL NGameNameSortFunction(const void*, const void*);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
92
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
93 /** Qsort function to sort by name. */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
94 static int CDECL NGameNameSorter(const void *a, const void *b)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
95 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
96 const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
97 const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
98 int r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
99
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
100 return _internal_sort_order ? -r : r;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
101 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
102
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
103 /** Qsort function to sort by the amount of clients online on a
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
104 * server. If the two servers have the same amount, the one with the
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
105 * higher maximum is preferred. */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
106 static int CDECL NGameClientSorter(const void *a, const void *b)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
107 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
108 const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
109 const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
110 /* Reverse as per default we are interested in most-clients first */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
111 int r = cmp1->info.clients_on - cmp2->info.clients_on;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
112
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
113 if (r == 0) r = cmp1->info.clients_max - cmp2->info.clients_max;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
114 if (r == 0) r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
115
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
116 return _internal_sort_order ? -r : r;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
117 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
118
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
119 /** Qsort function to sort by joinability. If both servers are the
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
120 * same, prefer the non-passworded server first. */
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
121 static int CDECL NGameAllowedSorter(const void *a, const void *b)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
122 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
123 const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
124 const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
5658
407aa599bd6f (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium <rubidium@openttd.org>
parents: 5609
diff changeset
125
407aa599bd6f (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium <rubidium@openttd.org>
parents: 5609
diff changeset
126 /* The servers we do not know anything about (the ones that did not reply) should be at the bottom) */
407aa599bd6f (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium <rubidium@openttd.org>
parents: 5609
diff changeset
127 int r = StrEmpty(cmp1->info.server_revision) - StrEmpty(cmp2->info.server_revision);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
128
5658
407aa599bd6f (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium <rubidium@openttd.org>
parents: 5609
diff changeset
129 /* Reverse default as we are interested in version-compatible clients first */
407aa599bd6f (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium <rubidium@openttd.org>
parents: 5609
diff changeset
130 if (r == 0) r = cmp2->info.version_compatible - cmp1->info.version_compatible;
407aa599bd6f (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium <rubidium@openttd.org>
parents: 5609
diff changeset
131 /* The version-compatible ones are then sorted with NewGRF compatible first, incompatible last */
407aa599bd6f (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium <rubidium@openttd.org>
parents: 5609
diff changeset
132 if (r == 0) r = cmp2->info.compatible - cmp1->info.compatible;
407aa599bd6f (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium <rubidium@openttd.org>
parents: 5609
diff changeset
133 /* Passworded servers should be below unpassworded servers */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
134 if (r == 0) r = cmp1->info.use_password - cmp2->info.use_password;
5658
407aa599bd6f (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium <rubidium@openttd.org>
parents: 5609
diff changeset
135 /* Finally sort on the name of the server */
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
136 if (r == 0) r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
137
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
138 return _internal_sort_order ? -r : r;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
139 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
140
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
141 /** 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
142 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
143 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
144 NGWW_CAPTION, ///< Caption of the window
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
145 NGWW_RESIZE, ///< Resize button
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
146
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
147 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
148 NGWW_CONN_BTN, ///< 'Connection' droplist 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
149 NGWW_PLAYER, ///< Panel with editbox to set player name
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
150
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
151 NGWW_NAME, ///< 'Name' button
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
152 NGWW_CLIENTS, ///< 'Clients' button
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
153 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
154
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
155 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
156 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
157
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
158 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
159 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
160
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
161 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
162 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
163 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
164 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
165
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
166 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
167 NGWW_ADD, ///< 'Add server' button
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
168 NGWW_START, ///< 'Start server' button
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
169 NGWW_CANCEL, ///< 'Cancel' button
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
170 };
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
171
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
172 typedef GUIList<NetworkGameList*> GUIGameServerList;
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
173
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
174 struct NetworkGameWindow : 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
175 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
176 NetworkGameList *server; ///< selected server
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
177 GUIGameServerList servers; ///< list with game servers.
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
178
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
179 NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(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
180 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
181 ttd_strlcpy(this->edit_str_buf, _network_player_name, lengthof(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
182 this->afilter = CS_ALPHANUMERAL;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
183 InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 120);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
184
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
185 UpdateNetworkGameWindow(true);
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
186
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
187 this->vscroll.cap = 11;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
188 this->resize.step_height = 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
189
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
190 this->field = NGWW_PLAYER;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
191 this->server = NULL;
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
192
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
193 this->servers.flags = VL_REBUILD | (_ng_sorting.order ? VL_DESC : VL_NONE);
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
194 this->servers.sort_type = _ng_sorting.criteria;
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
195
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
196 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
197 }
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
198
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
199 ~NetworkGameWindow()
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
200 {
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
201 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
202
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
203 /**
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
204 * (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
205 * 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
206 */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
207 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
208 {
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
209 if (!(this->servers.flags & VL_REBUILD)) 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
210
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
211 /* 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
212 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
213
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
214 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
215 *this->servers.Append() = ngl;
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
216 }
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
217
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
218 this->servers.Compact();
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
219
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
220 /* Force resort */
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
221 this->servers.flags &= ~VL_REBUILD;
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
222 this->servers.flags |= VL_RESORT;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
224
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
225 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
226 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 static NGameNameSortFunction * const ngame_sorter[] = {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
228 &NGameNameSorter,
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
229 &NGameClientSorter,
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
230 &NGameAllowedSorter
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
231 };
7343
76fcc58cd6c7 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium <rubidium@openttd.org>
parents: 7341
diff changeset
232
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
233 NetworkGameList *item;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
234 uint 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
235
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
236 if (!(this->servers.flags & VL_RESORT)) return;
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
237 if (this->servers.Length() == 0) 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
238
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
239 _internal_sort_order = !!(this->servers.flags & VL_DESC);
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
240 qsort(this->servers.Begin(), this->servers.Length(), sizeof(this->servers.Begin()), ngame_sorter[this->servers.sort_type]);
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 /* 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
243 * into the original list. Basically nothing has changed, we are only
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 * shuffling the ->next pointers */
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
245 _network_game_list = this->servers[0];
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
246 for (item = _network_game_list, i = 1; i != this->servers.Length(); i++) {
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
247 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
248 item = item->next;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
251
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
252 this->servers.flags &= ~VL_RESORT;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
253 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
254
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
255 /**
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
256 * 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
257 * @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
258 * @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
259 * @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
260 */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
261 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
262 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
263 /* 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
264 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
265
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
266 SetDParamStr(0, cur_item->info.server_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
267 DrawStringTruncated(this->widget[NGWW_NAME].left + 5, y, STR_02BD, TC_BLACK, this->widget[NGWW_NAME].right - this->widget[NGWW_NAME].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
268
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 SetDParam(0, cur_item->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
270 SetDParam(1, cur_item->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
271 SetDParam(2, cur_item->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
272 SetDParam(3, cur_item->info.companies_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
273 DrawStringCentered(this->widget[NGWW_CLIENTS].left + 39, y, STR_NETWORK_GENERAL_ONLINE, TC_GOLD);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
274
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
275 /* only draw icons if the server is 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
276 if (cur_item->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
277 /* 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
278 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
279
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
280 /* 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
281 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
282
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
283 /* 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
284 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
285 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
286 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
289 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 const NetworkGameList *sel = this->server;
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
291 const SortButtonState arrow = (this->servers.flags & VL_DESC) ? 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
292
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
293 if (this->servers.flags & VL_REBUILD) {
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 this->BuildNetworkGameList();
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
295 SetVScrollCount(this, this->servers.Length());
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
296 }
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
297 if (this->servers.flags & VL_RESORT) 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
298
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
299 /* '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
300 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
301 /* '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
302 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
303 !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
304 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
305 !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
306
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
307 /* '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
308 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
309 !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
310 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
311
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
312 SetDParam(0, 0x00);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
313 SetDParam(1, _lan_internet_types_dropdown[_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
314 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
315
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
316 /* Edit box to set player 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
317 this->DrawEditBox(NGWW_PLAYER);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
318
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
319 DrawString(this->widget[NGWW_PLAYER].left - 100, 23, STR_NETWORK_PLAYER_NAME, TC_GOLD);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
320
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
321 /* Sort based on widgets: name, clients, compatibility */
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
322 switch (this->servers.sort_type) {
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
323 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
324 case NGWW_CLIENTS - NGWW_NAME: this->DrawSortButtonState(NGWW_CLIENTS, 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
325 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
326 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
327
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
328 uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 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
329 int32 n = 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
330 int32 pos = this->vscroll.pos;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
331 const NetworkGameList *cur_item = _network_game_list;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
332
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
333 while (pos > 0 && cur_item != 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
334 pos--;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
335 cur_item = cur_item->next;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
336 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
337
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
338 while (cur_item != 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
339 this->DrawServerLine(cur_item, y, cur_item == sel);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
340
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
341 cur_item = cur_item->next;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
342 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
343 if (++n == this->vscroll.cap) break; // max number of games in the window
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
344 }
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
345
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
346 const NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_network_last_host), _network_last_port);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
347 /* Draw the last joined server, if any */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
348 if (last_joined != NULL) this->DrawServerLine(last_joined, y = this->widget[NGWW_LASTJOINED].top + 3, 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
349
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
350 /* 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
351 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
352 if (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
353 DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 58, STR_NETWORK_GAME_INFO, TC_FROMSTRING);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
354 } else if (!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
355 SetDParamStr(0, sel->info.server_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
356 DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 68, STR_ORANGE, TC_FROMSTRING); // 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
357
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
358 DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 132, STR_NETWORK_SERVER_OFFLINE, TC_FROMSTRING); // 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
359 } 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
360 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
361 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
362
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
363 DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 48, STR_NETWORK_GAME_INFO, TC_FROMSTRING);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
364
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
365
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 SetDParamStr(0, sel->info.server_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
367 DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_ORANGE, TC_BLACK); // 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
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 SetDParamStr(0, sel->info.map_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
370 DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_02BD, TC_BLACK); // 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
371
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
373 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
374 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
375 SetDParam(3, sel->info.companies_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
376 DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
378
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 DrawString(x, y, STR_NETWORK_LANGUAGE, TC_GOLD); // 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
381 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
382
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
383 SetDParam(0, STR_TEMPERATE_LANDSCAPE + sel->info.map_set);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
384 DrawString(x, y, STR_NETWORK_TILESET, TC_GOLD); // tileset
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
386
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
387 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
388 SetDParam(1, sel->info.map_height);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
389 DrawString(x, y, STR_NETWORK_MAP_SIZE, TC_GOLD); // map size
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
390 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
391
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
392 SetDParamStr(0, sel->info.server_revision);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
393 DrawString(x, y, STR_NETWORK_SERVER_VERSION, TC_GOLD); // server version
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
394 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
395
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
396 SetDParamStr(0, sel->info.hostname);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
397 SetDParam(1, sel->port);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
398 DrawString(x, y, STR_NETWORK_SERVER_ADDRESS, TC_GOLD); // server address
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
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 SetDParam(0, sel->info.start_date);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
402 DrawString(x, y, STR_NETWORK_START_DATE, TC_GOLD); // start date
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
403 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
404
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
405 SetDParam(0, sel->info.game_date);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
406 DrawString(x, y, STR_NETWORK_CURRENT_DATE, TC_GOLD); // current date
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
407 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
408
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
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 if (!sel->info.compatible) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
412 DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, sel->info.version_compatible ? STR_NETWORK_GRF_MISMATCH : STR_NETWORK_VERSION_MISMATCH, TC_FROMSTRING); // server mismatch
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
413 } else if (sel->info.clients_on == 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
414 /* Show: server full, when clients_on == 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
415 DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_SERVER_FULL, TC_FROMSTRING); // 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
416 } else if (sel->info.use_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
417 DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_PASSWORD, TC_FROMSTRING); // 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
418 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
419
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
420 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
421 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
425 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
426 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
427 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
428 case NGWW_PLAYER:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
429 ShowOnScreenKeyboard(this, NGWW_PLAYER, 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
430 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
431
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
433 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
434 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
435
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 case NGWW_CONN_BTN: // 'Connection' droplist
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
437 ShowDropDownMenu(this, _lan_internet_types_dropdown, _network_lan_internet, NGWW_CONN_BTN, 0, 0); // do it for widget NSSW_CONN_BTN
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
439
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 case NGWW_NAME: // Sort by 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
441 case NGWW_CLIENTS: // Sort by connected 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
442 case NGWW_INFO: // Connectivity (green dot)
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
443 if (this->servers.sort_type == widget - NGWW_NAME) this->servers.flags ^= VL_DESC;
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
444 this->servers.flags |= VL_RESORT;
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
445 this->servers.sort_type = widget - NGWW_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
446
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
447 _ng_sorting.order = !!(this->servers.flags & VL_DESC);
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
448 _ng_sorting.criteria = this->servers.sort_type;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
450 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
451
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
452 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
453 NetworkGameList *cur_item;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
454 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
455
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
456 if (id_v >= this->vscroll.cap) return; // click out of bounds
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 id_v += this->vscroll.pos;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
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 cur_item = _network_game_list;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
460 for (; id_v > 0 && cur_item != NULL; id_v--) cur_item = cur_item->next;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
462 this->server = cur_item;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
464 } 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
465
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
466 case NGWW_LASTJOINED: {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_network_last_host), _network_last_port);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
468 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
469 this->server = last_joined;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
470 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
471 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
472 } 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
473
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 case NGWW_FIND: // Find server automatically
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
475 switch (_network_lan_internet) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
476 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
477 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
478 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
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 case NGWW_ADD: // Add a 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
482 ShowQueryString(
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 BindCString(_network_default_ip),
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 STR_NETWORK_ENTER_IP,
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 31 | 0x1000, // maximum number of characters OR
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 250, // characters up to this width pixels, whichever is satisfied first
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 this, CS_ALPHANUMERAL);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
489
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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_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
491 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
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
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
494 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
495 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
496 snprintf(_network_last_host, sizeof(_network_last_host), "%s", inet_ntoa(*(struct in_addr *)&this->server->ip));
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
497 _network_last_port = this->server->port;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
498 ShowNetworkLobbyWindow(this->server);
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
499 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
500 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
501
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
502 case NGWW_REFRESH: // Refresh
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
503 if (this->server != NULL) NetworkUDPQueryServer(this->server->info.hostname, this->server->port);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
504 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
505
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
506 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
507 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
508 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
509 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
513 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
515 case NGWW_CONN_BTN:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
516 _network_lan_internet = 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
517 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
518
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
519 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
520 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
521 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
524 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
525
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
527 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
528 if (this->field == NGWW_PLAYER) this->HandleEditBox(NGWW_PLAYER);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
529 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
530
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
531 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
532 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
533 if (data != 0) this->server = NULL;
9182
d3a153aa328d (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium <rubidium@openttd.org>
parents: 9181
diff changeset
534 this->servers.flags |= VL_REBUILD;
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
535 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
536 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
537
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
538 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
539 {
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
540 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
541 if (this->field != NGWW_PLAYER) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
543 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
544 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
545 NetworkRebuildHostList();
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 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
547 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
548 }
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
549 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
550 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
551
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
552 if (this->HandleEditBoxKey(NGWW_PLAYER, keycode, key, state) == 1) return state; // enter pressed
7343
76fcc58cd6c7 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium <rubidium@openttd.org>
parents: 7341
diff changeset
553
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
554 /* The name is only allowed when it starts with a letter! */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 if (StrEmpty(this->edit_str_buf) && this->edit_str_buf[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
556 ttd_strlcpy(_network_player_name, this->edit_str_buf, lengthof(_network_player_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
557 } 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
558 ttd_strlcpy(_network_player_name, "Player", lengthof(_network_player_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
559 }
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
560 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
561 }
7343
76fcc58cd6c7 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium <rubidium@openttd.org>
parents: 7341
diff changeset
562
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
563 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
564 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 if (!StrEmpty(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
566 NetworkAddServer(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
567 NetworkRebuildHostList();
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
570
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 virtual void OnResize(Point new_size, Point delta)
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
572 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 this->vscroll.cap += delta.y / (int)this->resize.step_height;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
575 this->widget[NGWW_MATRIX].data = (this->vscroll.cap << 8) + 1;
7343
76fcc58cd6c7 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium <rubidium@openttd.org>
parents: 7341
diff changeset
576
9365
5a3d3513930c (svn r13266) -Codechange: Use SmallVector in GUIList
peter1138 <peter1138@openttd.org>
parents: 9354
diff changeset
577 SetVScrollCount(this, this->servers.Length());
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
578
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
579 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
580 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
581
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
582 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
583 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
584 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
585 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
586 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
587 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
588 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
589 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
591
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
592 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
593 /* TOP */
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
594 { WWT_CLOSEBOX, RESIZE_NONE, BGC, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW}, // NGWW_CLOSE
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
595 { WWT_CAPTION, RESIZE_RIGHT, BGC, 11, 449, 0, 13, STR_NETWORK_MULTIPLAYER, STR_NULL}, // NGWW_CAPTION
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
596 { WWT_PANEL, RESIZE_RB, BGC, 0, 449, 14, 263, 0x0, STR_NULL}, // 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
597
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
598 { WWT_TEXT, RESIZE_NONE, BGC, 9, 85, 23, 35, STR_NETWORK_CONNECTION, STR_NULL}, // NGWW_CONNECTION
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
599 { WWT_DROPDOWNIN, RESIZE_NONE, BGC, 90, 181, 22, 33, STR_NETWORK_LAN_INTERNET_COMBO, STR_NETWORK_CONNECTION_TIP}, // 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
600
8737
b62e473a9029 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium <rubidium@openttd.org>
parents: 8728
diff changeset
601 { WWT_EDITBOX, RESIZE_LR, BGC, 290, 440, 22, 33, STR_NETWORK_PLAYER_NAME_OSKTITLE, STR_NETWORK_ENTER_NAME_TIP}, // NGWW_PLAYER
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
602
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
603 /* LEFT SIDE */
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
604 { WWT_PUSHTXTBTN, RESIZE_RIGHT, BTC, 10, 70, 42, 53, STR_NETWORK_GAME_NAME, STR_NETWORK_GAME_NAME_TIP}, // NGWW_NAME
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
605 { WWT_PUSHTXTBTN, RESIZE_LR, BTC, 71, 150, 42, 53, STR_NETWORK_CLIENTS_CAPTION, STR_NETWORK_CLIENTS_CAPTION_TIP}, // NGWW_CLIENTS
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
606 { WWT_PUSHTXTBTN, RESIZE_LR, BTC, 151, 190, 42, 53, STR_EMPTY, STR_NETWORK_INFO_ICONS_TIP}, // 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
607
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
608 { WWT_MATRIX, RESIZE_RB, BGC, 10, 190, 54, 208, (11 << 8) + 1, STR_NETWORK_CLICK_GAME_TO_SELECT}, // NGWW_MATRIX
f031c91c0cdc (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium <rubidium@openttd.org>
parents: 8931
diff changeset
609 { WWT_SCROLLBAR, RESIZE_LRB, BGC, 191, 202, 42, 208, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST}, // NGWW_SCROLLBAR
f031c91c0cdc (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium <rubidium@openttd.org>
parents: 8931
diff changeset
610 { WWT_TEXT, RESIZE_RTB, BGC, 10, 190, 211, 222, STR_NETWORK_LAST_JOINED_SERVER, STR_NULL}, // NGWW_LASTJOINED_LABEL
f031c91c0cdc (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium <rubidium@openttd.org>
parents: 8931
diff changeset
611 { WWT_PANEL, RESIZE_RTB, BGC, 10, 190, 223, 236, 0x0, STR_NETWORK_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
612
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
613 /* RIGHT SIDE */
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
614 { WWT_PANEL, RESIZE_LRB, BGC, 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
615
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
616 { WWT_PUSHTXTBTN, RESIZE_LRTB, BTC, 215, 315, 215, 226, STR_NETWORK_JOIN_GAME, STR_NULL}, // NGWW_JOIN
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
617 { WWT_PUSHTXTBTN, RESIZE_LRTB, BTC, 330, 435, 215, 226, STR_NETWORK_REFRESH, STR_NETWORK_REFRESH_TIP}, // 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
618
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
619 { WWT_PUSHTXTBTN, RESIZE_LRTB, BTC, 330, 435, 197, 208, STR_NEWGRF_SETTINGS_BUTTON, 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
620
7960
d91d1077e1ce (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7959
diff changeset
621 /* BOTTOM */
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
622 { WWT_PUSHTXTBTN, RESIZE_TB, BTC, 10, 110, 246, 257, STR_NETWORK_FIND_SERVER, STR_NETWORK_FIND_SERVER_TIP}, // NGWW_FIND
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
623 { WWT_PUSHTXTBTN, RESIZE_TB, BTC, 118, 218, 246, 257, STR_NETWORK_ADD_SERVER, STR_NETWORK_ADD_SERVER_TIP}, // NGWW_ADD
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
624 { WWT_PUSHTXTBTN, RESIZE_TB, BTC, 226, 326, 246, 257, STR_NETWORK_START_SERVER, STR_NETWORK_START_SERVER_TIP}, // NGWW_START
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
625 { WWT_PUSHTXTBTN, RESIZE_TB, BTC, 334, 434, 246, 257, STR_012E_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
626
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
627 { WWT_RESIZEBOX, RESIZE_LRTB, BGC, 438, 449, 252, 263, 0x0, STR_RESIZE_BUTTON },
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
628
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
629 { 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
630 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
631
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
632 static const WindowDesc _network_game_window_desc = {
7343
76fcc58cd6c7 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium <rubidium@openttd.org>
parents: 7341
diff changeset
633 WDP_CENTER, WDP_CENTER, 450, 264, 550, 264,
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5669
diff changeset
634 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
635 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
636 _network_game_window_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
637 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
638
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 5916
diff changeset
639 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
640 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
641 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
642 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
643
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
644 /* 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
645 if (first) {
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
646 char * const *srv;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
647
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
648 first = false;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
649 // add all servers from the config file to our list
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
650 for (srv = &_network_host_list[0]; srv != endof(_network_host_list) && *srv != NULL; srv++) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
651 NetworkAddServer(*srv);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
652 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
653
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
654 _ng_sorting.criteria = 2; // sort default by collectivity (green-dots on top)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
655 _ng_sorting.order = 0; // sort ascending by default
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
656 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
657
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
658 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
659 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
660
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
661 enum {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
662 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
663 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
664 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
665
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
666 /** 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
667 enum NetworkStartServerWidgets {
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
668 NSSW_CLOSE = 0, ///< Close 'X' button
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
669 NSSW_GAMENAME = 4, ///< Background for editbox to set game name
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
670 NSSW_SETPWD = 5, ///< 'Set password' button
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
671 NSSW_SELMAP = 7, ///< 'Select map' list
8343
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
672 NSSW_CONNTYPE_BTN = 10, ///< 'Connection type' droplist button
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
673 NSSW_CLIENTS_BTND = 12, ///< 'Max clients' downarrow
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
674 NSSW_CLIENTS_TXT = 13, ///< 'Max clients' text
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
675 NSSW_CLIENTS_BTNU = 14, ///< 'Max clients' uparrow
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
676 NSSW_COMPANIES_BTND = 16, ///< 'Max companies' downarrow
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
677 NSSW_COMPANIES_TXT = 17, ///< 'Max companies' text
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
678 NSSW_COMPANIES_BTNU = 18, ///< 'Max companies' uparrow
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
679 NSSW_SPECTATORS_BTND = 20, ///< 'Max spectators' downarrow
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
680 NSSW_SPECTATORS_TXT = 21, ///< 'Max spectators' text
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
681 NSSW_SPECTATORS_BTNU = 22, ///< 'Max spectators' uparrow
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
682 NSSW_LANGUAGE_BTN = 24, ///< 'Language spoken' droplist button
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
683 NSSW_START = 25, ///< 'Start' button
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
684 NSSW_LOAD = 26, ///< 'Load' button
8ee8a732be4e (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138 <peter1138@openttd.org>
parents: 8284
diff changeset
685 NSSW_CANCEL = 27, ///< 'Cancel' button
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
686 };
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
687
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
688 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
689 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
690 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
691 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
692
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 NetworkStartServerWindow(const WindowDesc *desc) : QueryStringBaseWindow(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
694 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 ttd_strlcpy(this->edit_str_buf, _network_server_name, lengthof(this->edit_str_buf));
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
696
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
697 _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
698 BuildFileList();
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
699 this->vscroll.cap = 12;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
700 this->vscroll.count = _fios_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
701
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
702 this->afilter = CS_ALPHANUMERAL;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
703 InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 160);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
704
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
705 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
706 _network_game_info.use_password = !StrEmpty(_network_server_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
707
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
708 this->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
709 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
710
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
711 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
712 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
713 int y = NSSWND_START, pos;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 const FiosItem *item;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
715
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
716 /* draw basic widgets */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 SetDParam(1, _connection_types_dropdown[_network_advertise]);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 SetDParam(2, _network_game_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
719 SetDParam(3, _network_game_info.companies_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
720 SetDParam(4, _network_game_info.spectators_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
721 SetDParam(5, STR_NETWORK_LANG_ANY + _network_game_info.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
722 this->DrawWidgets();
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
723
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
724 /* 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
725 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
726
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
727 /* if password is set, draw red '*' next to '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
728 if (_network_game_info.use_password) DoDrawString("*", 408, 23, TC_RED);
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
729
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
730 /* draw list of maps */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
731 GfxFillRect(11, 63, 258, 215, 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
732
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
733 pos = this->vscroll.pos;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
734 while (pos < _fios_num + 1) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
735 item = _fios_list + pos - 1;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
736 if (item == this->map || (pos == 0 && this->map == 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
737 GfxFillRect(11, y - 1, 258, y + 10, 155); // show highlighted item with a different colour
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
738
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
739 if (pos == 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
740 DrawString(14, y, STR_4010_GENERATE_RANDOM_NEW_GAME, TC_DARK_GREEN);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
741 } 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
742 DoDrawString(item->title, 14, y, _fios_colors[item->type] );
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
743 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
744 pos++;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
745 y += NSSWND_ROWSIZE;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
746
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
747 if (y >= this->vscroll.cap * NSSWND_ROWSIZE + NSSWND_START) 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
748 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
749 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
750
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
751 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
752 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
753 if (widget != NSSW_CONNTYPE_BTN && widget != NSSW_LANGUAGE_BTN) HideDropDownMenu(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
754 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
755 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
756 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
757 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
758 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
759 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
760
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 case 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
762 ShowOnScreenKeyboard(this, NSSW_GAMENAME, 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
763 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
764
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
765 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
766 this->widget_id = NSSW_SETPWD;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a 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 ShowQueryString(BindCString(_network_server_password), STR_NETWORK_SET_PASSWORD, 20, 250, this, CS_ALPHANUMERAL);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
768 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
769
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
770 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
771 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
772
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
773 y += this->vscroll.pos;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
774 if (y >= this->vscroll.count) return;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
775
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
776 this->map = (y == 0) ? NULL : _fios_list + y - 1;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
777 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
778 } 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
779
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
780 case NSSW_CONNTYPE_BTN: // Connection 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
781 ShowDropDownMenu(this, _connection_types_dropdown, _network_advertise, NSSW_CONNTYPE_BTN, 0, 0); // do it for widget NSSW_CONNTYPE_BTN
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
782 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
783
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
784 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
785 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
786 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
787 /* Don't allow too fast scrolling */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
788 if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
789 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
790 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
791 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
792 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
793 case NSSW_CLIENTS_BTND: case NSSW_CLIENTS_BTNU:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
794 _network_game_info.clients_max = Clamp(_network_game_info.clients_max + widget - NSSW_CLIENTS_TXT, 2, MAX_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
795 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
796 case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
797 _network_game_info.companies_max = Clamp(_network_game_info.companies_max + widget - NSSW_COMPANIES_TXT, 1, MAX_PLAYERS);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
798 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
799 case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
800 _network_game_info.spectators_max = Clamp(_network_game_info.spectators_max + widget - NSSW_SPECTATORS_TXT, 0, MAX_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
801 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
802 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
803 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
804 _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
805 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
806
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
807 case NSSW_CLIENTS_TXT: // Click on number of players
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
808 this->widget_id = NSSW_CLIENTS_TXT;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
809 SetDParam(0, _network_game_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
810 ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_CLIENTS, 3, 50, this, CS_NUMERAL);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
811 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
812
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
813 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
814 this->widget_id = NSSW_COMPANIES_TXT;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
815 SetDParam(0, _network_game_info.companies_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
816 ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_COMPANIES, 3, 50, this, CS_NUMERAL);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
817 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
818
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
819 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
820 this->widget_id = NSSW_SPECTATORS_TXT;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
821 SetDParam(0, _network_game_info.spectators_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
822 ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_SPECTATORS, 3, 50, this, CS_NUMERAL);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
823 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
824
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
825 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
826 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
827 for (uint i = 0; i < lengthof(_language_dropdown) - 1; 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
828 if (_language_dropdown[i] == STR_NETWORK_LANG_ANY + _network_game_info.server_lang) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
829 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
830 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
831 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
832 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
833 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
834 } break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
835
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
836 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
837 _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
838
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
839 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
840 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
841 } else { // load a scenario
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
842 char *name = FiosBrowseTo(this->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
843 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
844 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
845 _file_to_saveload.filetype = FT_SCENARIO;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
846 ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.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
847 ttd_strlcpy(_file_to_saveload.title, this->map->title, sizeof(_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
848
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
849 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
850 SwitchMode(SM_START_SCENARIO);
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
851 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
852 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
853 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
854
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
855 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
856 _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
857 /* XXX - WC_NETWORK_WINDOW (this window) should stay, but if it stays, it gets
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
858 * copied all the elements of 'load game' and upon closing that, it segfaults */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
859 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
860 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
861 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
862 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
863 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
864
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
865 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
866 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
867 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
868 case NSSW_CONNTYPE_BTN:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
869 _network_advertise = (index != 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
870 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
871 case NSSW_LANGUAGE_BTN:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
872 _network_game_info.server_lang = _language_dropdown[index] - STR_NETWORK_LANG_ANY;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
873 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
874 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
875 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
876 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
877
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
878 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
879 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
880
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
881 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
882 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
883 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
884 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
885
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
886 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
887 {
9285
3b3f13cb6db6 (svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
rubidium <rubidium@openttd.org>
parents: 9274
diff changeset
888 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
889 if (this->field == NSSW_GAMENAME) {
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
890 if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == 1) return state; // enter pressed
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
891
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
892 ttd_strlcpy(_network_server_name, this->text.buf, sizeof(_network_server_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
893 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
894
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
895 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
896 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
897
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
898 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
899 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
900 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
901
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
902 if (this->widget_id == NSSW_SETPWD) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
903 ttd_strlcpy(_network_server_password, str, lengthof(_network_server_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
904 _network_game_info.use_password = !StrEmpty(_network_server_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
905 } 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
906 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
907 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
908 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
909 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
910 case NSSW_CLIENTS_TXT: _network_game_info.clients_max = Clamp(value, 2, MAX_CLIENTS); 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
911 case NSSW_COMPANIES_TXT: _network_game_info.companies_max = Clamp(value, 1, MAX_PLAYERS); 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
912 case NSSW_SPECTATORS_TXT: _network_game_info.spectators_max = 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
913 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
914 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
915
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
916 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
917 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
918 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
919
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
920 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
921 /* Window decoration and background panel */
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
922 { WWT_CLOSEBOX, RESIZE_NONE, BGC, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, // NSSW_CLOSE
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
923 { WWT_CAPTION, RESIZE_NONE, BGC, 11, 419, 0, 13, STR_NETWORK_START_GAME_WINDOW, STR_NULL},
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
924 { WWT_PANEL, RESIZE_NONE, BGC, 0, 419, 14, 243, 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
925
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
926 /* Set game name and password widgets */
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
927 { WWT_TEXT, RESIZE_NONE, BGC, 10, 90, 22, 34, STR_NETWORK_NEW_GAME_NAME, STR_NULL},
8737
b62e473a9029 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium <rubidium@openttd.org>
parents: 8728
diff changeset
928 { WWT_EDITBOX, RESIZE_NONE, BGC, 100, 272, 22, 33, STR_NETWORK_NEW_GAME_NAME_OSKTITLE, STR_NETWORK_NEW_GAME_NAME_TIP}, // NSSW_GAMENAME
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
929 { WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 285, 405, 22, 33, STR_NETWORK_SET_PASSWORD, STR_NETWORK_PASSWORD_TIP}, // 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
930
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
931 /* List of playable scenarios */
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
932 { WWT_TEXT, RESIZE_NONE, BGC, 10, 110, 43, 55, STR_NETWORK_SELECT_MAP, STR_NULL},
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
933 { WWT_INSET, RESIZE_NONE, BGC, 10, 271, 62, 216, STR_NULL, STR_NETWORK_SELECT_MAP_TIP}, // NSSW_SELMAP
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
934 { WWT_SCROLLBAR, RESIZE_NONE, BGC, 259, 270, 63, 215, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
935
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
936 /* Combo/selection boxes to control Connection Type / Max Clients / Max Companies / Max Observers / Language */
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
937 { WWT_TEXT, RESIZE_NONE, BGC, 280, 419, 63, 75, STR_NETWORK_CONNECTION, STR_NULL},
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
938 { WWT_DROPDOWNIN, RESIZE_NONE, BGC, 280, 410, 77, 88, STR_NETWORK_LAN_INTERNET_COMBO, STR_NETWORK_CONNECTION_TIP}, // NSSW_CONNTYPE_BTN
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
939
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
940 { WWT_TEXT, RESIZE_NONE, BGC, 280, 419, 95, 107, STR_NETWORK_NUMBER_OF_CLIENTS, STR_NULL},
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
941 { WWT_IMGBTN, RESIZE_NONE, BGC, 280, 291, 109, 120, SPR_ARROW_DOWN, STR_NETWORK_NUMBER_OF_CLIENTS_TIP}, // NSSW_CLIENTS_BTND
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
942 { WWT_PUSHTXTBTN, RESIZE_NONE, BGC, 292, 397, 109, 120, STR_NETWORK_CLIENTS_SELECT, STR_NETWORK_NUMBER_OF_CLIENTS_TIP}, // NSSW_CLIENTS_TXT
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
943 { WWT_IMGBTN, RESIZE_NONE, BGC, 398, 410, 109, 120, SPR_ARROW_UP, STR_NETWORK_NUMBER_OF_CLIENTS_TIP}, // NSSW_CLIENTS_BTNU
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
944
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
945 { WWT_TEXT, RESIZE_NONE, BGC, 280, 419, 127, 139, STR_NETWORK_NUMBER_OF_COMPANIES, STR_NULL},
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
946 { WWT_IMGBTN, RESIZE_NONE, BGC, 280, 291, 141, 152, SPR_ARROW_DOWN, STR_NETWORK_NUMBER_OF_COMPANIES_TIP}, // NSSW_COMPANIES_BTND
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
947 { WWT_PUSHTXTBTN, RESIZE_NONE, BGC, 292, 397, 141, 152, STR_NETWORK_COMPANIES_SELECT, STR_NETWORK_NUMBER_OF_COMPANIES_TIP}, // NSSW_COMPANIES_TXT
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
948 { WWT_IMGBTN, RESIZE_NONE, BGC, 398, 410, 141, 152, SPR_ARROW_UP, STR_NETWORK_NUMBER_OF_COMPANIES_TIP}, // 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
949
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
950 { WWT_TEXT, RESIZE_NONE, BGC, 280, 419, 159, 171, STR_NETWORK_NUMBER_OF_SPECTATORS, STR_NULL},
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
951 { WWT_IMGBTN, RESIZE_NONE, BGC, 280, 291, 173, 184, SPR_ARROW_DOWN, STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_BTND
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
952 { WWT_PUSHTXTBTN, RESIZE_NONE, BGC, 292, 397, 173, 184, STR_NETWORK_SPECTATORS_SELECT, STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_TXT
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
953 { WWT_IMGBTN, RESIZE_NONE, BGC, 398, 410, 173, 184, SPR_ARROW_UP, STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // 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
954
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
955 { WWT_TEXT, RESIZE_NONE, BGC, 280, 419, 191, 203, STR_NETWORK_LANGUAGE_SPOKEN, STR_NULL},
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
956 { WWT_DROPDOWNIN, RESIZE_NONE, BGC, 280, 410, 205, 216, STR_NETWORK_LANGUAGE_COMBO, STR_NETWORK_LANGUAGE_TIP}, // NSSW_LANGUAGE_BTN
7959
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
957
35aac28f0022 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7931
diff changeset
958 /* Buttons Start / Load / Cancel */
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
959 { WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 40, 140, 224, 235, STR_NETWORK_START_GAME, STR_NETWORK_START_GAME_TIP}, // NSSW_START
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
960 { WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 150, 250, 224, 235, STR_NETWORK_LOAD_GAME, STR_NETWORK_LOAD_GAME_TIP}, // NSSW_LOAD
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
961 { WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 260, 360, 224, 235, STR_012E_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
962
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
963 { 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
964 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
965
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
966 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
967 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
968 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
969 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
970 _network_start_server_window_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
971 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
972
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 5916
diff changeset
973 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
974 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
975 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
976
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
977 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
978 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
979
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
980 static PlayerID NetworkLobbyFindCompanyIndex(byte 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
981 {
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
982 /* Scroll through all _network_player_info and get the 'pos' item that is not empty */
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
983 for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
984 if (_network_player_info[i].company_name[0] != '\0') {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
985 if (pos-- == 0) return i;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
986 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
987 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
988
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
989 return PLAYER_FIRST;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
990 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
991
7963
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
992 /** 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
993 enum NetworkLobbyWindowWidgets {
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
994 NLWW_CLOSE = 0, ///< Close 'X' button
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
995 NLWW_MATRIX = 5, ///< List of companies
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
996 NLWW_DETAILS = 7, ///< Company details
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
997 NLWW_JOIN = 8, ///< 'Join company' button
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
998 NLWW_NEW = 9, ///< 'New company' button
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
999 NLWW_SPECTATE = 10, ///< 'Spectate game' button
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1000 NLWW_REFRESH = 11, ///< 'Refresh server' button
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1001 NLWW_CANCEL = 12, ///< 'Cancel' button
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1002 };
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1003
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1004 struct NetworkLobbyWindow : public Window {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1005 PlayerID company; ///< Select company
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1006 NetworkGameList *server; ///< Selected server
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1007
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1008 NetworkLobbyWindow(const WindowDesc *desc, NetworkGameList *ngl) :
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1009 Window(desc), company(INVALID_PLAYER), server(ngl)
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1010 {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1011 this->vscroll.cap = 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
1012
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
1013 this->FindWindowPlacementAndResize(desc);
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1014 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1015
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1016 virtual void OnPaint()
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1017 {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1018 const NetworkGameInfo *gi = &this->server->info;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1019 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
1020
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1021 /* Join button is disabled when no company is selected */
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1022 this->SetWidgetDisabledState(NLWW_JOIN, this->company == INVALID_PLAYER);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1023 /* 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
1024 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
1025 /* 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
1026 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
1027
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1028 /* Draw window widgets */
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1029 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
1030 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
1031
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1032 /* Draw company list */
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1033 pos = this->vscroll.pos;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1034 while (pos < gi->companies_on) {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1035 byte company = NetworkLobbyFindCompanyIndex(pos);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1036 bool income = false;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1037 if (this->company == company) {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1038 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
1039 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1040
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1041 DoDrawStringTruncated(_network_player_info[company].company_name, 13, y, TC_BLACK, 135 - 13);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1042 if (_network_player_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, 135, y);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1043
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1044 /* If the company's income was positive puts a green dot else a red dot */
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1045 if (_network_player_info[company].income >= 0) income = true;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1046 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
1047
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1048 pos++;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1049 y += NET_PRC__SIZE_OF_ROW;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1050 if (pos >= this->vscroll.cap) break;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1051 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1052
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1053 /* 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
1054 GfxFillRect(174, 39, 403, 75, 157);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1055 DrawStringCentered(290, 50, STR_NETWORK_COMPANY_INFO, TC_FROMSTRING);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1056 if (this->company != INVALID_PLAYER) {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1057 const uint x = 183;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1058 const uint trunc_width = this->widget[NLWW_DETAILS].right - x;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1059 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
1060
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1061 SetDParam(0, gi->clients_on);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1062 SetDParam(1, gi->clients_max);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1063 SetDParam(2, gi->companies_on);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1064 SetDParam(3, gi->companies_max);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1065 DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1066 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
1067
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1068 SetDParamStr(0, _network_player_info[this->company].company_name);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1069 DrawStringTruncated(x, y, STR_NETWORK_COMPANY_NAME, TC_GOLD, trunc_width);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1070 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
1071
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1072 SetDParam(0, _network_player_info[this->company].inaugurated_year);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1073 DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, TC_GOLD); // inauguration year
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1074 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
1075
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1076 SetDParam(0, _network_player_info[this->company].company_value);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1077 DrawString(x, y, STR_NETWORK_VALUE, TC_GOLD); // company value
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1078 y += 10;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1079
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1080 SetDParam(0, _network_player_info[this->company].money);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1081 DrawString(x, y, STR_NETWORK_CURRENT_BALANCE, TC_GOLD); // current balance
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1082 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
1083
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1084 SetDParam(0, _network_player_info[this->company].income);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1085 DrawString(x, y, STR_NETWORK_LAST_YEARS_INCOME, TC_GOLD); // last year's income
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1086 y += 10;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1087
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1088 SetDParam(0, _network_player_info[this->company].performance);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1089 DrawString(x, y, STR_NETWORK_PERFORMANCE, TC_GOLD); // performance
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1090 y += 10;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1091
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1092 SetDParam(0, _network_player_info[this->company].num_vehicle[0]);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1093 SetDParam(1, _network_player_info[this->company].num_vehicle[1]);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1094 SetDParam(2, _network_player_info[this->company].num_vehicle[2]);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1095 SetDParam(3, _network_player_info[this->company].num_vehicle[3]);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1096 SetDParam(4, _network_player_info[this->company].num_vehicle[4]);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1097 DrawString(x, y, STR_NETWORK_VEHICLES, TC_GOLD); // vehicles
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1098 y += 10;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1099
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1100 SetDParam(0, _network_player_info[this->company].num_station[0]);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1101 SetDParam(1, _network_player_info[this->company].num_station[1]);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1102 SetDParam(2, _network_player_info[this->company].num_station[2]);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1103 SetDParam(3, _network_player_info[this->company].num_station[3]);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1104 SetDParam(4, _network_player_info[this->company].num_station[4]);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1105 DrawString(x, y, STR_NETWORK_STATIONS, TC_GOLD); // stations
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1106 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
1107
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1108 SetDParamStr(0, _network_player_info[this->company].players);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1109 DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, TC_GOLD, trunc_width); // players
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1110 }
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1111 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1112
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1113 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
1114 {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1115 switch (widget) {
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1116 case NLWW_CLOSE: // Close 'X'
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1117 case NLWW_CANCEL: // Cancel button
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1118 ShowNetworkGameWindow();
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1119 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1120
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1121 case NLWW_MATRIX: { // Company list
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1122 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
1123
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1124 if (id_v >= this->vscroll.cap) break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1125
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1126 id_v += this->vscroll.pos;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1127 this->company = (id_v >= this->server->info.companies_on) ? INVALID_PLAYER : NetworkLobbyFindCompanyIndex(id_v);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1128 this->SetDirty();
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1129 } break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1130
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1131 case NLWW_JOIN: // Join company
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1132 /* Button can be clicked only when it is enabled */
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1133 _network_playas = this->company;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1134 NetworkClientConnectGame(_network_last_host, _network_last_port);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1135 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1136
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1137 case NLWW_NEW: // New company
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1138 _network_playas = PLAYER_NEW_COMPANY;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1139 NetworkClientConnectGame(_network_last_host, _network_last_port);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1140 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1141
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1142 case NLWW_SPECTATE: // Spectate game
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1143 _network_playas = PLAYER_SPECTATOR;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1144 NetworkClientConnectGame(_network_last_host, _network_last_port);
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1145 break;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1146
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1147 case NLWW_REFRESH: // Refresh
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1148 NetworkTCPQueryServer(_network_last_host, _network_last_port); // company info
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1149 NetworkUDPQueryServer(_network_last_host, _network_last_port); // general data
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1150 break;
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1151 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1152 }
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1153 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1154
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1155 static const Widget _network_lobby_window_widgets[] = {
7963
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1156 { WWT_CLOSEBOX, RESIZE_NONE, BGC, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW }, // NLWW_CLOSE
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1157 { WWT_CAPTION, RESIZE_NONE, BGC, 11, 419, 0, 13, STR_NETWORK_GAME_LOBBY, STR_NULL},
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1158 { WWT_PANEL, RESIZE_NONE, BGC, 0, 419, 14, 234, 0x0, STR_NULL},
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1159 { WWT_TEXT, RESIZE_NONE, BGC, 10, 419, 22, 34, STR_NETWORK_PREPARE_TO_JOIN, 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
1160
7963
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1161 /* company list */
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1162 { WWT_PANEL, RESIZE_NONE, BTC, 10, 155, 38, 49, 0x0, STR_NULL},
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1163 { WWT_MATRIX, RESIZE_NONE, BGC, 10, 155, 50, 190, (10 << 8) + 1, STR_NETWORK_COMPANY_LIST_TIP}, // NLWW_MATRIX
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1164 { WWT_SCROLLBAR, RESIZE_NONE, BGC, 156, 167, 38, 190, 0x0, STR_0190_SCROLL_BAR_SCROLLS_LIST},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1165
7963
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1166 /* company/player info */
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1167 { WWT_PANEL, RESIZE_NONE, BGC, 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
1168
7963
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1169 /* buttons */
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1170 { WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 10, 151, 200, 211, STR_NETWORK_JOIN_COMPANY, STR_NETWORK_JOIN_COMPANY_TIP}, // NLWW_JOIN
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1171 { WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 10, 151, 215, 226, STR_NETWORK_NEW_COMPANY, STR_NETWORK_NEW_COMPANY_TIP}, // NLWW_NEW
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1172 { WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 158, 268, 200, 211, STR_NETWORK_SPECTATE_GAME, STR_NETWORK_SPECTATE_GAME_TIP}, // NLWW_SPECTATE
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1173 { WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 158, 268, 215, 226, STR_NETWORK_REFRESH, STR_NETWORK_REFRESH_TIP}, // NLWW_REFRESH
c35c4ff096c4 (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz <smatz@openttd.org>
parents: 7961
diff changeset
1174 { WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 278, 388, 200, 211, STR_012E_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
1175
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1176 { 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
1177 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1178
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1179 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
1180 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
1181 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
1182 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1183 _network_lobby_window_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1184 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1185
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1186 /* 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
1187 * @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
1188 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
1189 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1190 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
1191
5916
33f17e261853 (svn r8543) -Codechange: make a real difference between querying the server via UDP and TCP.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
1192 NetworkTCPQueryServer(_network_last_host, _network_last_port); // company info
33f17e261853 (svn r8543) -Codechange: make a real difference between querying the server via UDP and TCP.
rubidium <rubidium@openttd.org>
parents: 5893
diff changeset
1193 NetworkUDPQueryServer(_network_last_host, _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
1194
9177
94a08f9e1061 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium <rubidium@openttd.org>
parents: 9165
diff changeset
1195 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
1196 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1197
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1198 // The window below gives information about the connected clients
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1199 // and also makes able to give money to them, kick them (if server)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1200 // and stuff like that.
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1201
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1202 extern void DrawPlayerIcon(PlayerID pid, int x, int y);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1203
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1204 // Every action must be of this form
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1205 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
1206
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1207 // Max 10 actions per client
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1208 #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
1209
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1210 enum {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1211 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
1212 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
1213 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1214
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1215 static const Widget _client_list_widgets[] = {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1216 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
7029
ce8b6783be37 (svn r10293) -Add [FS#885]: a sticky button for the client list window (oxygene)
truelight <truelight@openttd.org>
parents: 7002
diff changeset
1217 { WWT_CAPTION, RESIZE_NONE, 14, 11, 237, 0, 13, STR_NETWORK_CLIENT_LIST, STR_018C_WINDOW_TITLE_DRAG_THIS},
ce8b6783be37 (svn r10293) -Add [FS#885]: a sticky button for the client list window (oxygene)
truelight <truelight@openttd.org>
parents: 7002
diff changeset
1218 { WWT_STICKYBOX, RESIZE_NONE, 14, 238, 249, 0, 13, STR_NULL, STR_STICKY_BUTTON},
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1219
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1220 { WWT_PANEL, RESIZE_NONE, 14, 0, 249, 14, 14 + CLNWND_ROWSIZE + 1, 0x0, STR_NULL},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1221 { 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
1222 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1223
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1224 static const Widget _client_list_popup_widgets[] = {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1225 { WWT_PANEL, RESIZE_NONE, 14, 0, 99, 0, 0, 0, STR_NULL},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1226 { 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
1227 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1228
9317
c399bf075b2f (svn r13185) -Codechange: remove everything related to the WindowProc callbacks.
rubidium <rubidium@openttd.org>
parents: 9301
diff changeset
1229 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
1230 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
1231 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
1232 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1233 _client_list_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1234 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1235
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1236 // Finds the Xth client-info that is active
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1237 static const NetworkClientInfo *NetworkFindClientInfo(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
1238 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1239 const NetworkClientInfo *ci;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1240
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1241 FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1242 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
1243 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
1244 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1245
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1246 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
1247 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1248
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1249 // Here we start to define the options out of the menu
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1250 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
1251 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1252 if (client_no < MAX_PLAYERS)
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1253 SEND_COMMAND(PACKET_SERVER_ERROR)(DEREF_CLIENT(client_no), NETWORK_ERROR_KICKED);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1254 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1255
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1256 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
1257 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1258 uint32 ip = NetworkFindClientInfo(client_no)->client_ip;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1259
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1260 for (uint i = 0; i < lengthof(_network_ban_list); i++) {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1261 if (_network_ban_list[i] == NULL) {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1262 _network_ban_list[i] = strdup(inet_ntoa(*(struct in_addr *)&ip));
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1263 break;
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1264 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1265 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1266
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1267 if (client_no < MAX_PLAYERS) {
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1268 SEND_COMMAND(PACKET_SERVER_ERROR)(DEREF_CLIENT(client_no), NETWORK_ERROR_KICKED);
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1269 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1270 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1271
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1272 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
1273 {
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1274 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
1275 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
1276 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1277 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1278
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1279 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
1280 {
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1281 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
1282 ShowNetworkChatQueryWindow(DESTTYPE_CLIENT, NetworkFindClientInfo(client_no)->client_index);
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1283 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1284 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1285
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1286 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
1287 {
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1288 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
1289 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
1290 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1291 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1292
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1293 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
1294 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1295 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
1296 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1297
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1298 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
1299 {
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1300 /* 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
1301 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1302
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1303
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1304
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1305 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
1306 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
1307 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
1308 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
1309 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
1310
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1311 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
1312 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
1313 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
1314 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1315 /*
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1316 * 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
1317 * 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
1318 */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1319
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1320 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
1321
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1322 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
1323 if (_network_own_client_index != ci->client_index) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1324 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
1325 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
1326 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1327
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1328 if (IsValidPlayer(ci->client_playas) || ci->client_playas == PLAYER_SPECTATOR) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1329 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
1330 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
1331 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1332 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
1333 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
1334
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1335 if (_network_own_client_index != ci->client_index) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1336 /* We are no spectator and the player we want to give money to is no spectator and money gifts are allowed */
9354
2b0c6e62535e (svn r13251) -Codechange: rename _patches to _settings as that is more logic.
rubidium <rubidium@openttd.org>
parents: 9317
diff changeset
1337 if (IsValidPlayer(_network_playas) && IsValidPlayer(ci->client_playas) && _settings.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
1338 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
1339 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
1340 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1341 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1342
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1343 /* A server can kick clients (but not himself) */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1344 if (_network_server && _network_own_client_index != ci->client_index) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1345 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
1346 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
1347
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1348 sprintf(this->action[i],"Ban"); // XXX GetString?
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1349 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
1350 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1351
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1352 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
1353 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
1354 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
1355 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1356
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1357 /* 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
1358 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
1359
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1360 /* 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
1361 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
1362 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
1363
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1364 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
1365
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1366 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
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
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1369 /**
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1370 * 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
1371 */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1372 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
1373 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1374 /* 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
1375 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
1376 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
1377 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1378 }
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1379
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1380 /**
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1381 * 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
1382 */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1383 uint ClientListPopupHeight()
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1384 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1385 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
1386
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1387 // Find the amount of actions
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1388 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
1389 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
1390 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
1391 num++;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1392 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1393
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1394 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
1395
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1396 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
1397 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1398
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1399
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1400 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
1401 {
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
1402 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
1403
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1404 /* 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
1405 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
1406 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
1407 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
1408 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
1409 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
1410
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1411 TextColour colour;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1412 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
1413 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
1414 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
1415 } else {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1416 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
1417 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1418
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1419 DoDrawString(this->action[i], 4, y, colour);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1420 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1421 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1422
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1423 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
1424 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1425 /* 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
1426 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
1427
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1428 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
1429 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
1430
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1431 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
1432 this->SetDirty();
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1433 } else {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1434 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
1435 HandleClientListPopupClick(index);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1436 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1437
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1438 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
1439 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1440 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1441 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1442
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1443 /**
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1444 * 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
1445 */
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1446 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
1447 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1448 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
1449
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1450 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
1451
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1452 new NetworkClientListPopupWindow(x, y, _client_list_popup_widgets, 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
1453 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1454
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1455 /**
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1456 * Main handle for clientlist
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1457 */
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1458 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
1459 {
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1460 byte selected_item;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1461 byte selected_y;
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1462
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1463 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
1464 Window(desc, window_number),
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1465 selected_item(0),
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1466 selected_y(255)
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1467 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1468 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
1469 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1470
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1471 /**
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1472 * 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
1473 */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1474 bool CheckClientListHeight()
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1475 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1476 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
1477 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
1478
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1479 /* Should be replaced with a loop through all clients */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1480 FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1481 num++;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1482 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1483
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1484 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
1485
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1486 /* 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
1487 if (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
1488 // XXX - magic unfortunately; (num + 2) has to be one bigger than heigh (num + 1)
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1489 this->SetDirty();
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1490 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
1491 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
1492 this->SetDirty();
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1493 return false;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1494 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1495 return true;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1496 }
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1497
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1498 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
1499 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1500 NetworkClientInfo *ci;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1501 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
1502
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1503 /* 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
1504 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
1505
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
1506 this->DrawWidgets();
8738
723631ab4868 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium <rubidium@openttd.org>
parents: 8737
diff changeset
1507
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1508 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
1509
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1510 FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1511 TextColour colour;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1512 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
1513 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
1514 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
1515 } else {
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1516 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
1517 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1518
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1519 if (ci->client_index == NETWORK_SERVER_INDEX) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1520 DrawString(4, y, STR_NETWORK_SERVER, colour);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1521 } else {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1522 DrawString(4, y, STR_NETWORK_CLIENT, colour);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1523 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1524
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1525 /* Filter out spectators */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1526 if (IsValidPlayer(ci->client_playas)) DrawPlayerIcon(ci->client_playas, 64, y + 1);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1527
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1528 DoDrawString(ci->client_name, 81, y, colour);
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1529
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1530 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
1531 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1532 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1533
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1534 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
1535 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1536 /* Show the popup with option */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1537 if (this->selected_item != 255) {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1538 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
1539 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1540 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1541
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1542 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
1543 {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1544 /* -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
1545 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
1546 this->selected_y = 0;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1547 this->selected_item = 255;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1548 this->SetDirty();
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1549 return;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1550 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1551 /* 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
1552 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
1553
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1554 /* 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
1555 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
1556 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
1557 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
1558 } else {
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1559 this->selected_item = 255;
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1560 }
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1561
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1562 /* Repaint */
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1563 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
1564 }
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1565 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1566
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 5916
diff changeset
1567 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
1568 {
9242
b400b0761465 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium <rubidium@openttd.org>
parents: 9241
diff changeset
1569 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
1570 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1571
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1572
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1573 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
1574
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1575
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1576 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
1577 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1578 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
1579
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1580 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
1581 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
1582 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
1583 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
1584 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
1585 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1586 ShowQueryString(STR_EMPTY, caption, 20, 180, FindWindowById(WC_NETWORK_STATUS_WINDOW, 0), CS_ALPHANUMERAL);
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1587 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1588
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1589 struct NetworkJoinStatusWindow : Window {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1590 NetworkJoinStatusWindow(const WindowDesc *desc) : Window(desc)
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1591 {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1592 this->parent = FindWindowById(WC_NETWORK_WINDOW, 0);
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1593 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1594
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1595 virtual void OnPaint()
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1596 {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1597 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
1598 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
1599
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1600 DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_GREY);
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1601 switch (_network_join_status) {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1602 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
1603 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
1604 progress = 10; // first two stages 10%
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1605 break;
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1606 case NETWORK_JOIN_STATUS_WAITING:
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1607 SetDParam(0, _network_join_waiting);
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1608 DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_WAITING, TC_GREY);
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1609 progress = 15; // third stage is 15%
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1610 break;
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1611 case NETWORK_JOIN_STATUS_DOWNLOADING:
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1612 SetDParam(0, _network_join_kbytes);
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1613 SetDParam(1, _network_join_kbytes_total);
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1614 DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_DOWNLOADING, TC_GREY);
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1615 /* Fallthrough */
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1616 default: /* Waiting is 15%, so the resting receivement of map is maximum 70% */
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1617 progress = 15 + _network_join_kbytes * (100 - 15) / _network_join_kbytes_total;
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1618 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1619
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1620 /* Draw nice progress bar :) */
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1621 DrawFrameRect(20, 18, (int)((this->width - 20) * progress / 100), 28, 10, FR_NONE);
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1622 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1623
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1624 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
1625 {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1626 if (widget == 2) { //Disconnect button
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1627 NetworkDisconnect();
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1628 SwitchMode(SM_MENU);
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1629 ShowNetworkGameWindow();
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1630 }
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1631 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1632
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1633 virtual void OnQueryTextFinished(char *str)
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1634 {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1635 if (StrEmpty(str)) {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1636 NetworkDisconnect();
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1637 ShowNetworkGameWindow();
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1638 } else {
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1639 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
1640 }
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1641 }
9269
9ba3a5bccb10 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium <rubidium@openttd.org>
parents: 9242
diff changeset
1642 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1643
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1644 static const Widget _network_join_status_window_widget[] = {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1645 { WWT_CAPTION, RESIZE_NONE, 14, 0, 249, 0, 13, STR_NETWORK_CONNECTING, STR_018C_WINDOW_TITLE_DRAG_THIS},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1646 { WWT_PANEL, RESIZE_NONE, 14, 0, 249, 14, 84, 0x0, STR_NULL},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1647 { WWT_PUSHTXTBTN, RESIZE_NONE, BTC, 75, 175, 69, 80, STR_NETWORK_DISCONNECT, STR_NULL},
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1648 { 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
1649 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1650
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1651 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
1652 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
1653 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
1654 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1655 _network_join_status_window_widget,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1656 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1657
6247
57363e064324 (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium <rubidium@openttd.org>
parents: 5916
diff changeset
1658 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
1659 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1660 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
1661 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
1662 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1663
6531
77a5d2b51cfc (svn r9719) -Fix: in-game private messages did not work for clients with a Client ID > 255.
rubidium <rubidium@openttd.org>
parents: 6492
diff changeset
1664 static void SendChat(const char *buf, DestType type, int dest)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1665 {
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
1666 if (StrEmpty(buf)) 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
1667 if (!_network_server) {
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
1668 SEND_COMMAND(PACKET_CLIENT_CHAT)((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1669 } else {
5587
c44c070c5032 (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium <rubidium@openttd.org>
parents: 5584
diff changeset
1670 NetworkServer_HandleChat((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf, NETWORK_SERVER_INDEX);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1671 }
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
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1674
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1675 struct NetworkChatWindow : 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
1676 DestType dtype;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1677 int dest;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1678
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1679 NetworkChatWindow (const WindowDesc *desc, DestType type, int dest) : QueryStringBaseWindow(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
1680 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1681 this->LowerWidget(2);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1682 this->dtype = 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
1683 this->dest = dest;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1684 this->afilter = CS_ALPHANUMERAL;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1685 InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 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
1686
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1687 InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1688 SetBit(_no_scroll, SCROLL_CHAT); // do not scroll the game with the arrow-keys
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1689
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1690 _chat_tab_completion_active = 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
1691
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1692 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
1693 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1694
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1695 ~NetworkChatWindow ()
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1696 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1697 InvalidateWindowData(WC_NEWS_WINDOW, 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
1698 ClrBit(_no_scroll, SCROLL_CHAT);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1699 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1700
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1701 /**
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1702 * Find the next item of the list of things that can be auto-completed.
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1703 * @param item The current indexed item to return. This function can, and most
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1704 * likely will, alter item, to skip empty items in the arrays.
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1705 * @return Returns the char that matched to the 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
1706 */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1707 const char *ChatTabCompletionNextItem(uint *item)
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1708 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1709 static char chat_tab_temp_buffer[64];
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1710
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1711 /* First, try 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
1712 if (*item < MAX_CLIENT_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
1713 /* Skip inactive 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
1714 while (_network_client_info[*item].client_index == NETWORK_EMPTY_INDEX && *item < MAX_CLIENT_INFO) (*item)++;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1715 if (*item < MAX_CLIENT_INFO) return _network_client_info[*item].client_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
1716 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1717
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1718 /* Then, try townnames */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1719 /* Not that the following assumes all town indices are adjacent, ie no
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1720 * towns have been deleted. */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1721 if (*item <= (uint)MAX_CLIENT_INFO + GetMaxTownIndex()) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1722 const Town *t;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1723
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1724 FOR_ALL_TOWNS_FROM(t, *item - MAX_CLIENT_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
1725 /* Get the town-name via the string-system */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1726 SetDParam(0, t->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
1727 GetString(chat_tab_temp_buffer, STR_TOWN, lastof(chat_tab_temp_buffer));
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1728 return &chat_tab_temp_buffer[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
1729 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1730 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1731
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1732 return 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
1733 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1734
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1735 /**
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1736 * Find what text to complete. It scans for a space from the left and marks
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1737 * the word right from that as to complete. It also writes a \0 at the
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1738 * position of the space (if any). If nothing found, buf is returned.
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1739 */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1740 static char *ChatTabCompletionFindText(char *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
1741 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1742 char *p = strrchr(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
1743 if (p == NULL) return 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
1744
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1745 *p = '\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
1746 return p + 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
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
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1749 /**
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1750 * See if we can auto-complete the current text of the user.
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1751 */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1752 void ChatTabCompletion()
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1753 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1754 static char _chat_tab_completion_buf[lengthof(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
1755 Textbuf *tb = &this->text;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1756 size_t len, tb_len;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1757 uint item;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1758 char *tb_buf, *pre_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
1759 const char *cur_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
1760 bool second_scan = 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
1761
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1762 item = 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
1763
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1764 /* Copy the buffer so we can modify it without damaging the real 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
1765 pre_buf = (_chat_tab_completion_active) ? strdup(_chat_tab_completion_buf) : strdup(tb->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
1766
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1767 tb_buf = ChatTabCompletionFindText(pre_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
1768 tb_len = strlen(tb_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
1769
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1770 while ((cur_name = ChatTabCompletionNextItem(&item)) != 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
1771 item++;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1772
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1773 if (_chat_tab_completion_active) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1774 /* We are pressing TAB again on the same name, is there an other 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
1775 * that starts with 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
1776 if (!second_scan) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1777 size_t 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
1778 size_t length;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1779
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1780 /* If we are completing at the begin of the line, skip the ': ' we added */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1781 if (tb_buf == pre_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
1782 offset = 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
1783 length = tb->length - 2;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1784 } 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
1785 /* Else, find the place we are completing at */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1786 offset = strlen(pre_buf) + 1;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1787 length = tb->length - 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
1788 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1789
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1790 /* Compare if we have a match */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1791 if (strlen(cur_name) == length && strncmp(cur_name, tb->buf + offset, length) == 0) second_scan = 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
1792
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1793 continue;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1794 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1795
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1796 /* Now any match we make on _chat_tab_completion_buf after this, is perfect */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1797 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1798
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1799 len = strlen(cur_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
1800 if (tb_len < len && strncasecmp(cur_name, tb_buf, tb_len) == 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
1801 /* Save the data it was before completion */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1802 if (!second_scan) snprintf(_chat_tab_completion_buf, lengthof(_chat_tab_completion_buf), "%s", tb->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
1803 _chat_tab_completion_active = true;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1804
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1805 /* Change to the found name. Add ': ' if we are at the start of the line (pretty) */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1806 if (pre_buf == tb_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
1807 snprintf(tb->buf, lengthof(this->edit_str_buf), "%s: ", cur_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
1808 } 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
1809 snprintf(tb->buf, lengthof(this->edit_str_buf), "%s %s", pre_buf, cur_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
1810 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1811
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1812 /* Update the textbuffer */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1813 UpdateTextBufferSize(&this->text);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1814
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1815 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
1816 free(pre_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
1817 return;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1818 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1819 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1820
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1821 if (second_scan) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1822 /* We walked all posibilities, and the user presses tab again.. revert to original text */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1823 strcpy(tb->buf, _chat_tab_completion_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
1824 _chat_tab_completion_active = 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
1825
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1826 /* Update the textbuffer */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1827 UpdateTextBufferSize(&this->text);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1828
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1829 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
1830 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1831 free(pre_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
1832 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1833
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1834 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
1835 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1836 static const StringID chat_captions[] = {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1837 STR_NETWORK_CHAT_ALL_CAPTION,
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1838 STR_NETWORK_CHAT_COMPANY_CAPTION,
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1839 STR_NETWORK_CHAT_CLIENT_CAPTION
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1840 };
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1841
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
1842 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
1843
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1844 assert((uint)this->dtype < lengthof(chat_captions));
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1845 DrawStringRightAligned(this->widget[2].left - 2, this->widget[2].top + 1, chat_captions[this->dtype], TC_BLACK);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1846 this->DrawEditBox(2);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1847 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1848
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1849 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
1850 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1851 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
1852 case 2:
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1853 ShowOnScreenKeyboard(this, 2, 0, 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
1854 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
1855
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1856 case 3: /* Send */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1857 SendChat(this->text.buf, this->dtype, this->dest);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1858 /* FALLTHROUGH */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1859 case 0: /* Cancel */ delete this; 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
1860 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1861 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1862
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1863 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
1864 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1865 this->HandleEditBox(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
1866 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1867
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
1868 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
1869 {
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
1870 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
1871 if (keycode == WKC_TAB) {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1872 ChatTabCompletion();
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1873 } 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
1874 _chat_tab_completion_active = false;
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
1875 switch (this->HandleEditBoxKey(2, key, keycode, 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
1876 case 1: /* Return */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1877 SendChat(this->text.buf, this->dtype, this->dest);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1878 /* FALLTHROUGH */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1879 case 2: /* Escape */ delete this; 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
1880 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1881 }
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
1882 return state;
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1883 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1884 };
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1885
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1886 static const Widget _chat_window_widgets[] = {
8737
b62e473a9029 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium <rubidium@openttd.org>
parents: 8728
diff changeset
1887 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
b62e473a9029 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium <rubidium@openttd.org>
parents: 8728
diff changeset
1888 { WWT_PANEL, RESIZE_RIGHT, 14, 11, 319, 0, 13, 0x0, STR_NULL}, // background
b62e473a9029 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium <rubidium@openttd.org>
parents: 8728
diff changeset
1889 { WWT_EDITBOX, RESIZE_RIGHT, 14, 75, 257, 1, 12, STR_NETWORK_CHAT_OSKTITLE, STR_NULL}, // text box
b62e473a9029 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium <rubidium@openttd.org>
parents: 8728
diff changeset
1890 { WWT_PUSHTXTBTN, RESIZE_LR, 14, 258, 319, 1, 12, STR_NETWORK_SEND, STR_NULL}, // send button
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1891 { 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
1892 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1893
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1894 static const WindowDesc _chat_window_desc = {
7363
796611c3f3eb (svn r10726) -Codechange: make it possible that the chat window is less than 640 pixels.
rubidium <rubidium@openttd.org>
parents: 7343
diff changeset
1895 WDP_CENTER, -26, 320, 14, 640, 14, // x, y, width, height
5893
8547517ef719 (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium <rubidium@openttd.org>
parents: 5669
diff changeset
1896 WC_SEND_NETWORK_MSG, 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
1897 WDF_STD_TOOLTIPS | WDF_DEF_WIDGET,
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1898 _chat_window_widgets,
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1899 };
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1900
6531
77a5d2b51cfc (svn r9719) -Fix: in-game private messages did not work for clients with a Client ID > 255.
rubidium <rubidium@openttd.org>
parents: 6492
diff changeset
1901 void ShowNetworkChatQueryWindow(DestType type, int dest)
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1902 {
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1903 DeleteWindowById(WC_SEND_NETWORK_MSG, 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
1904 new NetworkChatWindow (&_chat_window_desc, type, dest);
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1905 }
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
1906
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1907 /** 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
1908 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
1909 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
1910 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
1911 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
1912 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
1913 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
1914 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
1915 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
1916 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
1917 };
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1918
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1919 struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
9241
8299dc138e1c (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx <glx@openttd.org>
parents: 9182
diff changeset
1920 NetworkCompanyPasswordWindow(const WindowDesc *desc, Window *parent) : QueryStringBaseWindow(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
1921 {
9241
8299dc138e1c (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx <glx@openttd.org>
parents: 9182
diff changeset
1922 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
1923 this->afilter = CS_ALPHANUMERAL;
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1924 InitializeTextBuffer(&this->text, this->edit_str_buf, min(lengthof(_network_default_company_pass), lengthof(this->edit_str_buf)), 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
1925
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1926 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
1927 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1928
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1929 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
1930 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1931 if (this->IsWidgetLowered(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
1932 snprintf(_network_default_company_pass, lengthof(_network_default_company_pass), "%s", 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
1933 }
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1934
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1935 /* empty password is a '*' because of console argument */
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1936 if (StrEmpty(this->edit_str_buf)) snprintf(this->edit_str_buf, lengthof(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
1937 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
1938 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
1939 }
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1940
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1941 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
1942 {
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
1943 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
1944 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
1945 }
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1946
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1947 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
1948 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1949 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
1950 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
1951 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
1952
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1953 /* 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
1954 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
1955 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
1956 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
1957
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1958 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
1959 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
1960 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
1961 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
1962
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1963 case NCPWW_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
1964 ShowOnScreenKeyboard(this, NCPWW_PASSWORD, 2, 1);
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1965 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
1966 }
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1967 }
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1968
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1969 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
1970 {
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1971 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
1972 }
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
1973
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
1974 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
1975 {
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
1976 EventState state;
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
1977 switch (this->HandleEditBoxKey(4, key, keycode, 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
1978 case 1: // Return
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1979 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
1980 /* 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
1981
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1982 case 2: // Escape
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1983 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
1984 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
1985 }
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
1986 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
1987 }
9179
3b7b689031d6 (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium <rubidium@openttd.org>
parents: 9178
diff changeset
1988 };
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1989
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1990 static const Widget _ncp_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
1991 { WWT_CLOSEBOX, RESIZE_NONE, 14, 0, 10, 0, 13, STR_00C5, STR_018B_CLOSE_WINDOW},
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1992 { WWT_CAPTION, RESIZE_NONE, 14, 11, 299, 0, 13, STR_COMPANY_PASSWORD_CAPTION, STR_018C_WINDOW_TITLE_DRAG_THIS},
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1993 { WWT_PANEL, RESIZE_NONE, 14, 0, 299, 14, 50, 0x0, STR_NULL},
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1994 { WWT_TEXT, RESIZE_NONE, 14, 5, 100, 19, 30, STR_COMPANY_PASSWORD, STR_NULL},
8737
b62e473a9029 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium <rubidium@openttd.org>
parents: 8728
diff changeset
1995 { WWT_EDITBOX, RESIZE_NONE, 14, 101, 294, 19, 30, STR_SET_COMPANY_PASSWORD, STR_NULL},
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1996 { WWT_TEXTBTN, RESIZE_NONE, 14, 101, 294, 35, 46, STR_MAKE_DEFAULT_COMPANY_PASSWORD, STR_MAKE_DEFAULT_COMPANY_PASSWORD_TIP},
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1997 { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 0, 149, 51, 62, STR_012E_CANCEL, STR_COMPANY_PASSWORD_CANCEL},
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1998 { WWT_PUSHTXTBTN, RESIZE_NONE, 14, 150, 299, 51, 62, STR_012F_OK, STR_COMPANY_PASSWORD_OK},
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
1999 { 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
2000 };
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2001
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2002 static const WindowDesc _ncp_window_desc = {
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2003 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
2004 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
2005 WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
7998
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2006 _ncp_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
2007 };
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2008
9241
8299dc138e1c (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx <glx@openttd.org>
parents: 9182
diff changeset
2009 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
2010 {
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2011 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
2012
9241
8299dc138e1c (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx <glx@openttd.org>
parents: 9182
diff changeset
2013 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
2014 }
c23b6367e55b (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium <rubidium@openttd.org>
parents: 7997
diff changeset
2015
5584
4b26bd55bd24 (svn r8033) [cpp] - Prepare for merge from branches/cpp (all .c files renamed to .cpp)
KUDr <KUDr@openttd.org>
parents:
diff changeset
2016 #endif /* ENABLE_NETWORK */