src/network/network_gui.cpp
author rubidium
Sat, 17 May 2008 23:11:06 +0000
changeset 10607 1ab30cead125
parent 10596 0ee9eba64c9c
child 10625 3c1f6a26db71
permissions -rw-r--r--
(svn r13151) -Codechange: use an enum instead of bool as return type of OnKeyPress/OnCTRLStateChange to make it obvious what the return values mean.
2186
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     1
/* $Id$ */
461a2aff3486 (svn r2701) Insert Id tags into all source files
tron
parents: 2163
diff changeset
     2
10429
1b99254f9607 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 10178
diff changeset
     3
/** @file network_gui.cpp Implementation of the Network related GUIs. */
1b99254f9607 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium
parents: 10178
diff changeset
     4
4826
63b1eb7c966b (svn r6750) -Codechange: Juggle around some header includes as they're only used when
Darkvater
parents: 4774
diff changeset
     5
#ifdef ENABLE_NETWORK
5720
cc0ceeafaa55 (svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents: 5683
diff changeset
     6
#include "../stdafx.h"
cc0ceeafaa55 (svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents: 5683
diff changeset
     7
#include "../openttd.h"
8610
17cc343a23dd (svn r11675) -Codechange: split the string types from the string functions.
rubidium
parents: 8603
diff changeset
     8
#include "../strings_func.h"
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
     9
#include "network.h"
8636
2b158acb649c (svn r11702) -Codechange: move all date related stuff to date*.
rubidium
parents: 8627
diff changeset
    10
#include "../date_func.h"
5720
cc0ceeafaa55 (svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents: 5683
diff changeset
    11
#include "../fios.h"
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
    12
#include "network_data.h"
4013
a11adcc2a852 (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
    13
#include "network_client.h"
4826
63b1eb7c966b (svn r6750) -Codechange: Juggle around some header includes as they're only used when
Darkvater
parents: 4774
diff changeset
    14
#include "network_gui.h"
738
0b2fb79e64fc (svn r1194) Feature: You can now add and remove servers from the server list. Those will be remembered until you delete them by pressing the Delete key.
dominik
parents: 735
diff changeset
    15
#include "network_gamelist.h"
5720
cc0ceeafaa55 (svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents: 5683
diff changeset
    16
#include "../gui.h"
8603
88c5ce6a5215 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents: 8602
diff changeset
    17
#include "../window_gui.h"
88c5ce6a5215 (svn r11668) -Codechange: more refactoring aimed at reducing compile time and making it more logic where function definitions can be found.
rubidium
parents: 8602
diff changeset
    18
#include "../textbuf_gui.h"
5720
cc0ceeafaa55 (svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents: 5683
diff changeset
    19
#include "../variables.h"
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
    20
#include "network_server.h"
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
    21
#include "network_udp.h"
5720
cc0ceeafaa55 (svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents: 5683
diff changeset
    22
#include "../town.h"
cc0ceeafaa55 (svn r7751) -Codechange: move network_* to a new network map. Furthermore move the low level network functions to network/core, so they can be reused by the masterserver and website-serverlist-updater.
rubidium
parents: 5683
diff changeset
    23
#include "../newgrf.h"
8627
448ebf3a8291 (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents: 8626
diff changeset
    24
#include "../functions.h"
448ebf3a8291 (svn r11692) -Codechange: move some functions from 'functions.h' to a more logical place and remove about 50% of the includes of 'functions.h'
rubidium
parents: 8626
diff changeset
    25
#include "../window_func.h"
8709
4187ad809fe7 (svn r11776) -Codechange: more header splittings to reduce the dependencies.
rubidium
parents: 8704
diff changeset
    26
#include "../core/alloc_func.hpp"
8710
52015340050c (svn r11777) -Codechange: split the string header and make do not include it when it's not necessary.
rubidium
parents: 8709
diff changeset
    27
#include "../string_func.h"
8720
4e60c30e2006 (svn r11787) -Codechange: more header rewrites. This time related to viewport.h.
rubidium
parents: 8710
diff changeset
    28
#include "../gfx_func.h"
8750
fdd6054e7bae (svn r11818) -Codechange: split player.h into smaller pieces.
rubidium
parents: 8720
diff changeset
    29
#include "../player_func.h"
8766
c86cfa3a7580 (svn r11834) -Codechange: only include settings_type.h if needed.
rubidium
parents: 8760
diff changeset
    30
#include "../settings_type.h"
8780
6f3f3ec6c69a (svn r11848) -Codechange: New class-based drop down list functionality. Lists are now dynamically generated, and can include parameters, or be extended however needed.
peter1138
parents: 8766
diff changeset
    31
#include "../widgets/dropdown_func.h"
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
    32
#include "../querystring_gui.h"
10596
0ee9eba64c9c (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
parents: 10595
diff changeset
    33
#include "../sortlist_type.h"
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
8760
ce0891c412ce (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8750
diff changeset
    35
#include "table/strings.h"
ce0891c412ce (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8750
diff changeset
    36
#include "../table/sprites.h"
ce0891c412ce (svn r11828) -Codechange: include table/* as the last includes and remove an unneeded include from openttd.h.
rubidium
parents: 8750
diff changeset
    37
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
#define BGC 5
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
#define BTC 15
2887
d5967e472eee (svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents: 2886
diff changeset
    40
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
    41
/* Global to remember sorting after window has been closed */
4542
24f60077489a (svn r6372) -Codechange: static, unneeded decleration in headers, superfluous header includes
Darkvater
parents: 4512
diff changeset
    42
static Listing _ng_sorting;
2887
d5967e472eee (svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents: 2886
diff changeset
    43
4315
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
    44
static bool _chat_tab_completion_active;
3470
9dc3e8d2fde1 (svn r4315) Remove MAX_QUERYSTR_LEN, rather use lengthof() the real thing
tron
parents: 3469
diff changeset
    45
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6167
diff changeset
    46
static void ShowNetworkStartServerWindow();
2887
d5967e472eee (svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents: 2886
diff changeset
    47
static void ShowNetworkLobbyWindow(NetworkGameList *ngl);
4300
687a17c9c557 (svn r5946) -Add: merged the TGP branch to mainline. TGP adds:
truelight
parents: 4299
diff changeset
    48
extern void SwitchMode(int new_mode);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    49
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    50
static const StringID _connection_types_dropdown[] = {
675
b120ec0b3e39 (svn r1113) -Add: [Network] Added the GUI part for server advertising. When you go
truelight
parents: 670
diff changeset
    51
	STR_NETWORK_LAN_INTERNET,
b120ec0b3e39 (svn r1113) -Add: [Network] Added the GUI part for server advertising. When you go
truelight
parents: 670
diff changeset
    52
	STR_NETWORK_INTERNET_ADVERTISE,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    53
	INVALID_STRING_ID
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    54
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    55
764
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    56
static const StringID _lan_internet_types_dropdown[] = {
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    57
	STR_NETWORK_LAN,
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    58
	STR_NETWORK_INTERNET,
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    59
	INVALID_STRING_ID
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    60
};
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
    61
7292
d4cf2baf26ae (svn r10035) -Change: simplified network language string sorting
glx
parents: 7289
diff changeset
    62
static StringID _language_dropdown[NETLANG_COUNT + 1] = {STR_NULL};
7289
d6a004877931 (svn r10032) -Add: sort the strings in server language dropdown
glx
parents: 7276
diff changeset
    63
7817
f24498d934ac (svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents: 7717
diff changeset
    64
void SortNetworkLanguages()
f24498d934ac (svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents: 7717
diff changeset
    65
{
7292
d4cf2baf26ae (svn r10035) -Change: simplified network language string sorting
glx
parents: 7289
diff changeset
    66
	/* Init the strings */
d4cf2baf26ae (svn r10035) -Change: simplified network language string sorting
glx
parents: 7289
diff changeset
    67
	if (_language_dropdown[0] == STR_NULL) {
d4cf2baf26ae (svn r10035) -Change: simplified network language string sorting
glx
parents: 7289
diff changeset
    68
		for (int i = 0; i < NETLANG_COUNT; i++) _language_dropdown[i] = STR_NETWORK_LANG_ANY + i;
d4cf2baf26ae (svn r10035) -Change: simplified network language string sorting
glx
parents: 7289
diff changeset
    69
		_language_dropdown[NETLANG_COUNT] = INVALID_STRING_ID;
d4cf2baf26ae (svn r10035) -Change: simplified network language string sorting
glx
parents: 7289
diff changeset
    70
	}
7289
d6a004877931 (svn r10032) -Add: sort the strings in server language dropdown
glx
parents: 7276
diff changeset
    71
7292
d4cf2baf26ae (svn r10035) -Change: simplified network language string sorting
glx
parents: 7289
diff changeset
    72
	/* Sort the strings (we don't move 'any' and the 'invalid' one) */
d4cf2baf26ae (svn r10035) -Change: simplified network language string sorting
glx
parents: 7289
diff changeset
    73
	qsort(&_language_dropdown[1], NETLANG_COUNT - 1, sizeof(StringID), &StringIDSorter);
7289
d6a004877931 (svn r10032) -Add: sort the strings in server language dropdown
glx
parents: 7276
diff changeset
    74
}
7276
fdb2191fac67 (svn r10017) -Add (FS#790): more languages flags for servers
glx
parents: 7027
diff changeset
    75
211
2954c4b30525 (svn r212) -Fix: Network-gui fixes (sign_de)
darkvater
parents: 206
diff changeset
    76
enum {
2881
1ffbbdbf1685 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
    77
	NET_PRC__OFFSET_TOP_WIDGET          = 54,
2887
d5967e472eee (svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents: 2886
diff changeset
    78
	NET_PRC__OFFSET_TOP_WIDGET_COMPANY  = 52,
2881
1ffbbdbf1685 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
    79
	NET_PRC__SIZE_OF_ROW                = 14,
211
2954c4b30525 (svn r212) -Fix: Network-gui fixes (sign_de)
darkvater
parents: 206
diff changeset
    80
};
2954c4b30525 (svn r212) -Fix: Network-gui fixes (sign_de)
darkvater
parents: 206
diff changeset
    81
5035
e5680cce4e67 (svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents: 4957
diff changeset
    82
/** Update the network new window because a new server is
e5680cce4e67 (svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents: 4957
diff changeset
    83
 * found on the network.
e5680cce4e67 (svn r7077) -Codechange: Send proper message to network window, and handle selection control in
Darkvater
parents: 4957
diff changeset
    84
 * @param unselect unselect the currently selected item */
897
42412d5ecc64 (svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents: 893
diff changeset
    85
void UpdateNetworkGameWindow(bool unselect)
42412d5ecc64 (svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents: 893
diff changeset
    86
{
10485
331014dcd0d3 (svn r13028) -Codechange: WE_MESSAGE and WE_INVALIDATE_DATA were doing the same thing.
rubidium
parents: 10484
diff changeset
    87
	InvalidateWindowData(WC_NETWORK_WINDOW, 0, unselect);
897
42412d5ecc64 (svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents: 893
diff changeset
    88
}
42412d5ecc64 (svn r1383) Fix: You can now also delete automatically found servers by pressing "del"
dominik
parents: 893
diff changeset
    89
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
    90
static bool _internal_sort_order; // Used for Qsort order-flipping
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
    91
typedef int CDECL NGameNameSortFunction(const void*, const void*);
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
    92
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
    93
/** Qsort function to sort by name. */
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
    94
static int CDECL NGameNameSorter(const void *a, const void *b)
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
    95
{
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
    96
	const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
    97
	const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
2889
ac841003c51e (svn r3442) - Fix: Only windows has stricmp. So define strcasecmp to stricmp when using MSVC
Darkvater
parents: 2888
diff changeset
    98
	int r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
    99
4880
0708f34e3586 (svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents: 4878
diff changeset
   100
	return _internal_sort_order ? -r : r;
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   101
}
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   102
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   103
/** Qsort function to sort by the amount of clients online on a
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   104
 * server. If the two servers have the same amount, the one with the
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   105
 * higher maximum is preferred. */
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   106
static int CDECL NGameClientSorter(const void *a, const void *b)
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   107
{
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   108
	const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   109
	const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   110
	/* Reverse as per default we are interested in most-clients first */
4195
65070272012d (svn r5655) -Fix [SF 1424115]: Reversed arrow-sign in the multiplayer list column headers on sort by name
Darkvater
parents: 4171
diff changeset
   111
	int r = cmp1->info.clients_on - cmp2->info.clients_on;
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   112
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   113
	if (r == 0) r = cmp1->info.clients_max - cmp2->info.clients_max;
2922
61cf61d25de9 (svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents: 2914
diff changeset
   114
	if (r == 0) r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   115
4880
0708f34e3586 (svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents: 4878
diff changeset
   116
	return _internal_sort_order ? -r : r;
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   117
}
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   118
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   119
/** Qsort function to sort by joinability. If both servers are the
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   120
 * same, prefer the non-passworded server first. */
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   121
static int CDECL NGameAllowedSorter(const void *a, const void *b)
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   122
{
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   123
	const NetworkGameList *cmp1 = *(const NetworkGameList**)a;
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   124
	const NetworkGameList *cmp2 = *(const NetworkGameList**)b;
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   125
5909
edf0f4a1f118 (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium
parents: 5860
diff changeset
   126
	/* The servers we do not know anything about (the ones that did not reply) should be at the bottom) */
edf0f4a1f118 (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium
parents: 5860
diff changeset
   127
	int r = StrEmpty(cmp1->info.server_revision) - StrEmpty(cmp2->info.server_revision);
edf0f4a1f118 (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium
parents: 5860
diff changeset
   128
edf0f4a1f118 (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium
parents: 5860
diff changeset
   129
	/* Reverse default as we are interested in version-compatible clients first */
edf0f4a1f118 (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium
parents: 5860
diff changeset
   130
	if (r == 0) r = cmp2->info.version_compatible - cmp1->info.version_compatible;
edf0f4a1f118 (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium
parents: 5860
diff changeset
   131
	/* The version-compatible ones are then sorted with NewGRF compatible first, incompatible last */
edf0f4a1f118 (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium
parents: 5860
diff changeset
   132
	if (r == 0) r = cmp2->info.compatible - cmp1->info.compatible;
edf0f4a1f118 (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium
parents: 5860
diff changeset
   133
	/* Passworded servers should be below unpassworded servers */
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   134
	if (r == 0) r = cmp1->info.use_password - cmp2->info.use_password;
5909
edf0f4a1f118 (svn r8118) -Codechange: change the ordering of the network list a little:
rubidium
parents: 5860
diff changeset
   135
	/* Finally sort on the name of the server */
2922
61cf61d25de9 (svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents: 2914
diff changeset
   136
	if (r == 0) r = strcasecmp(cmp1->info.server_name, cmp2->info.server_name);
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   137
4880
0708f34e3586 (svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents: 4878
diff changeset
   138
	return _internal_sort_order ? -r : r;
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   139
}
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
   140
8456
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   141
/** Enum for NetworkGameWindow, referring to _network_game_window_widgets */
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   142
enum NetworkGameWindowWidgets {
10170
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   143
	NGWW_CLOSE,         ///< Close 'X' button
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   144
	NGWW_CAPTION,       ///< Caption of the window
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   145
	NGWW_RESIZE,        ///< Resize button
8456
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   146
10170
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   147
	NGWW_CONNECTION,    ///< Label in from of connection droplist
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   148
	NGWW_CONN_BTN,      ///< 'Connection' droplist button
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   149
	NGWW_PLAYER,        ///< Panel with editbox to set player name
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   150
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   151
	NGWW_NAME,          ///< 'Name' button
8456
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   152
	NGWW_CLIENTS,       ///< 'Clients' button
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   153
	NGWW_INFO,          ///< Third button in the game list panel
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   154
10170
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   155
	NGWW_MATRIX,        ///< Panel with list of games
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   156
	NGWW_SCROLLBAR,     ///< Scrollbar of matrix
8456
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   157
10178
8fde48e0ddac (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 10170
diff changeset
   158
	NGWW_LASTJOINED_LABEL, ///< Label "Last joined server:"
8fde48e0ddac (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 10170
diff changeset
   159
	NGWW_LASTJOINED,    ///< Info about the last joined server
8fde48e0ddac (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 10170
diff changeset
   160
10170
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   161
	NGWW_DETAILS,       ///< Panel with game details
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   162
	NGWW_JOIN,          ///< 'Join game' button
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   163
	NGWW_REFRESH,       ///< 'Refresh server' button
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   164
	NGWW_NEWGRF,        ///< 'NewGRF Settings' button
8456
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   165
10170
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   166
	NGWW_FIND,          ///< 'Find server' button
8456
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   167
	NGWW_ADD,           ///< 'Add server' button
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   168
	NGWW_START,         ///< 'Start server' button
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   169
	NGWW_CANCEL,        ///< 'Cancel' button
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   170
};
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   171
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   172
typedef GUIList<NetworkGameList*> GUIGameServerList;
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   173
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   174
struct NetworkGameWindow : public QueryStringBaseWindow {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   175
	byte field;                  ///< selected text-field
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   176
	NetworkGameList *server;     ///< selected server
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   177
	GUIGameServerList servers;   ///< list with game servers.
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   178
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   179
	NetworkGameWindow(const WindowDesc *desc) : QueryStringBaseWindow(desc)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   180
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   181
		ttd_strlcpy(this->edit_str_buf, _network_player_name, lengthof(this->edit_str_buf));
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   182
		this->afilter = CS_ALPHANUMERAL;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   183
		InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 120);
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   184
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   185
		UpdateNetworkGameWindow(true);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   186
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   187
		this->vscroll.cap = 11;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   188
		this->resize.step_height = NET_PRC__SIZE_OF_ROW;
10178
8fde48e0ddac (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 10170
diff changeset
   189
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   190
		this->field = NGWW_PLAYER;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   191
		this->server = NULL;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   192
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   193
		this->servers.sort_list = NULL;
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   194
		this->servers.flags = VL_REBUILD | (_ng_sorting.order ? VL_DESC : VL_NONE);
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   195
		this->servers.sort_type = _ng_sorting.criteria;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   196
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   197
		this->FindWindowPlacementAndResize(desc);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   198
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   199
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   200
	~NetworkGameWindow()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   201
	{
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   202
		free(this->servers.sort_list);
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   203
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   204
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   205
	/**
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   206
	 * (Re)build the network game list as its amount has changed because
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   207
	 * an item has been added or deleted for example
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   208
	 */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   209
	void BuildNetworkGameList()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   210
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   211
		NetworkGameList *ngl_temp;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   212
		uint n = 0;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   213
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   214
		if (!(this->servers.flags & VL_REBUILD)) return;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   215
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   216
		/* Count the number of games in the list */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   217
		for (ngl_temp = _network_game_list; ngl_temp != NULL; ngl_temp = ngl_temp->next) n++;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   218
		if (n == 0) return;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   219
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   220
		/* Create temporary array of games to use for listing */
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   221
		this->servers.sort_list = ReallocT(this->servers.sort_list, n);
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   222
		this->servers.list_length = n;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   223
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   224
		for (n = 0, ngl_temp = _network_game_list; ngl_temp != NULL; ngl_temp = ngl_temp->next) {
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   225
			this->servers.sort_list[n++] = ngl_temp;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   226
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   227
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   228
		/* Force resort */
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   229
		this->servers.flags &= ~VL_REBUILD;
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   230
		this->servers.flags |= VL_RESORT;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   231
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   232
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   233
	void SortNetworkGameList()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   234
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   235
		static NGameNameSortFunction * const ngame_sorter[] = {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   236
			&NGameNameSorter,
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   237
			&NGameClientSorter,
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   238
			&NGameAllowedSorter
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   239
		};
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   240
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   241
		NetworkGameList *item;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   242
		uint i;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   243
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   244
		if (!(this->servers.flags & VL_RESORT)) return;
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   245
		if (this->servers.list_length == 0) return;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   246
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   247
		_internal_sort_order = !!(this->servers.flags & VL_DESC);
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   248
		qsort(this->servers.sort_list, this->servers.list_length, sizeof(this->servers.sort_list[0]), ngame_sorter[this->servers.sort_type]);
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   249
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   250
		/* After sorting ngl->sort_list contains the sorted items. Put these back
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   251
		 * into the original list. Basically nothing has changed, we are only
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   252
		 * shuffling the ->next pointers */
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   253
		_network_game_list = this->servers.sort_list[0];
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   254
		for (item = _network_game_list, i = 1; i != this->servers.list_length; i++) {
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   255
			item->next = this->servers.sort_list[i];
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   256
			item = item->next;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   257
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   258
		item->next = NULL;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   259
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   260
		this->servers.flags &= ~VL_RESORT;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   261
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   262
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   263
	/**
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   264
	 * Draw a single server line.
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   265
	 * @param cur_item  the server to draw.
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   266
	 * @param y         from where to draw?
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   267
	 * @param highlight does the line need to be highlighted?
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   268
	 */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   269
	void DrawServerLine(const NetworkGameList *cur_item, uint y, bool highlight)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   270
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   271
		/* show highlighted item with a different colour */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   272
		if (highlight) GfxFillRect(this->widget[NGWW_NAME].left + 1, y - 2, this->widget[NGWW_INFO].right - 1, y + 9, 10);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   273
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   274
		SetDParamStr(0, cur_item->info.server_name);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   275
		DrawStringTruncated(this->widget[NGWW_NAME].left + 5, y, STR_02BD, TC_BLACK, this->widget[NGWW_NAME].right - this->widget[NGWW_NAME].left - 5);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   276
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   277
		SetDParam(0, cur_item->info.clients_on);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   278
		SetDParam(1, cur_item->info.clients_max);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   279
		SetDParam(2, cur_item->info.companies_on);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   280
		SetDParam(3, cur_item->info.companies_max);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   281
		DrawStringCentered(this->widget[NGWW_CLIENTS].left + 39, y, STR_NETWORK_GENERAL_ONLINE, TC_GOLD);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   282
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   283
		/* only draw icons if the server is online */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   284
		if (cur_item->online) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   285
			/* draw a lock if the server is password protected */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   286
			if (cur_item->info.use_password) DrawSprite(SPR_LOCK, PAL_NONE, this->widget[NGWW_INFO].left + 5, y - 1);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   287
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   288
			/* draw red or green icon, depending on compatibility with server */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   289
			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);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   290
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   291
			/* draw flag according to server language */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   292
			DrawSprite(SPR_FLAGS_BASE + cur_item->info.server_lang, PAL_NONE, this->widget[NGWW_INFO].left + 25, y);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   293
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   294
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   295
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   296
	virtual void OnPaint()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   297
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   298
		const NetworkGameList *sel = this->server;
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   299
		const SortButtonState arrow = (this->servers.flags & VL_DESC) ? SBS_DOWN : SBS_UP;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   300
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   301
		if (this->servers.flags & VL_REBUILD) {
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   302
			this->BuildNetworkGameList();
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   303
			SetVScrollCount(this, this->servers.list_length);
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   304
		}
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   305
		if (this->servers.flags & VL_RESORT) this->SortNetworkGameList();
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   306
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   307
		/* 'Refresh' button invisible if no server selected */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   308
		this->SetWidgetDisabledState(NGWW_REFRESH, sel == NULL);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   309
		/* 'Join' button disabling conditions */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   310
		this->SetWidgetDisabledState(NGWW_JOIN, sel == NULL || // no Selected Server
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   311
				!sel->online || // Server offline
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   312
				sel->info.clients_on >= sel->info.clients_max || // Server full
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   313
				!sel->info.compatible); // Revision mismatch
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   314
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   315
		/* 'NewGRF Settings' button invisible if no NewGRF is used */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   316
		this->SetWidgetHiddenState(NGWW_NEWGRF, sel == NULL ||
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   317
				!sel->online ||
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   318
				sel->info.grfconfig == NULL);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   319
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   320
		SetDParam(0, 0x00);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   321
		SetDParam(1, _lan_internet_types_dropdown[_network_lan_internet]);
10595
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
   322
		this->DrawWidgets();
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   323
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   324
		/* Edit box to set player name */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   325
		this->DrawEditBox(NGWW_PLAYER);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   326
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   327
		DrawString(this->widget[NGWW_PLAYER].left - 100, 23, STR_NETWORK_PLAYER_NAME, TC_GOLD);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   328
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   329
		/* Sort based on widgets: name, clients, compatibility */
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   330
		switch (this->servers.sort_type) {
10595
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
   331
			case NGWW_NAME    - NGWW_NAME: this->DrawSortButtonState(NGWW_NAME,    arrow); break;
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
   332
			case NGWW_CLIENTS - NGWW_NAME: this->DrawSortButtonState(NGWW_CLIENTS, arrow); break;
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
   333
			case NGWW_INFO    - NGWW_NAME: this->DrawSortButtonState(NGWW_INFO,    arrow); break;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   334
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   335
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   336
		uint16 y = NET_PRC__OFFSET_TOP_WIDGET + 3;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   337
		int32 n = 0;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   338
		int32 pos = this->vscroll.pos;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   339
		const NetworkGameList *cur_item = _network_game_list;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   340
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   341
		while (pos > 0 && cur_item != NULL) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   342
			pos--;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   343
			cur_item = cur_item->next;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   344
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   345
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   346
		while (cur_item != NULL) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   347
			this->DrawServerLine(cur_item, y, cur_item == sel);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   348
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   349
			cur_item = cur_item->next;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   350
			y += NET_PRC__SIZE_OF_ROW;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   351
			if (++n == this->vscroll.cap) break; // max number of games in the window
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   352
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   353
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   354
		const NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_network_last_host), _network_last_port);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   355
		/* Draw the last joined server, if any */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   356
		if (last_joined != NULL) this->DrawServerLine(last_joined, y = this->widget[NGWW_LASTJOINED].top + 3, last_joined == sel);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   357
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   358
		/* Draw the right menu */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   359
		GfxFillRect(this->widget[NGWW_DETAILS].left + 1, 43, this->widget[NGWW_DETAILS].right - 1, 92, 157);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   360
		if (sel == NULL) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   361
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 58, STR_NETWORK_GAME_INFO, TC_FROMSTRING);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   362
		} else if (!sel->online) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   363
			SetDParamStr(0, sel->info.server_name);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   364
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 68, STR_ORANGE, TC_FROMSTRING); // game name
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   365
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   366
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 132, STR_NETWORK_SERVER_OFFLINE, TC_FROMSTRING); // server offline
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   367
		} else { // show game info
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   368
			uint16 y = 100;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   369
			const uint16 x = this->widget[NGWW_DETAILS].left + 5;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   370
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   371
			DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, 48, STR_NETWORK_GAME_INFO, TC_FROMSTRING);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   372
2055
9361b56db8ba (svn r2564) Fix: Fixed conceptual issue in network_gui.c. AllocateName is not meant to be used by GUI-code, because it modifies the "game-state".
ludde
parents: 1916
diff changeset
   373
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   374
			SetDParamStr(0, sel->info.server_name);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   375
			DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 62, STR_ORANGE, TC_BLACK); // game name
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   376
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   377
			SetDParamStr(0, sel->info.map_name);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   378
			DrawStringCenteredTruncated(this->widget[NGWW_DETAILS].left, this->widget[NGWW_DETAILS].right, 74, STR_02BD, TC_BLACK); // map name
10178
8fde48e0ddac (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 10170
diff changeset
   379
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   380
			SetDParam(0, sel->info.clients_on);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   381
			SetDParam(1, sel->info.clients_max);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   382
			SetDParam(2, sel->info.companies_on);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   383
			SetDParam(3, sel->info.companies_max);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   384
			DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   385
			y += 10;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   386
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   387
			SetDParam(0, STR_NETWORK_LANG_ANY + sel->info.server_lang);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   388
			DrawString(x, y, STR_NETWORK_LANGUAGE, TC_GOLD); // server language
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   389
			y += 10;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   390
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   391
			SetDParam(0, STR_TEMPERATE_LANDSCAPE + sel->info.map_set);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   392
			DrawString(x, y, STR_NETWORK_TILESET, TC_GOLD); // tileset
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   393
			y += 10;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   394
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   395
			SetDParam(0, sel->info.map_width);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   396
			SetDParam(1, sel->info.map_height);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   397
			DrawString(x, y, STR_NETWORK_MAP_SIZE, TC_GOLD); // map size
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   398
			y += 10;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   399
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   400
			SetDParamStr(0, sel->info.server_revision);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   401
			DrawString(x, y, STR_NETWORK_SERVER_VERSION, TC_GOLD); // server version
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   402
			y += 10;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   403
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   404
			SetDParamStr(0, sel->info.hostname);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   405
			SetDParam(1, sel->port);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   406
			DrawString(x, y, STR_NETWORK_SERVER_ADDRESS, TC_GOLD); // server address
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   407
			y += 10;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   408
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   409
			SetDParam(0, sel->info.start_date);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   410
			DrawString(x, y, STR_NETWORK_START_DATE, TC_GOLD); // start date
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   411
			y += 10;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   412
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   413
			SetDParam(0, sel->info.game_date);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   414
			DrawString(x, y, STR_NETWORK_CURRENT_DATE, TC_GOLD); // current date
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   415
			y += 10;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   416
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   417
			y += 2;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   418
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   419
			if (!sel->info.compatible) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   420
				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, sel->info.version_compatible ? STR_NETWORK_GRF_MISMATCH : STR_NETWORK_VERSION_MISMATCH, TC_FROMSTRING); // server mismatch
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   421
			} else if (sel->info.clients_on == sel->info.clients_max) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   422
				/* Show: server full, when clients_on == clients_max */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   423
				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_SERVER_FULL, TC_FROMSTRING); // server full
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   424
			} else if (sel->info.use_password) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   425
				DrawStringCentered(this->widget[NGWW_DETAILS].left + 115, y, STR_NETWORK_PASSWORD, TC_FROMSTRING); // password warning
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   426
			}
659
a98c731921b4 (svn r1093) -Fix: Hopefully fixed windows revision issues once and for all. Removed globalness of _openttd_revision and put all such ifdefs into one place. If server has a revision only the same revisions can join; if the server has no revision everyone can join. I reckon this should be a server-side option to allow people to join or not to join.
darkvater
parents: 656
diff changeset
   427
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   428
			y += 10;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   429
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   430
	}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   431
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   432
	virtual void OnClick(Point pt, int widget)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   433
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   434
		this->field = widget;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   435
		switch (widget) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   436
			case NGWW_PLAYER:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   437
				ShowOnScreenKeyboard(this, NGWW_PLAYER, 0, 0);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   438
				break;
741
39a3958887c1 (svn r1197) -Fix: [GUI] in r1194 someone deleted too much code from WE_KEYPRESS. Now
truelight
parents: 738
diff changeset
   439
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   440
			case NGWW_CANCEL: // Cancel button
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   441
				DeleteWindowById(WC_NETWORK_WINDOW, 0);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   442
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   443
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   444
			case NGWW_CONN_BTN: // 'Connection' droplist
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   445
				ShowDropDownMenu(this, _lan_internet_types_dropdown, _network_lan_internet, NGWW_CONN_BTN, 0, 0); // do it for widget NSSW_CONN_BTN
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   446
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   447
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   448
			case NGWW_NAME: // Sort by name
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   449
			case NGWW_CLIENTS: // Sort by connected clients
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   450
			case NGWW_INFO: // Connectivity (green dot)
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   451
				if (this->servers.sort_type == widget - NGWW_NAME) this->servers.flags ^= VL_DESC;
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   452
				this->servers.flags |= VL_RESORT;
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   453
				this->servers.sort_type = widget - NGWW_NAME;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   454
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   455
				_ng_sorting.order = !!(this->servers.flags & VL_DESC);
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   456
				_ng_sorting.criteria = this->servers.sort_type;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   457
				this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   458
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   459
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   460
			case NGWW_MATRIX: { // Matrix to show networkgames
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   461
				NetworkGameList *cur_item;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   462
				uint32 id_v = (pt.y - NET_PRC__OFFSET_TOP_WIDGET) / NET_PRC__SIZE_OF_ROW;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   463
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   464
				if (id_v >= this->vscroll.cap) return; // click out of bounds
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   465
				id_v += this->vscroll.pos;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   466
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   467
				cur_item = _network_game_list;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   468
				for (; id_v > 0 && cur_item != NULL; id_v--) cur_item = cur_item->next;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   469
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   470
				this->server = cur_item;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   471
				this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   472
			} break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   473
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   474
			case NGWW_LASTJOINED: {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   475
				NetworkGameList *last_joined = NetworkGameListAddItem(inet_addr(_network_last_host), _network_last_port);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   476
				if (last_joined != NULL) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   477
					this->server = last_joined;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   478
					this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   479
				}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   480
			} break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   481
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   482
			case NGWW_FIND: // Find server automatically
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   483
				switch (_network_lan_internet) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   484
					case 0: NetworkUDPSearchGame(); break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   485
					case 1: NetworkUDPQueryMasterServer(); break;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   486
				}
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   487
				break;
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   488
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   489
			case NGWW_ADD: // Add a server
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   490
				ShowQueryString(
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   491
					BindCString(_network_default_ip),
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   492
					STR_NETWORK_ENTER_IP,
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   493
					31 | 0x1000,  // maximum number of characters OR
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   494
					250, // characters up to this width pixels, whichever is satisfied first
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   495
					this, CS_ALPHANUMERAL);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   496
				break;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   497
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   498
			case NGWW_START: // Start server
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   499
				ShowNetworkStartServerWindow();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   500
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   501
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   502
			case NGWW_JOIN: // Join Game
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   503
				if (this->server != NULL) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   504
					snprintf(_network_last_host, sizeof(_network_last_host), "%s", inet_ntoa(*(struct in_addr *)&this->server->ip));
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   505
					_network_last_port = this->server->port;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   506
					ShowNetworkLobbyWindow(this->server);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   507
				}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   508
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   509
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   510
			case NGWW_REFRESH: // Refresh
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   511
				if (this->server != NULL) NetworkUDPQueryServer(this->server->info.hostname, this->server->port);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   512
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   513
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   514
			case NGWW_NEWGRF: // NewGRF Settings
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   515
				if (this->server != NULL) ShowNewGRFSettings(false, false, false, &this->server->info.grfconfig);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   516
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   517
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   518
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   519
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   520
	virtual void OnDropdownSelect(int widget, int index)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   521
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   522
		switch (widget) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   523
			case NGWW_CONN_BTN:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   524
				_network_lan_internet = index;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   525
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   526
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   527
			default:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   528
				NOT_REACHED();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   529
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   530
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   531
		this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   532
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   533
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   534
	virtual void OnMouseLoop()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   535
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   536
		if (this->field == NGWW_PLAYER) this->HandleEditBox(NGWW_PLAYER);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   537
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   538
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   539
	virtual void OnInvalidateData(int data)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   540
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   541
		if (data != 0) this->server = NULL;
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   542
		this->servers.flags |= VL_REBUILD;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   543
		this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   544
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   545
10607
1ab30cead125 (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
parents: 10596
diff changeset
   546
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   547
	{
10607
1ab30cead125 (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
parents: 10596
diff changeset
   548
		EventState state = ES_NOT_HANDLED;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   549
		if (this->field != NGWW_PLAYER) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   550
			if (this->server != NULL) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   551
				if (keycode == WKC_DELETE) { // Press 'delete' to remove servers
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   552
					NetworkGameListRemoveItem(this->server);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   553
					NetworkRebuildHostList();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   554
					this->server = NULL;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   555
				}
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   556
			}
10607
1ab30cead125 (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
parents: 10596
diff changeset
   557
			return state;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   558
		}
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   559
10607
1ab30cead125 (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
parents: 10596
diff changeset
   560
		if (this->HandleEditBoxKey(NGWW_PLAYER, keycode, key, state) == 1) return state; // enter pressed
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   561
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   562
		/* The name is only allowed when it starts with a letter! */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   563
		if (StrEmpty(this->edit_str_buf) && this->edit_str_buf[0] != ' ') {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   564
			ttd_strlcpy(_network_player_name, this->edit_str_buf, lengthof(_network_player_name));
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   565
		} else {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   566
			ttd_strlcpy(_network_player_name, "Player", lengthof(_network_player_name));
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   567
		}
10607
1ab30cead125 (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
parents: 10596
diff changeset
   568
		return state;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   569
	}
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   570
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   571
	virtual void OnQueryTextFinished(char *str)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   572
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   573
		if (!StrEmpty(str)) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   574
			NetworkAddServer(str);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   575
			NetworkRebuildHostList();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   576
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   577
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   578
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   579
	virtual void OnResize(Point new_size, Point delta)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   580
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   581
		this->vscroll.cap += delta.y / (int)this->resize.step_height;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   582
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   583
		this->widget[NGWW_MATRIX].data = (this->vscroll.cap << 8) + 1;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   584
10502
996d9308d650 (svn r13045) -Codechange: make list_d (now GUIList) more generic and uniform.
rubidium
parents: 10501
diff changeset
   585
		SetVScrollCount(this, this->servers.list_length);
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   586
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   587
		int widget_width = this->widget[NGWW_FIND].right - this->widget[NGWW_FIND].left;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   588
		int space = (this->width - 4 * widget_width - 25) / 3;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   589
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   590
		int offset = 10;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   591
		for (uint i = 0; i < 4; i++) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   592
			this->widget[NGWW_FIND + i].left  = offset;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   593
			offset += widget_width;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   594
			this->widget[NGWW_FIND + i].right = offset;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   595
			offset += space;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   596
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   597
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   598
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   599
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   600
static const Widget _network_game_window_widgets[] = {
8456
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   601
/* TOP */
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   602
{   WWT_CLOSEBOX,   RESIZE_NONE,   BGC,     0,    10,     0,    13, STR_00C5,                         STR_018B_CLOSE_WINDOW},            // NGWW_CLOSE
10170
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   603
{    WWT_CAPTION,   RESIZE_RIGHT,  BGC,    11,   449,     0,    13, STR_NETWORK_MULTIPLAYER,          STR_NULL},                         // NGWW_CAPTION
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   604
{      WWT_PANEL,   RESIZE_RB,     BGC,     0,   449,    14,   263, 0x0,                              STR_NULL},                         // NGWW_RESIZE
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   605
10170
39c950e2ab9d (svn r12701) -Codechange: do not explicitly number a widget enum because that causes a big diff when adding something.
rubidium
parents: 9234
diff changeset
   606
{       WWT_TEXT,   RESIZE_NONE,   BGC,     9,    85,    23,    35, STR_NETWORK_CONNECTION,           STR_NULL},                         // NGWW_CONNECTION
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   607
{ WWT_DROPDOWNIN,   RESIZE_NONE,   BGC,    90,   181,    22,    33, STR_NETWORK_LAN_INTERNET_COMBO,   STR_NETWORK_CONNECTION_TIP},       // NGWW_CONN_BTN
2881
1ffbbdbf1685 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
   608
9233
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 9224
diff changeset
   609
{    WWT_EDITBOX,   RESIZE_LR,     BGC,   290,   440,    22,    33, STR_NETWORK_PLAYER_NAME_OSKTITLE, STR_NETWORK_ENTER_NAME_TIP},       // NGWW_PLAYER
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4329
diff changeset
   610
8456
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   611
/* LEFT SIDE */
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   612
{ WWT_PUSHTXTBTN,   RESIZE_RIGHT,  BTC,    10,    70,    42,    53, STR_NETWORK_GAME_NAME,            STR_NETWORK_GAME_NAME_TIP},        // NGWW_NAME
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   613
{ WWT_PUSHTXTBTN,   RESIZE_LR,     BTC,    71,   150,    42,    53, STR_NETWORK_CLIENTS_CAPTION,      STR_NETWORK_CLIENTS_CAPTION_TIP},  // NGWW_CLIENTS
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   614
{ WWT_PUSHTXTBTN,   RESIZE_LR,     BTC,   151,   190,    42,    53, STR_EMPTY,                        STR_NETWORK_INFO_ICONS_TIP},       // NGWW_INFO
7935
b5bc2bd79e6b (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
parents: 7859
diff changeset
   615
10178
8fde48e0ddac (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 10170
diff changeset
   616
{     WWT_MATRIX,   RESIZE_RB,     BGC,    10,   190,    54,   208, (11 << 8) + 1,                    STR_NETWORK_CLICK_GAME_TO_SELECT}, // NGWW_MATRIX
8fde48e0ddac (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 10170
diff changeset
   617
{  WWT_SCROLLBAR,   RESIZE_LRB,    BGC,   191,   202,    42,   208, 0x0,                              STR_0190_SCROLL_BAR_SCROLLS_LIST}, // NGWW_SCROLLBAR
8fde48e0ddac (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 10170
diff changeset
   618
{       WWT_TEXT,   RESIZE_RTB,    BGC,    10,   190,   211,   222, STR_NETWORK_LAST_JOINED_SERVER,   STR_NULL},                         // NGWW_LASTJOINED_LABEL
8fde48e0ddac (svn r12709) -Feature: show the last joined server. Heavily based on a patch by Yexo.
rubidium
parents: 10170
diff changeset
   619
{      WWT_PANEL,   RESIZE_RTB,    BGC,    10,   190,   223,   236, 0x0,                              STR_NETWORK_CLICK_TO_SELECT_LAST}, // NGWW_LASTJOINED
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   620
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   621
/* RIGHT SIDE */
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   622
{      WWT_PANEL,   RESIZE_LRB,    BGC,   210,   440,    42,   236, 0x0,                              STR_NULL},                         // NGWW_DETAILS
2881
1ffbbdbf1685 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
   623
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   624
{ WWT_PUSHTXTBTN,   RESIZE_LRTB,   BTC,   215,   315,   215,   226, STR_NETWORK_JOIN_GAME,            STR_NULL},                         // NGWW_JOIN
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   625
{ WWT_PUSHTXTBTN,   RESIZE_LRTB,   BTC,   330,   435,   215,   226, STR_NETWORK_REFRESH,              STR_NETWORK_REFRESH_TIP},          // NGWW_REFRESH
5339
7573f179efe8 (svn r7505) -Feature: show NewGRFs used on a game server, show which NewGRFs you do and do not have.
rubidium
parents: 5247
diff changeset
   626
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   627
{ WWT_PUSHTXTBTN,   RESIZE_LRTB,   BTC,   330,   435,   197,   208, STR_NEWGRF_SETTINGS_BUTTON,       STR_NULL},                         // NGWW_NEWGRF
7839
5c43edaa9de0 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium
parents: 7837
diff changeset
   628
8456
bec1891e42b5 (svn r11516) -Codechange: cleanup of NetworkGameWindow in network_gui.cpp
smatz
parents: 8455
diff changeset
   629
/* BOTTOM */
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   630
{ WWT_PUSHTXTBTN,   RESIZE_TB,     BTC,    10,   110,   246,   257, STR_NETWORK_FIND_SERVER,          STR_NETWORK_FIND_SERVER_TIP},      // NGWW_FIND
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   631
{ WWT_PUSHTXTBTN,   RESIZE_TB,     BTC,   118,   218,   246,   257, STR_NETWORK_ADD_SERVER,           STR_NETWORK_ADD_SERVER_TIP},       // NGWW_ADD
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   632
{ WWT_PUSHTXTBTN,   RESIZE_TB,     BTC,   226,   326,   246,   257, STR_NETWORK_START_SERVER,         STR_NETWORK_START_SERVER_TIP},     // NGWW_START
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   633
{ WWT_PUSHTXTBTN,   RESIZE_TB,     BTC,   334,   434,   246,   257, STR_012E_CANCEL,                  STR_NULL},                         // NGWW_CANCEL
7935
b5bc2bd79e6b (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
parents: 7859
diff changeset
   634
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   635
{  WWT_RESIZEBOX,   RESIZE_LRTB,   BGC,   438,   449,   252,   263, 0x0,                              STR_RESIZE_BUTTON },
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   636
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 175
diff changeset
   637
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   638
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   639
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   640
static const WindowDesc _network_game_window_desc = {
7839
5c43edaa9de0 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium
parents: 7837
diff changeset
   641
	WDP_CENTER, WDP_CENTER, 450, 264, 550, 264,
6144
5a0ffbf27ced (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5920
diff changeset
   642
	WC_NETWORK_WINDOW, WC_NONE,
7839
5c43edaa9de0 (svn r10706) -Codechange: allow resizing the multiplayer server list window.
rubidium
parents: 7837
diff changeset
   643
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_STD_BTN | WDF_UNCLICK_BUTTONS | WDF_RESIZABLE,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   644
	_network_game_window_widgets,
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   645
	NULL,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   646
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   647
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6167
diff changeset
   648
void ShowNetworkGameWindow()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   649
{
2922
61cf61d25de9 (svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents: 2914
diff changeset
   650
	static bool first = true;
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   651
	DeleteWindowById(WC_NETWORK_WINDOW, 0);
105
44e894da0fef (svn r106) New network core (by sign_de)
dominik
parents: 1
diff changeset
   652
764
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
   653
	/* Only show once */
2922
61cf61d25de9 (svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents: 2914
diff changeset
   654
	if (first) {
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   655
		char * const *srv;
2881
1ffbbdbf1685 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
   656
2922
61cf61d25de9 (svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents: 2914
diff changeset
   657
		first = false;
764
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
   658
		// add all servers from the config file to our list
2885
c06f2f3985a0 (svn r3435) - Fix a warning, removed unused extern and some comments in network_gamelist.c
Darkvater
parents: 2884
diff changeset
   659
		for (srv = &_network_host_list[0]; srv != endof(_network_host_list) && *srv != NULL; srv++) {
2881
1ffbbdbf1685 (svn r3429) - Feature (Followup): Change the gamelist window to accomodate for the new information.
Darkvater
parents: 2879
diff changeset
   660
			NetworkAddServer(*srv);
764
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
   661
		}
2922
61cf61d25de9 (svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents: 2914
diff changeset
   662
61cf61d25de9 (svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents: 2914
diff changeset
   663
		_ng_sorting.criteria = 2; // sort default by collectivity (green-dots on top)
61cf61d25de9 (svn r3478) - Fix: In the network game list do the default sorting on connectivity (so servers which you can join are on top) and sort on names as a second criteria on clients and connectivity.
Darkvater
parents: 2914
diff changeset
   664
		_ng_sorting.order = 0;    // sort ascending by default
764
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
   665
	}
68b398e2b780 (svn r1227) -Add: Ingame Server-list (select Internet, then Find Servers)
truelight
parents: 749
diff changeset
   666
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   667
	new NetworkGameWindow(&_network_game_window_desc);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   668
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   669
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   670
enum {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   671
	NSSWND_START = 64,
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   672
	NSSWND_ROWSIZE = 12
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   673
};
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
   674
8455
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   675
/** Enum for NetworkStartServerWindow, referring to _network_start_server_window_widgets */
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   676
enum NetworkStartServerWidgets {
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   677
	NSSW_CLOSE           =  0,   ///< Close 'X' button
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   678
	NSSW_GAMENAME        =  4,   ///< Background for editbox to set game name
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   679
	NSSW_SETPWD          =  5,   ///< 'Set password' button
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   680
	NSSW_SELMAP          =  7,   ///< 'Select map' list
8839
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   681
	NSSW_CONNTYPE_BTN    = 10,   ///< 'Connection type' droplist button
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   682
	NSSW_CLIENTS_BTND    = 12,   ///< 'Max clients' downarrow
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   683
	NSSW_CLIENTS_TXT     = 13,   ///< 'Max clients' text
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   684
	NSSW_CLIENTS_BTNU    = 14,   ///< 'Max clients' uparrow
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   685
	NSSW_COMPANIES_BTND  = 16,   ///< 'Max companies' downarrow
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   686
	NSSW_COMPANIES_TXT   = 17,   ///< 'Max companies' text
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   687
	NSSW_COMPANIES_BTNU  = 18,   ///< 'Max companies' uparrow
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   688
	NSSW_SPECTATORS_BTND = 20,   ///< 'Max spectators' downarrow
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   689
	NSSW_SPECTATORS_TXT  = 21,   ///< 'Max spectators' text
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   690
	NSSW_SPECTATORS_BTNU = 22,   ///< 'Max spectators' uparrow
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   691
	NSSW_LANGUAGE_BTN    = 24,   ///< 'Language spoken' droplist button
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   692
	NSSW_START           = 25,   ///< 'Start' button
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   693
	NSSW_LOAD            = 26,   ///< 'Load' button
bd8a5bb77cd7 (svn r11909) -Codechange: use dropdown widget for player livery, network lobby/setup and news settings windows
peter1138
parents: 8780
diff changeset
   694
	NSSW_CANCEL          = 27,   ///< 'Cancel' button
8455
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   695
};
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   696
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   697
struct NetworkStartServerWindow : public QueryStringBaseWindow {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   698
	byte field;                  ///< Selected text-field
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   699
	FiosItem *map;               ///< Selected map
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   700
	byte widget_id;              ///< The widget that has the pop-up input menu
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   701
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   702
	NetworkStartServerWindow(const WindowDesc *desc) : QueryStringBaseWindow(desc)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   703
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   704
		ttd_strlcpy(this->edit_str_buf, _network_server_name, lengthof(this->edit_str_buf));
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   705
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   706
		_saveload_mode = SLD_NEW_GAME;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   707
		BuildFileList();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   708
		this->vscroll.cap = 12;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   709
		this->vscroll.count = _fios_num + 1;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   710
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   711
		this->afilter = CS_ALPHANUMERAL;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   712
		InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 160);
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   713
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   714
		this->field = NSSW_GAMENAME;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   715
		_network_game_info.use_password = !StrEmpty(_network_server_password);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   716
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   717
		this->FindWindowPlacementAndResize(desc);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   718
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   719
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   720
	virtual void OnPaint()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   721
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   722
		int y = NSSWND_START, pos;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   723
		const FiosItem *item;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   724
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   725
		/* draw basic widgets */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   726
		SetDParam(1, _connection_types_dropdown[_network_advertise]);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   727
		SetDParam(2, _network_game_info.clients_max);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   728
		SetDParam(3, _network_game_info.companies_max);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   729
		SetDParam(4, _network_game_info.spectators_max);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   730
		SetDParam(5, STR_NETWORK_LANG_ANY + _network_game_info.server_lang);
10595
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
   731
		this->DrawWidgets();
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   732
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   733
		/* editbox to set game name */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   734
		this->DrawEditBox(NSSW_GAMENAME);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   735
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   736
		/* if password is set, draw red '*' next to 'Set password' button */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   737
		if (_network_game_info.use_password) DoDrawString("*", 408, 23, TC_RED);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   738
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   739
		/* draw list of maps */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   740
		GfxFillRect(11, 63, 258, 215, 0xD7);  // black background of maps list
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   741
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   742
		pos = this->vscroll.pos;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   743
		while (pos < _fios_num + 1) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   744
			item = _fios_list + pos - 1;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   745
			if (item == this->map || (pos == 0 && this->map == NULL))
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   746
				GfxFillRect(11, y - 1, 258, y + 10, 155); // show highlighted item with a different colour
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   747
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   748
			if (pos == 0) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   749
				DrawString(14, y, STR_4010_GENERATE_RANDOM_NEW_GAME, TC_DARK_GREEN);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   750
			} else {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   751
				DoDrawString(item->title, 14, y, _fios_colors[item->type] );
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   752
			}
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   753
			pos++;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   754
			y += NSSWND_ROWSIZE;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   755
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   756
			if (y >= this->vscroll.cap * NSSWND_ROWSIZE + NSSWND_START) break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   757
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   758
	}
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   759
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   760
	virtual void OnClick(Point pt, int widget)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   761
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   762
		if (widget != NSSW_CONNTYPE_BTN && widget != NSSW_LANGUAGE_BTN) HideDropDownMenu(this);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   763
		this->field = widget;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   764
		switch (widget) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   765
			case NSSW_CLOSE:  // Close 'X'
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   766
			case NSSW_CANCEL: // Cancel button
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   767
				ShowNetworkGameWindow();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   768
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   769
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   770
			case NSSW_GAMENAME:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   771
				ShowOnScreenKeyboard(this, NSSW_GAMENAME, 0, 0);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   772
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   773
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   774
			case NSSW_SETPWD: // Set password button
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   775
				this->widget_id = NSSW_SETPWD;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   776
				ShowQueryString(BindCString(_network_server_password), STR_NETWORK_SET_PASSWORD, 20, 250, this, CS_ALPHANUMERAL);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   777
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   778
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   779
			case NSSW_SELMAP: { // Select map
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   780
				int y = (pt.y - NSSWND_START) / NSSWND_ROWSIZE;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   781
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   782
				y += this->vscroll.pos;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   783
				if (y >= this->vscroll.count) return;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   784
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   785
				this->map = (y == 0) ? NULL : _fios_list + y - 1;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   786
				this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   787
			} break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   788
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   789
			case NSSW_CONNTYPE_BTN: // Connection type
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   790
				ShowDropDownMenu(this, _connection_types_dropdown, _network_advertise, NSSW_CONNTYPE_BTN, 0, 0); // do it for widget NSSW_CONNTYPE_BTN
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   791
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   792
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   793
			case NSSW_CLIENTS_BTND:    case NSSW_CLIENTS_BTNU:    // Click on up/down button for number of clients
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   794
			case NSSW_COMPANIES_BTND:  case NSSW_COMPANIES_BTNU:  // Click on up/down button for number of companies
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   795
			case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU: // Click on up/down button for number of spectators
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   796
				/* Don't allow too fast scrolling */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   797
				if ((this->flags4 & WF_TIMEOUT_MASK) <= 2 << WF_TIMEOUT_SHL) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   798
					this->HandleButtonClick(widget);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   799
					this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   800
					switch (widget) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   801
						default: NOT_REACHED();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   802
						case NSSW_CLIENTS_BTND: case NSSW_CLIENTS_BTNU:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   803
							_network_game_info.clients_max    = Clamp(_network_game_info.clients_max    + widget - NSSW_CLIENTS_TXT,    2, MAX_CLIENTS);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   804
							break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   805
						case NSSW_COMPANIES_BTND: case NSSW_COMPANIES_BTNU:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   806
							_network_game_info.companies_max  = Clamp(_network_game_info.companies_max  + widget - NSSW_COMPANIES_TXT,  1, MAX_PLAYERS);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   807
							break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   808
						case NSSW_SPECTATORS_BTND: case NSSW_SPECTATORS_BTNU:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   809
							_network_game_info.spectators_max = Clamp(_network_game_info.spectators_max + widget - NSSW_SPECTATORS_TXT, 0, MAX_CLIENTS);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   810
							break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   811
					}
7935
b5bc2bd79e6b (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
parents: 7859
diff changeset
   812
				}
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   813
				_left_button_clicked = false;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   814
				break;
2887
d5967e472eee (svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents: 2886
diff changeset
   815
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   816
			case NSSW_CLIENTS_TXT:    // Click on number of players
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   817
				this->widget_id = NSSW_CLIENTS_TXT;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   818
				SetDParam(0, _network_game_info.clients_max);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   819
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_CLIENTS,    3, 50, this, CS_NUMERAL);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   820
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   821
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   822
			case NSSW_COMPANIES_TXT:  // Click on number of companies
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   823
				this->widget_id = NSSW_COMPANIES_TXT;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   824
				SetDParam(0, _network_game_info.companies_max);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   825
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_COMPANIES,  3, 50, this, CS_NUMERAL);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   826
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   827
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   828
			case NSSW_SPECTATORS_TXT: // Click on number of spectators
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   829
				this->widget_id = NSSW_SPECTATORS_TXT;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   830
				SetDParam(0, _network_game_info.spectators_max);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   831
				ShowQueryString(STR_CONFIG_PATCHES_INT32, STR_NETWORK_NUMBER_OF_SPECTATORS, 3, 50, this, CS_NUMERAL);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   832
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   833
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   834
			case NSSW_LANGUAGE_BTN: { // Language
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   835
				uint sel = 0;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   836
				for (uint i = 0; i < lengthof(_language_dropdown) - 1; i++) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   837
					if (_language_dropdown[i] == STR_NETWORK_LANG_ANY + _network_game_info.server_lang) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   838
						sel = i;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   839
						break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   840
					}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   841
				}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   842
				ShowDropDownMenu(this, _language_dropdown, sel, NSSW_LANGUAGE_BTN, 0, 0);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   843
			} break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   844
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   845
			case NSSW_START: // Start game
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   846
				_is_network_server = true;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   847
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   848
				if (this->map == NULL) { // start random new game
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   849
					ShowGenerateLandscape();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   850
				} else { // load a scenario
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   851
					char *name = FiosBrowseTo(this->map);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   852
					if (name != NULL) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   853
						SetFiosType(this->map->type);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   854
						_file_to_saveload.filetype = FT_SCENARIO;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   855
						ttd_strlcpy(_file_to_saveload.name, name, sizeof(_file_to_saveload.name));
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   856
						ttd_strlcpy(_file_to_saveload.title, this->map->title, sizeof(_file_to_saveload.title));
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   857
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   858
						delete this;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   859
						SwitchMode(SM_START_SCENARIO);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   860
					}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   861
				}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   862
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   863
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   864
			case NSSW_LOAD: // Load game
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   865
				_is_network_server = true;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   866
				/* XXX - WC_NETWORK_WINDOW (this window) should stay, but if it stays, it gets
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   867
				* copied all the elements of 'load game' and upon closing that, it segfaults */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   868
				delete this;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   869
				ShowSaveLoadDialog(SLD_LOAD_GAME);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   870
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   871
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   872
	}
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   873
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   874
	virtual void OnDropdownSelect(int widget, int index)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   875
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   876
		switch (widget) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   877
			case NSSW_CONNTYPE_BTN:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   878
				_network_advertise = (index != 0);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   879
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   880
			case NSSW_LANGUAGE_BTN:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   881
				_network_game_info.server_lang = _language_dropdown[index] - STR_NETWORK_LANG_ANY;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   882
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   883
			default:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   884
				NOT_REACHED();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   885
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   886
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   887
		this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   888
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   889
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   890
	virtual void OnMouseLoop()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   891
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   892
		if (this->field == NSSW_GAMENAME) this->HandleEditBox(NSSW_GAMENAME);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   893
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   894
10607
1ab30cead125 (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
parents: 10596
diff changeset
   895
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   896
	{
10607
1ab30cead125 (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
parents: 10596
diff changeset
   897
		EventState state = ES_NOT_HANDLED;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   898
		if (this->field == NSSW_GAMENAME) {
10607
1ab30cead125 (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
parents: 10596
diff changeset
   899
			if (this->HandleEditBoxKey(NSSW_GAMENAME, key, keycode, state) == 1) return state; // enter pressed
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   900
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   901
			ttd_strlcpy(_network_server_name, this->text.buf, sizeof(_network_server_name));
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   902
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   903
10607
1ab30cead125 (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
parents: 10596
diff changeset
   904
		return state;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   905
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   906
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   907
	virtual void OnQueryTextFinished(char *str)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   908
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   909
		if (str == NULL) return;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   910
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   911
		if (this->widget_id == NSSW_SETPWD) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   912
			ttd_strlcpy(_network_server_password, str, lengthof(_network_server_password));
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   913
			_network_game_info.use_password = !StrEmpty(_network_server_password);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   914
		} else {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   915
			int32 value = atoi(str);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   916
			this->InvalidateWidget(this->widget_id);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   917
			switch (this->widget_id) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   918
				default: NOT_REACHED();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   919
				case NSSW_CLIENTS_TXT:    _network_game_info.clients_max    = Clamp(value, 2, MAX_CLIENTS); break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   920
				case NSSW_COMPANIES_TXT:  _network_game_info.companies_max  = Clamp(value, 1, MAX_PLAYERS); break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   921
				case NSSW_SPECTATORS_TXT: _network_game_info.spectators_max = Clamp(value, 0, MAX_CLIENTS); break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   922
			}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   923
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   924
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   925
		this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   926
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   927
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   928
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   929
static const Widget _network_start_server_window_widgets[] = {
8455
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   930
/* Window decoration and background panel */
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   931
{   WWT_CLOSEBOX,   RESIZE_NONE,   BGC,     0,    10,     0,    13, STR_00C5,                           STR_018B_CLOSE_WINDOW },               // NSSW_CLOSE
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   932
{    WWT_CAPTION,   RESIZE_NONE,   BGC,    11,   419,     0,    13, STR_NETWORK_START_GAME_WINDOW,      STR_NULL},
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   933
{      WWT_PANEL,   RESIZE_NONE,   BGC,     0,   419,    14,   243, 0x0,                                STR_NULL},
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
   934
8455
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   935
/* Set game name and password widgets */
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   936
{       WWT_TEXT,   RESIZE_NONE,   BGC,    10,    90,    22,    34, STR_NETWORK_NEW_GAME_NAME,          STR_NULL},
9233
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 9224
diff changeset
   937
{    WWT_EDITBOX,   RESIZE_NONE,   BGC,   100,   272,    22,    33, STR_NETWORK_NEW_GAME_NAME_OSKTITLE, STR_NETWORK_NEW_GAME_NAME_TIP},        // NSSW_GAMENAME
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   938
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,   285,   405,    22,    33, STR_NETWORK_SET_PASSWORD,           STR_NETWORK_PASSWORD_TIP},             // NSSW_SETPWD
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
   939
8455
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   940
/* List of playable scenarios */
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   941
{       WWT_TEXT,   RESIZE_NONE,   BGC,    10,   110,    43,    55, STR_NETWORK_SELECT_MAP,             STR_NULL},
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   942
{      WWT_INSET,   RESIZE_NONE,   BGC,    10,   271,    62,   216, STR_NULL,                           STR_NETWORK_SELECT_MAP_TIP},           // NSSW_SELMAP
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   943
{  WWT_SCROLLBAR,   RESIZE_NONE,   BGC,   259,   270,    63,   215, 0x0,                                STR_0190_SCROLL_BAR_SCROLLS_LIST},
8455
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   944
7935
b5bc2bd79e6b (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
parents: 7859
diff changeset
   945
/* Combo/selection boxes to control Connection Type / Max Clients / Max Companies / Max Observers / Language */
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   946
{       WWT_TEXT,   RESIZE_NONE,   BGC,   280,   419,    63,    75, STR_NETWORK_CONNECTION,             STR_NULL},
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   947
{ WWT_DROPDOWNIN,   RESIZE_NONE,   BGC,   280,   410,    77,    88, STR_NETWORK_LAN_INTERNET_COMBO,     STR_NETWORK_CONNECTION_TIP},           // NSSW_CONNTYPE_BTN
7935
b5bc2bd79e6b (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
parents: 7859
diff changeset
   948
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   949
{       WWT_TEXT,   RESIZE_NONE,   BGC,   280,   419,    95,   107, STR_NETWORK_NUMBER_OF_CLIENTS,      STR_NULL},
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   950
{     WWT_IMGBTN,   RESIZE_NONE,   BGC,   280,   291,   109,   120, SPR_ARROW_DOWN,                     STR_NETWORK_NUMBER_OF_CLIENTS_TIP},    // NSSW_CLIENTS_BTND
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   951
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BGC,   292,   397,   109,   120, STR_NETWORK_CLIENTS_SELECT,         STR_NETWORK_NUMBER_OF_CLIENTS_TIP},    // NSSW_CLIENTS_TXT
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   952
{     WWT_IMGBTN,   RESIZE_NONE,   BGC,   398,   410,   109,   120, SPR_ARROW_UP,                       STR_NETWORK_NUMBER_OF_CLIENTS_TIP},    // NSSW_CLIENTS_BTNU
8455
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   953
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   954
{       WWT_TEXT,   RESIZE_NONE,   BGC,   280,   419,   127,   139, STR_NETWORK_NUMBER_OF_COMPANIES,    STR_NULL},
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   955
{     WWT_IMGBTN,   RESIZE_NONE,   BGC,   280,   291,   141,   152, SPR_ARROW_DOWN,                     STR_NETWORK_NUMBER_OF_COMPANIES_TIP},  // NSSW_COMPANIES_BTND
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   956
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BGC,   292,   397,   141,   152, STR_NETWORK_COMPANIES_SELECT,       STR_NETWORK_NUMBER_OF_COMPANIES_TIP},  // NSSW_COMPANIES_TXT
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   957
{     WWT_IMGBTN,   RESIZE_NONE,   BGC,   398,   410,   141,   152, SPR_ARROW_UP,                       STR_NETWORK_NUMBER_OF_COMPANIES_TIP},  // NSSW_COMPANIES_BTNU
8455
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   958
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   959
{       WWT_TEXT,   RESIZE_NONE,   BGC,   280,   419,   159,   171, STR_NETWORK_NUMBER_OF_SPECTATORS,   STR_NULL},
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   960
{     WWT_IMGBTN,   RESIZE_NONE,   BGC,   280,   291,   173,   184, SPR_ARROW_DOWN,                     STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_BTND
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   961
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BGC,   292,   397,   173,   184, STR_NETWORK_SPECTATORS_SELECT,      STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_TXT
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   962
{     WWT_IMGBTN,   RESIZE_NONE,   BGC,   398,   410,   173,   184, SPR_ARROW_UP,                       STR_NETWORK_NUMBER_OF_SPECTATORS_TIP}, // NSSW_SPECTATORS_BTNU
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   963
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   964
{       WWT_TEXT,   RESIZE_NONE,   BGC,   280,   419,   191,   203, STR_NETWORK_LANGUAGE_SPOKEN,        STR_NULL},
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   965
{ WWT_DROPDOWNIN,   RESIZE_NONE,   BGC,   280,   410,   205,   216, STR_NETWORK_LANGUAGE_COMBO,         STR_NETWORK_LANGUAGE_TIP},             // NSSW_LANGUAGE_BTN
8455
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   966
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   967
/* Buttons Start / Load / Cancel */
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   968
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,    40,   140,   224,   235, STR_NETWORK_START_GAME,             STR_NETWORK_START_GAME_TIP},           // NSSW_START
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   969
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,   150,   250,   224,   235, STR_NETWORK_LOAD_GAME,              STR_NETWORK_LOAD_GAME_TIP},            // NSSW_LOAD
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   970
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,   260,   360,   224,   235, STR_012E_CANCEL,                    STR_NULL},                             // NSSW_CANCEL
8455
218ce4bc9b23 (svn r11515) -Codechange: cleanup of NetworkStartServerWindow in network_gui.cpp
smatz
parents: 8427
diff changeset
   971
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 175
diff changeset
   972
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   973
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   974
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   975
static const WindowDesc _network_start_server_window_desc = {
7837
65d7362153a6 (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7817
diff changeset
   976
	WDP_CENTER, WDP_CENTER, 420, 244, 420, 244,
6144
5a0ffbf27ced (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5920
diff changeset
   977
	WC_NETWORK_WINDOW, WC_NONE,
2064
c889fcc76398 (svn r2573) Codechange: Removed WDF_RESTORE_DPARAM, it's not needed with the new string system.
ludde
parents: 2055
diff changeset
   978
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   979
	_network_start_server_window_widgets,
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   980
	NULL,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   981
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   982
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6167
diff changeset
   983
static void ShowNetworkStartServerWindow()
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   984
{
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   985
	DeleteWindowById(WC_NETWORK_WINDOW, 0);
193
0a7025304867 (svn r194) -Codechange: stripping trailing-spaces. Please keep this that way!
truelight
parents: 176
diff changeset
   986
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
   987
	new NetworkStartServerWindow(&_network_start_server_window_desc);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   988
}
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
   989
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5835
diff changeset
   990
static PlayerID NetworkLobbyFindCompanyIndex(byte pos)
734
018e549265ed (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
   991
{
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   992
	/* Scroll through all _network_player_info and get the 'pos' item that is not empty */
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
   993
	for (PlayerID i = PLAYER_FIRST; i < MAX_PLAYERS; i++) {
734
018e549265ed (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
   994
		if (_network_player_info[i].company_name[0] != '\0') {
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
   995
			if (pos-- == 0) return i;
734
018e549265ed (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
   996
		}
018e549265ed (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
   997
	}
018e549265ed (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
   998
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5835
diff changeset
   999
	return PLAYER_FIRST;
734
018e549265ed (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
  1000
}
018e549265ed (svn r1186) -Fix: [Network] You can now join a company on a server where a company
truelight
parents: 722
diff changeset
  1001
8459
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1002
/** Enum for NetworkLobbyWindow, referring to _network_lobby_window_widgets */
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1003
enum NetworkLobbyWindowWidgets {
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1004
	NLWW_CLOSE    =  0, ///< Close 'X' button
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1005
	NLWW_MATRIX   =  5, ///< List of companies
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1006
	NLWW_DETAILS  =  7, ///< Company details
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1007
	NLWW_JOIN     =  8, ///< 'Join company' button
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1008
	NLWW_NEW      =  9, ///< 'New company' button
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1009
	NLWW_SPECTATE = 10, ///< 'Spectate game' button
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1010
	NLWW_REFRESH  = 11, ///< 'Refresh server' button
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1011
	NLWW_CANCEL   = 12, ///< 'Cancel' button
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1012
};
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1013
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1014
struct NetworkLobbyWindow : public Window {
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1015
	PlayerID company;        ///< Select company
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1016
	NetworkGameList *server; ///< Selected server
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1017
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1018
	NetworkLobbyWindow(const WindowDesc *desc, NetworkGameList *ngl) :
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1019
			Window(desc), company(INVALID_PLAYER), server(ngl)
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1020
	{
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1021
		this->vscroll.cap = 10;
10498
f198d0a1aab7 (svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium
parents: 10497
diff changeset
  1022
f198d0a1aab7 (svn r13041) -Fix: calling a virtual function on a not fully constructed object is bound to cause errors.
rubidium
parents: 10497
diff changeset
  1023
		this->FindWindowPlacementAndResize(desc);
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1024
	}
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1025
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1026
	virtual void OnPaint()
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1027
	{
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1028
		const NetworkGameInfo *gi = &this->server->info;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1029
		int y = NET_PRC__OFFSET_TOP_WIDGET_COMPANY, pos;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1030
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1031
		/* Join button is disabled when no company is selected */
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1032
		this->SetWidgetDisabledState(NLWW_JOIN, this->company == INVALID_PLAYER);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1033
		/* Cannot start new company if there are too many */
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1034
		this->SetWidgetDisabledState(NLWW_NEW, gi->companies_on >= gi->companies_max);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1035
		/* Cannot spectate if there are too many spectators */
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1036
		this->SetWidgetDisabledState(NLWW_SPECTATE, gi->spectators_on >= gi->spectators_max);
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1037
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1038
		/* Draw window widgets */
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1039
		SetDParamStr(0, gi->server_name);
10595
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
  1040
		this->DrawWidgets();
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1041
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1042
		/* Draw company list */
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1043
		pos = this->vscroll.pos;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1044
		while (pos < gi->companies_on) {
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1045
			byte company = NetworkLobbyFindCompanyIndex(pos);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1046
			bool income = false;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1047
			if (this->company == company) {
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1048
				GfxFillRect(11, y - 1, 154, y + 10, 10); // show highlighted item with a different colour
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1049
			}
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1050
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1051
			DoDrawStringTruncated(_network_player_info[company].company_name, 13, y, TC_BLACK, 135 - 13);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1052
			if (_network_player_info[company].use_password != 0) DrawSprite(SPR_LOCK, PAL_NONE, 135, y);
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1053
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1054
			/* If the company's income was positive puts a green dot else a red dot */
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1055
			if (_network_player_info[company].income >= 0) income = true;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1056
			DrawSprite(SPR_BLOT, income ? PALETTE_TO_GREEN : PALETTE_TO_RED, 145, y);
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1057
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1058
			pos++;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1059
			y += NET_PRC__SIZE_OF_ROW;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1060
			if (pos >= this->vscroll.cap) break;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1061
		}
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1062
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1063
		/* Draw info about selected company when it is selected in the left window */
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1064
		GfxFillRect(174, 39, 403, 75, 157);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1065
		DrawStringCentered(290, 50, STR_NETWORK_COMPANY_INFO, TC_FROMSTRING);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1066
		if (this->company != INVALID_PLAYER) {
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1067
			const uint x = 183;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1068
			const uint trunc_width = this->widget[NLWW_DETAILS].right - x;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1069
			y = 80;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1070
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1071
			SetDParam(0, gi->clients_on);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1072
			SetDParam(1, gi->clients_max);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1073
			SetDParam(2, gi->companies_on);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1074
			SetDParam(3, gi->companies_max);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1075
			DrawString(x, y, STR_NETWORK_CLIENTS, TC_GOLD);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1076
			y += 10;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1077
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1078
			SetDParamStr(0, _network_player_info[this->company].company_name);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1079
			DrawStringTruncated(x, y, STR_NETWORK_COMPANY_NAME, TC_GOLD, trunc_width);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1080
			y += 10;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1081
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1082
			SetDParam(0, _network_player_info[this->company].inaugurated_year);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1083
			DrawString(x, y, STR_NETWORK_INAUGURATION_YEAR, TC_GOLD); // inauguration year
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1084
			y += 10;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1085
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1086
			SetDParam(0, _network_player_info[this->company].company_value);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1087
			DrawString(x, y, STR_NETWORK_VALUE, TC_GOLD); // company value
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1088
			y += 10;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1089
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1090
			SetDParam(0, _network_player_info[this->company].money);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1091
			DrawString(x, y, STR_NETWORK_CURRENT_BALANCE, TC_GOLD); // current balance
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1092
			y += 10;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1093
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1094
			SetDParam(0, _network_player_info[this->company].income);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1095
			DrawString(x, y, STR_NETWORK_LAST_YEARS_INCOME, TC_GOLD); // last year's income
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1096
			y += 10;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1097
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1098
			SetDParam(0, _network_player_info[this->company].performance);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1099
			DrawString(x, y, STR_NETWORK_PERFORMANCE, TC_GOLD); // performance
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1100
			y += 10;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1101
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1102
			SetDParam(0, _network_player_info[this->company].num_vehicle[0]);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1103
			SetDParam(1, _network_player_info[this->company].num_vehicle[1]);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1104
			SetDParam(2, _network_player_info[this->company].num_vehicle[2]);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1105
			SetDParam(3, _network_player_info[this->company].num_vehicle[3]);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1106
			SetDParam(4, _network_player_info[this->company].num_vehicle[4]);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1107
			DrawString(x, y, STR_NETWORK_VEHICLES, TC_GOLD); // vehicles
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1108
			y += 10;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1109
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1110
			SetDParam(0, _network_player_info[this->company].num_station[0]);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1111
			SetDParam(1, _network_player_info[this->company].num_station[1]);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1112
			SetDParam(2, _network_player_info[this->company].num_station[2]);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1113
			SetDParam(3, _network_player_info[this->company].num_station[3]);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1114
			SetDParam(4, _network_player_info[this->company].num_station[4]);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1115
			DrawString(x, y, STR_NETWORK_STATIONS, TC_GOLD); // stations
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1116
			y += 10;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1117
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1118
			SetDParamStr(0, _network_player_info[this->company].players);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1119
			DrawStringTruncated(x, y, STR_NETWORK_PLAYERS, TC_GOLD, trunc_width); // players
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1120
		}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1121
	}
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1122
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1123
	virtual void OnClick(Point pt, int widget)
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1124
	{
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1125
		switch (widget) {
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1126
			case NLWW_CLOSE:    // Close 'X'
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1127
			case NLWW_CANCEL:   // Cancel button
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1128
				ShowNetworkGameWindow();
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1129
				break;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1130
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1131
			case NLWW_MATRIX: { // Company list
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1132
				uint32 id_v = (pt.y - NET_PRC__OFFSET_TOP_WIDGET_COMPANY) / NET_PRC__SIZE_OF_ROW;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1133
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1134
				if (id_v >= this->vscroll.cap) break;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1135
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1136
				id_v += this->vscroll.pos;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1137
				this->company = (id_v >= this->server->info.companies_on) ? INVALID_PLAYER : NetworkLobbyFindCompanyIndex(id_v);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1138
				this->SetDirty();
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1139
			} break;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1140
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1141
			case NLWW_JOIN:     // Join company
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1142
				/* Button can be clicked only when it is enabled */
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1143
				_network_playas = this->company;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1144
				NetworkClientConnectGame(_network_last_host, _network_last_port);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1145
				break;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1146
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1147
			case NLWW_NEW:      // New company
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1148
				_network_playas = PLAYER_NEW_COMPANY;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1149
				NetworkClientConnectGame(_network_last_host, _network_last_port);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1150
				break;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1151
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1152
			case NLWW_SPECTATE: // Spectate game
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1153
				_network_playas = PLAYER_SPECTATOR;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1154
				NetworkClientConnectGame(_network_last_host, _network_last_port);
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1155
				break;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1156
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1157
			case NLWW_REFRESH:  // Refresh
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1158
				NetworkTCPQueryServer(_network_last_host, _network_last_port); // company info
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1159
				NetworkUDPQueryServer(_network_last_host, _network_last_port); // general data
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1160
				break;
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1161
		}
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1162
	}
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1163
};
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1164
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1165
static const Widget _network_lobby_window_widgets[] = {
8459
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1166
{   WWT_CLOSEBOX,   RESIZE_NONE,   BGC,     0,    10,     0,    13, STR_00C5,                    STR_018B_CLOSE_WINDOW },           // NLWW_CLOSE
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1167
{    WWT_CAPTION,   RESIZE_NONE,   BGC,    11,   419,     0,    13, STR_NETWORK_GAME_LOBBY,      STR_NULL},
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1168
{      WWT_PANEL,   RESIZE_NONE,   BGC,     0,   419,    14,   234, 0x0,                         STR_NULL},
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1169
{       WWT_TEXT,   RESIZE_NONE,   BGC,    10,   419,    22,    34, STR_NETWORK_PREPARE_TO_JOIN, STR_NULL},
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1170
8459
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1171
/* company list */
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1172
{      WWT_PANEL,   RESIZE_NONE,   BTC,    10,   155,    38,    49, 0x0,                         STR_NULL},
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1173
{     WWT_MATRIX,   RESIZE_NONE,   BGC,    10,   155,    50,   190, (10 << 8) + 1,               STR_NETWORK_COMPANY_LIST_TIP},     // NLWW_MATRIX
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1174
{  WWT_SCROLLBAR,   RESIZE_NONE,   BGC,   156,   167,    38,   190, 0x0,                         STR_0190_SCROLL_BAR_SCROLLS_LIST},
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1175
8459
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1176
/* company/player info */
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1177
{      WWT_PANEL,   RESIZE_NONE,   BGC,   173,   404,    38,   190, 0x0,                         STR_NULL},                         // NLWW_DETAILS
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1178
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1179
/* buttons */
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1180
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,    10,   151,   200,   211, STR_NETWORK_JOIN_COMPANY,    STR_NETWORK_JOIN_COMPANY_TIP},     // NLWW_JOIN
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1181
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,    10,   151,   215,   226, STR_NETWORK_NEW_COMPANY,     STR_NETWORK_NEW_COMPANY_TIP},      // NLWW_NEW
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1182
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,   158,   268,   200,   211, STR_NETWORK_SPECTATE_GAME,   STR_NETWORK_SPECTATE_GAME_TIP},    // NLWW_SPECTATE
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1183
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,   158,   268,   215,   226, STR_NETWORK_REFRESH,         STR_NETWORK_REFRESH_TIP},          // NLWW_REFRESH
fc93bfaeca2e (svn r11519) -Codechange: enumerization and cleanup of NetworkLobbyWindow in network_gui.cpp
smatz
parents: 8457
diff changeset
  1184
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,   278,   388,   200,   211, STR_012E_CANCEL,             STR_NULL},                         // NLWW_CANCEL
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1185
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1186
{   WIDGETS_END},
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1187
};
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1188
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1189
static const WindowDesc _network_lobby_window_desc = {
7837
65d7362153a6 (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7817
diff changeset
  1190
	WDP_CENTER, WDP_CENTER, 420, 235, 420, 235,
6144
5a0ffbf27ced (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5920
diff changeset
  1191
	WC_NETWORK_WINDOW, WC_NONE,
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1192
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS,
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1193
	_network_lobby_window_widgets,
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1194
	NULL,
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1195
};
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1196
2888
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
  1197
/* Show the networklobbywindow with the selected server
0972346d11a8 (svn r3441) - Feature: Allow the network game list to be sorted (by name/clients/compatibility ascending/descending)
Darkvater
parents: 2887
diff changeset
  1198
 * @param ngl Selected game pointer which is passed to the new window */
2887
d5967e472eee (svn r3439) - CodeChange: Remove a whole bunch of global variables and put them into the WP() macro. Also combine more than one WP-custom element. For this the maximum size of w->custom (WP) has been increased, and multiple types put inside one with possibly moved to the corresponding gui file if it is only used there.
Darkvater
parents: 2886
diff changeset
  1199
static void ShowNetworkLobbyWindow(NetworkGameList *ngl)
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1200
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1201
	DeleteWindowById(WC_NETWORK_WINDOW, 0);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1202
6167
1475cf991e66 (svn r8543) -Codechange: make a real difference between querying the server via UDP and TCP.
rubidium
parents: 6144
diff changeset
  1203
	NetworkTCPQueryServer(_network_last_host, _network_last_port); // company info
1475cf991e66 (svn r8543) -Codechange: make a real difference between querying the server via UDP and TCP.
rubidium
parents: 6144
diff changeset
  1204
	NetworkUDPQueryServer(_network_last_host, _network_last_port); // general data
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1205
10497
9ab9ea3ec4d1 (svn r13040) -Codechange: make a class of the NetworkLobbyWindow.
rubidium
parents: 10485
diff changeset
  1206
	new NetworkLobbyWindow(&_network_lobby_window_desc, ngl);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1207
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1208
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1209
// The window below gives information about the connected clients
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1210
//  and also makes able to give money to them, kick them (if server)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1211
//  and stuff like that.
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1212
3692
01468bf49e8b (svn r4623) - Codechange: s/byte/PlayerID/
Darkvater
parents: 3470
diff changeset
  1213
extern void DrawPlayerIcon(PlayerID pid, int x, int y);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1214
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1215
// Every action must be of this form
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1216
typedef void ClientList_Action_Proc(byte client_no);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1217
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1218
// Max 10 actions per client
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1219
#define MAX_CLIENTLIST_ACTION 10
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1220
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1221
enum {
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1222
	CLNWND_OFFSET = 16,
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1223
	CLNWND_ROWSIZE = 10
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1224
};
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1225
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
  1226
static const Widget _client_list_widgets[] = {
2725
5c632bc5be28 (svn r3270) Correct all (mis)uses of WWT_CLOSEBOX / WWT_TEXTBTN to reflect their actual use, and add "Close Window" tooltip where missing.
peter1138
parents: 2669
diff changeset
  1227
{   WWT_CLOSEBOX,   RESIZE_NONE,    14,     0,    10,     0,    13, STR_00C5,                 STR_018B_CLOSE_WINDOW},
7525
d0e21b315b60 (svn r10293) -Add [FS#885]: a sticky button for the client list window (oxygene)
truelight
parents: 7498
diff changeset
  1228
{    WWT_CAPTION,   RESIZE_NONE,    14,    11,   237,     0,    13, STR_NETWORK_CLIENT_LIST,  STR_018C_WINDOW_TITLE_DRAG_THIS},
d0e21b315b60 (svn r10293) -Add [FS#885]: a sticky button for the client list window (oxygene)
truelight
parents: 7498
diff changeset
  1229
{  WWT_STICKYBOX,   RESIZE_NONE,    14,   238,   249,     0,    13, STR_NULL,                 STR_STICKY_BUTTON},
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1230
4938
074f734a91ca (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents: 4912
diff changeset
  1231
{      WWT_PANEL,   RESIZE_NONE,    14,     0,   249,    14,    14 + CLNWND_ROWSIZE + 1, 0x0, STR_NULL},
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1232
{   WIDGETS_END},
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1233
};
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1234
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
  1235
static const Widget _client_list_popup_widgets[] = {
4344
5d0e40cd67b9 (svn r6045) -Cleanup: align all table-like structures using spaces, i.e. whitespace fixes only except for a few comments to make them uniform for the whole enum/struct.
rubidium
parents: 4329
diff changeset
  1236
{      WWT_PANEL,   RESIZE_NONE,    14,     0,   99,     0,     0,     0, STR_NULL},
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1237
{   WIDGETS_END},
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1238
};
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1239
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1240
static WindowDesc _client_list_desc = {
7837
65d7362153a6 (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7817
diff changeset
  1241
	WDP_AUTO, WDP_AUTO, 250, 1, 250, 1,
6144
5a0ffbf27ced (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5920
diff changeset
  1242
	WC_CLIENT_LIST, WC_NONE,
7525
d0e21b315b60 (svn r10293) -Add [FS#885]: a sticky button for the client list window (oxygene)
truelight
parents: 7498
diff changeset
  1243
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_STICKY_BUTTON,
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1244
	_client_list_widgets,
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1245
	NULL
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1246
};
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1247
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1248
// Finds the Xth client-info that is active
4171
3fadda3afe70 (svn r5609) CodeChange : Apply coding style
belugas
parents: 4077
diff changeset
  1249
static const NetworkClientInfo *NetworkFindClientInfo(byte client_no)
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1250
{
4171
3fadda3afe70 (svn r5609) CodeChange : Apply coding style
belugas
parents: 4077
diff changeset
  1251
	const NetworkClientInfo *ci;
2630
35249d2ded3e (svn r3172) static, const
tron
parents: 2549
diff changeset
  1252
4883
801b93ae218c (svn r6820) -Codechange: Some more const correctness, coding style.
Darkvater
parents: 4880
diff changeset
  1253
	FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1254
		if (client_no == 0) return ci;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1255
		client_no--;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1256
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1257
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1258
	return NULL;
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1259
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1260
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1261
// Here we start to define the options out of the menu
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1262
static void ClientList_Kick(byte client_no)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1263
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1264
	if (client_no < MAX_PLAYERS)
4880
0708f34e3586 (svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents: 4878
diff changeset
  1265
		SEND_COMMAND(PACKET_SERVER_ERROR)(DEREF_CLIENT(client_no), NETWORK_ERROR_KICKED);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1266
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1267
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1268
static void ClientList_Ban(byte client_no)
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1269
{
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1270
	uint32 ip = NetworkFindClientInfo(client_no)->client_ip;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1271
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1272
	for (uint i = 0; i < lengthof(_network_ban_list); i++) {
2914
04ce2485f05f (svn r3469) - Fix: plug a possible memleak with subsequential strdup's without freeing the previous value and make it possible to ban offline clients
Darkvater
parents: 2889
diff changeset
  1273
		if (_network_ban_list[i] == NULL) {
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1274
			_network_ban_list[i] = strdup(inet_ntoa(*(struct in_addr *)&ip));
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1275
			break;
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1276
		}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1277
	}
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1278
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1279
	if (client_no < MAX_PLAYERS) {
4880
0708f34e3586 (svn r6816) -Codechange: Some coding style, variable localization, const correctness.
Darkvater
parents: 4878
diff changeset
  1280
		SEND_COMMAND(PACKET_SERVER_ERROR)(DEREF_CLIENT(client_no), NETWORK_ERROR_KICKED);
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1281
	}
841
8f0a68c6f43b (svn r1322) -Add: banning system (mostly tnx to guru3)
truelight
parents: 827
diff changeset
  1282
}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1283
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1284
static void ClientList_GiveMoney(byte client_no)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1285
{
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1286
	if (NetworkFindClientInfo(client_no) != NULL) {
4878
744717de172e (svn r6814) -Codechange: For network games ci->client_playas was always p->index + 1. To
Darkvater
parents: 4861
diff changeset
  1287
		ShowNetworkGiveMoneyWindow(NetworkFindClientInfo(client_no)->client_playas);
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1288
	}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1289
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1290
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1291
static void ClientList_SpeakToClient(byte client_no)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1292
{
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1293
	if (NetworkFindClientInfo(client_no) != NULL) {
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1294
		ShowNetworkChatQueryWindow(DESTTYPE_CLIENT, NetworkFindClientInfo(client_no)->client_index);
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1295
	}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1296
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1297
4906
8a10678a62a3 (svn r6876) -Codechange: Change the naming of _PLAYER in DESTTYPE_PLAYER/NETWORK_ACTION_CHAT_PLAYER
Darkvater
parents: 4895
diff changeset
  1298
static void ClientList_SpeakToCompany(byte client_no)
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1299
{
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1300
	if (NetworkFindClientInfo(client_no) != NULL) {
4906
8a10678a62a3 (svn r6876) -Codechange: Change the naming of _PLAYER in DESTTYPE_PLAYER/NETWORK_ACTION_CHAT_PLAYER
Darkvater
parents: 4895
diff changeset
  1301
		ShowNetworkChatQueryWindow(DESTTYPE_TEAM, NetworkFindClientInfo(client_no)->client_playas);
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1302
	}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1303
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1304
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1305
static void ClientList_SpeakToAll(byte client_no)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1306
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1307
	ShowNetworkChatQueryWindow(DESTTYPE_BROADCAST, 0);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1308
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1309
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1310
static void ClientList_None(byte client_no)
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1311
{
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1312
	/* No action ;) */
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1313
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1314
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1315
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1316
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1317
struct NetworkClientListPopupWindow : Window {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1318
	int sel_index;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1319
	int client_no;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1320
	char action[MAX_CLIENTLIST_ACTION][50];
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1321
	ClientList_Action_Proc *proc[MAX_CLIENTLIST_ACTION];
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1322
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1323
	NetworkClientListPopupWindow(int x, int y, const Widget *widgets, int client_no) :
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1324
			Window(x, y, 150, 100, NULL, WC_TOOLBAR_MENU, widgets),
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1325
			sel_index(0), client_no(client_no)
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1326
	{
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1327
		/*
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1328
		 * Fill the actions this client has.
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1329
		 * Watch is, max 50 chars long!
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1330
		 */
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1331
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1332
		const NetworkClientInfo *ci = NetworkFindClientInfo(client_no);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1333
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1334
		int i = 0;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1335
		if (_network_own_client_index != ci->client_index) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1336
			GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_CLIENT, lastof(this->action[i]));
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1337
			this->proc[i++] = &ClientList_SpeakToClient;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1338
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1339
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1340
		if (IsValidPlayer(ci->client_playas) || ci->client_playas == PLAYER_SPECTATOR) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1341
			GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_COMPANY, lastof(this->action[i]));
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1342
			this->proc[i++] = &ClientList_SpeakToCompany;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1343
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1344
		GetString(this->action[i], STR_NETWORK_CLIENTLIST_SPEAK_TO_ALL, lastof(this->action[i]));
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1345
		this->proc[i++] = &ClientList_SpeakToAll;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1346
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1347
		if (_network_own_client_index != ci->client_index) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1348
			/* We are no spectator and the player we want to give money to is no spectator and money gifts are allowed */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1349
			if (IsValidPlayer(_network_playas) && IsValidPlayer(ci->client_playas) && _patches.give_money) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1350
				GetString(this->action[i], STR_NETWORK_CLIENTLIST_GIVE_MONEY, lastof(this->action[i]));
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1351
				this->proc[i++] = &ClientList_GiveMoney;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1352
			}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1353
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1354
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1355
		/* A server can kick clients (but not himself) */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1356
		if (_network_server && _network_own_client_index != ci->client_index) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1357
			GetString(this->action[i], STR_NETWORK_CLIENTLIST_KICK, lastof(this->action[i]));
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1358
			this->proc[i++] = &ClientList_Kick;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1359
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1360
			sprintf(this->action[i],"Ban"); // XXX GetString?
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1361
			this->proc[i++] = &ClientList_Ban;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1362
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1363
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1364
		if (i == 0) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1365
			GetString(this->action[i], STR_NETWORK_CLIENTLIST_NONE, lastof(this->action[i]));
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1366
			this->proc[i++] = &ClientList_None;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1367
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1368
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1369
		/* Calculate the height */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1370
		int h = ClientListPopupHeight();
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1371
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1372
		/* Allocate the popup */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1373
		this->widget[0].bottom = this->widget[0].top + h;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1374
		this->widget[0].right = this->widget[0].left + 150;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1375
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1376
		this->flags4 &= ~WF_WHITE_BORDER_MASK;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1377
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1378
		this->FindWindowPlacementAndResize(150, h + 1);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1379
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1380
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1381
	/**
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1382
	 * An action is clicked! What do we do?
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1383
	 */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1384
	void HandleClientListPopupClick(byte index)
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1385
	{
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1386
		/* A click on the Popup of the ClientList.. handle the command */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1387
		if (index < MAX_CLIENTLIST_ACTION && this->proc[index] != NULL) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1388
			this->proc[index](this->client_no);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1389
		}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1390
	}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1391
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1392
	/**
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1393
	 * Finds the amount of actions in the popup and set the height correct
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1394
	 */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1395
	uint ClientListPopupHeight()
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1396
	{
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1397
		int num = 0;
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
  1398
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1399
		// Find the amount of actions
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1400
		for (int i = 0; i < MAX_CLIENTLIST_ACTION; i++) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1401
			if (this->action[i][0] == '\0') continue;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1402
			if (this->proc[i] == NULL) continue;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1403
			num++;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1404
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1405
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1406
		num *= CLNWND_ROWSIZE;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1407
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1408
		return num + 1;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1409
	}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1410
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1411
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1412
	virtual void OnPaint()
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1413
	{
10595
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
  1414
		this->DrawWidgets();
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1415
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1416
		/* Draw the actions */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1417
		int sel = this->sel_index;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1418
		int y = 1;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1419
		for (int i = 0; i < MAX_CLIENTLIST_ACTION; i++, y += CLNWND_ROWSIZE) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1420
			if (this->action[i][0] == '\0') continue;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1421
			if (this->proc[i] == NULL) continue;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1422
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1423
			TextColour colour;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1424
			if (sel-- == 0) { // Selected item, highlight it
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1425
				GfxFillRect(1, y, 150 - 2, y + CLNWND_ROWSIZE - 1, 0);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1426
				colour = TC_WHITE;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1427
			} else {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1428
				colour = TC_BLACK;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1429
			}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1430
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1431
			DoDrawString(this->action[i], 4, y, colour);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1432
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1433
	}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1434
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1435
	virtual void OnMouseLoop()
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1436
	{
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1437
		/* We selected an action */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1438
		int index = (_cursor.pos.y - this->top) / CLNWND_ROWSIZE;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1439
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1440
		if (_left_button_down) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1441
			if (index == -1 || index == this->sel_index) return;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1442
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1443
			this->sel_index = index;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1444
			this->SetDirty();
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1445
		} else {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1446
			if (index >= 0 && _cursor.pos.y >= this->top) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1447
				HandleClientListPopupClick(index);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1448
			}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1449
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1450
			DeleteWindowById(WC_TOOLBAR_MENU, 0);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1451
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1452
	}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1453
};
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1454
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1455
/**
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1456
 * Show the popup (action list)
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1457
 */
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1458
static void PopupClientList(int client_no, int x, int y)
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1459
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1460
	DeleteWindowById(WC_TOOLBAR_MENU, 0);
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1461
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1462
	if (NetworkFindClientInfo(client_no) == NULL) return;
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1463
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1464
	new NetworkClientListPopupWindow(x, y, _client_list_popup_widgets, client_no);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1465
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1466
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1467
/**
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1468
 * Main handle for clientlist
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1469
 */
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1470
struct NetworkClientListWindow : Window
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1471
{
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1472
	byte selected_item;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1473
	byte selected_y;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1474
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1475
	NetworkClientListWindow(const WindowDesc *desc, WindowNumber window_number) :
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1476
			Window(desc, window_number),
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1477
			selected_item(0),
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1478
			selected_y(255)
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1479
	{
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1480
		this->FindWindowPlacementAndResize(desc);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1481
	}
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1482
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1483
	/**
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1484
	 * Finds the amount of clients and set the height correct
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1485
	 */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1486
	bool CheckClientListHeight()
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1487
	{
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1488
		int num = 0;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1489
		const NetworkClientInfo *ci;
9234
8123d1c8e796 (svn r12426) -Cleanup: sprinkle some coding style over a few files.
rubidium
parents: 9233
diff changeset
  1490
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1491
		/* Should be replaced with a loop through all clients */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1492
		FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1493
			num++;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1494
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1495
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1496
		num *= CLNWND_ROWSIZE;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1497
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1498
		/* If height is changed */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1499
		if (this->height != CLNWND_OFFSET + num + 1) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1500
			// XXX - magic unfortunately; (num + 2) has to be one bigger than heigh (num + 1)
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1501
			this->SetDirty();
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1502
			this->widget[3].bottom = this->widget[3].top + num + 2;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1503
			this->height = CLNWND_OFFSET + num + 1;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1504
			this->SetDirty();
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1505
			return false;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1506
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1507
		return true;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1508
	}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1509
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1510
	virtual void OnPaint()
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1511
	{
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1512
		NetworkClientInfo *ci;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1513
		int i = 0;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1514
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1515
		/* Check if we need to reset the height */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1516
		if (!this->CheckClientListHeight()) return;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1517
10595
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
  1518
		this->DrawWidgets();
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1519
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1520
		int y = CLNWND_OFFSET;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1521
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1522
		FOR_ALL_ACTIVE_CLIENT_INFOS(ci) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1523
			TextColour colour;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1524
			if (this->selected_item == i++) { // Selected item, highlight it
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1525
				GfxFillRect(1, y, 248, y + CLNWND_ROWSIZE - 1, 0);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1526
				colour = TC_WHITE;
4077
d3022f976946 (svn r5391) Miscellaneous, mostly bracing and whitespace, nothing spectacular
tron
parents: 4013
diff changeset
  1527
			} else {
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1528
				colour = TC_BLACK;
2639
8a7342eb3a78 (svn r3181) -Bracing
tron
parents: 2630
diff changeset
  1529
			}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1530
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1531
			if (ci->client_index == NETWORK_SERVER_INDEX) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1532
				DrawString(4, y, STR_NETWORK_SERVER, colour);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1533
			} else {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1534
				DrawString(4, y, STR_NETWORK_CLIENT, colour);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1535
			}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1536
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1537
			/* Filter out spectators */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1538
			if (IsValidPlayer(ci->client_playas)) DrawPlayerIcon(ci->client_playas, 64, y + 1);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1539
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1540
			DoDrawString(ci->client_name, 81, y, colour);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1541
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1542
			y += CLNWND_ROWSIZE;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1543
		}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1544
	}
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1545
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1546
	virtual void OnClick(Point pt, int widget)
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1547
	{
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1548
		/* Show the popup with option */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1549
		if (this->selected_item != 255) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1550
			PopupClientList(this->selected_item, pt.x + this->left, pt.y + this->top);
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1551
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1552
	}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1553
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1554
	virtual void OnMouseOver(Point pt, int widget)
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1555
	{
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1556
		/* -1 means we left the current window */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1557
		if (pt.y == -1) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1558
			this->selected_y = 0;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1559
			this->selected_item = 255;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1560
			this->SetDirty();
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1561
			return;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1562
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1563
		/* It did not change.. no update! */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1564
		if (pt.y == this->selected_y) return;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1565
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1566
		/* Find the new selected item (if any) */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1567
		this->selected_y = pt.y;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1568
		if (pt.y > CLNWND_OFFSET) {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1569
			this->selected_item = (pt.y - CLNWND_OFFSET) / CLNWND_ROWSIZE;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1570
		} else {
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1571
			this->selected_item = 255;
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1572
		}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1573
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1574
		/* Repaint */
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1575
		this->SetDirty();
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1576
	}
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1577
};
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1578
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6167
diff changeset
  1579
void ShowClientList()
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1580
{
10564
9d79c5088048 (svn r13108) -Codechange: make a Window subclass of the main toolbars sub menus.
rubidium
parents: 10563
diff changeset
  1581
	AllocateWindowDescFront<NetworkClientListWindow>(&_client_list_desc, 0);
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1582
}
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1583
4512
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1584
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1585
static NetworkPasswordType pw_type;
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1586
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1587
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1588
void ShowNetworkNeedPassword(NetworkPasswordType npt)
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1589
{
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1590
	StringID caption;
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1591
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1592
	pw_type = npt;
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1593
	switch (npt) {
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1594
		default: NOT_REACHED();
4774
91b96d852ba5 (svn r6688) -Fix (r6297): Wrong caption for server password query window (eg put 'break' after switch statements)
Darkvater
parents: 4719
diff changeset
  1595
		case NETWORK_GAME_PASSWORD:    caption = STR_NETWORK_NEED_GAME_PASSWORD_CAPTION; break;
91b96d852ba5 (svn r6688) -Fix (r6297): Wrong caption for server password query window (eg put 'break' after switch statements)
Darkvater
parents: 4719
diff changeset
  1596
		case NETWORK_COMPANY_PASSWORD: caption = STR_NETWORK_NEED_COMPANY_PASSWORD_CAPTION; break;
4512
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1597
	}
5682
eeddbbacd4ac (svn r7637) -Codechange: Change ShowQueryString to use a window pointer as a parent. If the
Darkvater
parents: 5352
diff changeset
  1598
	ShowQueryString(STR_EMPTY, caption, 20, 180, FindWindowById(WC_NETWORK_STATUS_WINDOW, 0), CS_ALPHANUMERAL);
4512
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1599
}
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1600
10591
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1601
struct NetworkJoinStatusWindow : Window {
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1602
	NetworkJoinStatusWindow(const WindowDesc *desc) : Window(desc)
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1603
	{
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1604
		this->parent = FindWindowById(WC_NETWORK_WINDOW, 0);
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1605
	}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1606
10591
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1607
	virtual void OnPaint()
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1608
	{
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1609
		uint8 progress; // used for progress bar
10595
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
  1610
		this->DrawWidgets();
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1611
10591
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1612
		DrawStringCentered(125, 35, STR_NETWORK_CONNECTING_1 + _network_join_status, TC_GREY);
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1613
		switch (_network_join_status) {
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1614
			case NETWORK_JOIN_STATUS_CONNECTING: case NETWORK_JOIN_STATUS_AUTHORIZING:
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1615
			case NETWORK_JOIN_STATUS_GETTING_COMPANY_INFO:
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1616
				progress = 10; // first two stages 10%
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1617
				break;
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1618
			case NETWORK_JOIN_STATUS_WAITING:
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1619
				SetDParam(0, _network_join_waiting);
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1620
				DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_WAITING, TC_GREY);
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1621
				progress = 15; // third stage is 15%
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1622
				break;
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1623
			case NETWORK_JOIN_STATUS_DOWNLOADING:
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1624
				SetDParam(0, _network_join_kbytes);
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1625
				SetDParam(1, _network_join_kbytes_total);
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1626
				DrawStringCentered(125, 46, STR_NETWORK_CONNECTING_DOWNLOADING, TC_GREY);
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1627
				/* Fallthrough */
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1628
			default: /* Waiting is 15%, so the resting receivement of map is maximum 70% */
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1629
				progress = 15 + _network_join_kbytes * (100 - 15) / _network_join_kbytes_total;
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1630
		}
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1631
10591
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1632
		/* Draw nice progress bar :) */
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1633
		DrawFrameRect(20, 18, (int)((this->width - 20) * progress / 100), 28, 10, FR_NONE);
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1634
	}
4512
7151d4ee3a0f (svn r6297) -Codechange: Disentangle the query window mess a bit: Move the network game password handling somewhere were it belongs to
tron
parents: 4491
diff changeset
  1635
10591
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1636
	virtual void OnClick(Point pt, int widget)
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1637
	{
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1638
		if (widget == 2) { //Disconnect button
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1639
			NetworkDisconnect();
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1640
			SwitchMode(SM_MENU);
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1641
			ShowNetworkGameWindow();
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1642
		}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1643
	}
10591
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1644
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1645
	virtual void OnQueryTextFinished(char *str)
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1646
	{
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1647
		if (StrEmpty(str)) {
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1648
			NetworkDisconnect();
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1649
			ShowNetworkGameWindow();
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1650
		} else {
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1651
			SEND_COMMAND(PACKET_CLIENT_PASSWORD)(pw_type, str);
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1652
		}
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1653
	}
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1654
};
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1655
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1656
static const Widget _network_join_status_window_widget[] = {
5683
dca046ba7aa3 (svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents: 5682
diff changeset
  1657
{    WWT_CAPTION,   RESIZE_NONE,    14,     0,   249,     0,    13, STR_NETWORK_CONNECTING, STR_018C_WINDOW_TITLE_DRAG_THIS},
4938
074f734a91ca (svn r6925) -Codechange: Be more strict with widget distinctions. WWT_PANEL is only plain panel,
Darkvater
parents: 4912
diff changeset
  1658
{      WWT_PANEL,   RESIZE_NONE,    14,     0,   249,    14,    84, 0x0,                    STR_NULL},
867
581154a08a78 (svn r1348) -Feature: resizable windows. Read the comment in window.h to find out
truelight
parents: 853
diff changeset
  1659
{ WWT_PUSHTXTBTN,   RESIZE_NONE,   BTC,    75,   175,    69,    80, STR_NETWORK_DISCONNECT, STR_NULL},
176
84990c4b9212 (svn r177) -Fix: padded out Widget code to solve warnings on C99 compiler (Tron)
darkvater
parents: 175
diff changeset
  1660
{   WIDGETS_END},
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1661
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1662
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1663
static const WindowDesc _network_join_status_window_desc = {
7837
65d7362153a6 (svn r10704) -Codechange: provide an infrastructure to have resizable windows that are smaller than the default window size.
rubidium
parents: 7817
diff changeset
  1664
	WDP_CENTER, WDP_CENTER, 250, 85, 250, 85,
6144
5a0ffbf27ced (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5920
diff changeset
  1665
	WC_NETWORK_STATUS_WINDOW, WC_NONE,
5683
dca046ba7aa3 (svn r7638) -Codechange: Remove special window ShowJoinStatusWindowAfterJoin and shuffle around
Darkvater
parents: 5682
diff changeset
  1666
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET | WDF_MODAL,
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1667
	_network_join_status_window_widget,
10591
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1668
	NULL,
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1669
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1670
6573
7624f942237f (svn r9050) -Codechange: Foo(void) -> Foo()
rubidium
parents: 6167
diff changeset
  1671
void ShowJoinStatusWindow()
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1672
{
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  1673
	DeleteWindowById(WC_NETWORK_STATUS_WINDOW, 0);
10591
2b1df4c61347 (svn r13135) -Codechange: make a class of the NetworkJoinStatusWindow.
rubidium
parents: 10564
diff changeset
  1674
	new NetworkJoinStatusWindow(&_network_join_status_window_desc);
670
7c58dc46609c (svn r1108) -Fix: [Network] Fixed problem around slow clients:
truelight
parents: 659
diff changeset
  1675
}
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
  1676
7027
f3d60745346d (svn r9719) -Fix: in-game private messages did not work for clients with a Client ID > 255.
rubidium
parents: 6988
diff changeset
  1677
static void SendChat(const char *buf, DestType type, int dest)
4013
a11adcc2a852 (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1678
{
7817
f24498d934ac (svn r10684) -Codechange: some more coding style related changes. Primarily moving { to a new line.
rubidium
parents: 7717
diff changeset
  1679
	if (StrEmpty(buf)) return;
4013
a11adcc2a852 (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1680
	if (!_network_server) {
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5835
diff changeset
  1681
		SEND_COMMAND(PACKET_CLIENT_CHAT)((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf);
4013
a11adcc2a852 (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1682
	} else {
5838
9c3129cb019b (svn r8038) -Merge: the cpp branch. Effort of KUDr, Celestar, glx, Smoovius, stillunknown and pv2b.
rubidium
parents: 5835
diff changeset
  1683
		NetworkServer_HandleChat((NetworkAction)(NETWORK_ACTION_CHAT + type), type, dest, buf, NETWORK_SERVER_INDEX);
4013
a11adcc2a852 (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1684
	}
a11adcc2a852 (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1685
}
a11adcc2a852 (svn r5226) Reduce the mess that sending chat messages is
tron
parents: 3860
diff changeset
  1686
4315
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1687
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1688
struct NetworkChatWindow : public QueryStringBaseWindow {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1689
	DestType dtype;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1690
	int dest;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1691
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1692
	NetworkChatWindow (const WindowDesc *desc, DestType type, int dest) : QueryStringBaseWindow(desc)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1693
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1694
		this->LowerWidget(2);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1695
		this->dtype   = type;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1696
		this->dest    = dest;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1697
		this->afilter = CS_ALPHANUMERAL;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1698
		InitializeTextBuffer(&this->text, this->edit_str_buf, lengthof(this->edit_str_buf), 0);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1699
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1700
		InvalidateWindowData(WC_NEWS_WINDOW, 0, this->height);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1701
		SetBit(_no_scroll, SCROLL_CHAT); // do not scroll the game with the arrow-keys
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1702
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1703
		_chat_tab_completion_active = false;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1704
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1705
		this->FindWindowPlacementAndResize(desc);
4315
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1706
	}
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1707
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1708
	~NetworkChatWindow ()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1709
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1710
		InvalidateWindowData(WC_NEWS_WINDOW, 0, 0);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1711
		ClrBit(_no_scroll, SCROLL_CHAT);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1712
	}
4315
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1713
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1714
	/**
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1715
	 * Find the next item of the list of things that can be auto-completed.
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1716
	 * @param item The current indexed item to return. This function can, and most
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1717
	 *     likely will, alter item, to skip empty items in the arrays.
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1718
	 * @return Returns the char that matched to the index.
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1719
	 */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1720
	const char *ChatTabCompletionNextItem(uint *item)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1721
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1722
		static char chat_tab_temp_buffer[64];
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1723
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1724
		/* First, try clients */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1725
		if (*item < MAX_CLIENT_INFO) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1726
			/* Skip inactive clients */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1727
			while (_network_client_info[*item].client_index == NETWORK_EMPTY_INDEX && *item < MAX_CLIENT_INFO) (*item)++;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1728
			if (*item < MAX_CLIENT_INFO) return _network_client_info[*item].client_name;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1729
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1730
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1731
		/* Then, try townnames */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1732
		/* Not that the following assumes all town indices are adjacent, ie no
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1733
		* towns have been deleted. */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1734
		if (*item <= (uint)MAX_CLIENT_INFO + GetMaxTownIndex()) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1735
			const Town *t;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1736
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1737
			FOR_ALL_TOWNS_FROM(t, *item - MAX_CLIENT_INFO) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1738
				/* Get the town-name via the string-system */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1739
				SetDParam(0, t->index);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1740
				GetString(chat_tab_temp_buffer, STR_TOWN, lastof(chat_tab_temp_buffer));
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1741
				return &chat_tab_temp_buffer[0];
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1742
			}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1743
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1744
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1745
		return NULL;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1746
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1747
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1748
	/**
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1749
	 * Find what text to complete. It scans for a space from the left and marks
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1750
	 *  the word right from that as to complete. It also writes a \0 at the
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1751
	 *  position of the space (if any). If nothing found, buf is returned.
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1752
	 */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1753
	static char *ChatTabCompletionFindText(char *buf)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1754
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1755
		char *p = strrchr(buf, ' ');
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1756
		if (p == NULL) return buf;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1757
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1758
		*p = '\0';
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1759
		return p + 1;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1760
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1761
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1762
	/**
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1763
	 * See if we can auto-complete the current text of the user.
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1764
	 */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1765
	void ChatTabCompletion()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1766
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1767
		static char _chat_tab_completion_buf[lengthof(this->edit_str_buf)];
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1768
		Textbuf *tb = &this->text;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1769
		size_t len, tb_len;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1770
		uint item;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1771
		char *tb_buf, *pre_buf;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1772
		const char *cur_name;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1773
		bool second_scan = false;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1774
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1775
		item = 0;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1776
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1777
		/* Copy the buffer so we can modify it without damaging the real data */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1778
		pre_buf = (_chat_tab_completion_active) ? strdup(_chat_tab_completion_buf) : strdup(tb->buf);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1779
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1780
		tb_buf  = ChatTabCompletionFindText(pre_buf);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1781
		tb_len  = strlen(tb_buf);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1782
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1783
		while ((cur_name = ChatTabCompletionNextItem(&item)) != NULL) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1784
			item++;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1785
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1786
			if (_chat_tab_completion_active) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1787
				/* We are pressing TAB again on the same name, is there an other name
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1788
				*  that starts with this? */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1789
				if (!second_scan) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1790
					size_t offset;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1791
					size_t length;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1792
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1793
					/* If we are completing at the begin of the line, skip the ': ' we added */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1794
					if (tb_buf == pre_buf) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1795
						offset = 0;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1796
						length = tb->length - 2;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1797
					} else {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1798
						/* Else, find the place we are completing at */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1799
						offset = strlen(pre_buf) + 1;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1800
						length = tb->length - offset;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1801
					}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1802
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1803
					/* Compare if we have a match */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1804
					if (strlen(cur_name) == length && strncmp(cur_name, tb->buf + offset, length) == 0) second_scan = true;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1805
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1806
					continue;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1807
				}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1808
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1809
				/* Now any match we make on _chat_tab_completion_buf after this, is perfect */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1810
			}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1811
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1812
			len = strlen(cur_name);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1813
			if (tb_len < len && strncasecmp(cur_name, tb_buf, tb_len) == 0) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1814
				/* Save the data it was before completion */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1815
				if (!second_scan) snprintf(_chat_tab_completion_buf, lengthof(_chat_tab_completion_buf), "%s", tb->buf);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1816
				_chat_tab_completion_active = true;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1817
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1818
				/* Change to the found name. Add ': ' if we are at the start of the line (pretty) */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1819
				if (pre_buf == tb_buf) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1820
					snprintf(tb->buf, lengthof(this->edit_str_buf), "%s: ", cur_name);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1821
				} else {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1822
					snprintf(tb->buf, lengthof(this->edit_str_buf), "%s %s", pre_buf, cur_name);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1823
				}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1824
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1825
				/* Update the textbuffer */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1826
				UpdateTextBufferSize(&this->text);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1827
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1828
				this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1829
				free(pre_buf);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1830
				return;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1831
			}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1832
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1833
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1834
		if (second_scan) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1835
			/* We walked all posibilities, and the user presses tab again.. revert to original text */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1836
			strcpy(tb->buf, _chat_tab_completion_buf);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1837
			_chat_tab_completion_active = false;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1838
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1839
			/* Update the textbuffer */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1840
			UpdateTextBufferSize(&this->text);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1841
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1842
			this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1843
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1844
		free(pre_buf);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1845
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1846
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1847
	virtual void OnPaint()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1848
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1849
		static const StringID chat_captions[] = {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1850
			STR_NETWORK_CHAT_ALL_CAPTION,
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1851
			STR_NETWORK_CHAT_COMPANY_CAPTION,
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1852
			STR_NETWORK_CHAT_CLIENT_CAPTION
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1853
		};
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1854
10595
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
  1855
		this->DrawWidgets();
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1856
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1857
		assert((uint)this->dtype < lengthof(chat_captions));
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1858
		DrawStringRightAligned(this->widget[2].left - 2, this->widget[2].top + 1, chat_captions[this->dtype], TC_BLACK);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1859
		this->DrawEditBox(2);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1860
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1861
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1862
	virtual void OnClick(Point pt, int widget)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1863
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1864
		switch (widget) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1865
			case 2:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1866
				ShowOnScreenKeyboard(this, 2, 0, 3);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1867
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1868
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1869
			case 3: /* Send */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1870
				SendChat(this->text.buf, this->dtype, this->dest);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1871
			/* FALLTHROUGH */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1872
			case 0: /* Cancel */ delete this; break;
4315
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1873
		}
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1874
	}
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1875
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1876
	virtual void OnMouseLoop()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1877
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1878
		this->HandleEditBox(2);
4315
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1879
	}
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1880
10607
1ab30cead125 (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
parents: 10596
diff changeset
  1881
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1882
	{
10607
1ab30cead125 (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
parents: 10596
diff changeset
  1883
		EventState state = ES_NOT_HANDLED;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1884
		if (keycode == WKC_TAB) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1885
			ChatTabCompletion();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1886
		} else {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1887
			_chat_tab_completion_active = false;
10607
1ab30cead125 (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
parents: 10596
diff changeset
  1888
			switch (this->HandleEditBoxKey(2, key, keycode, state)) {
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1889
				case 1: /* Return */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1890
					SendChat(this->text.buf, this->dtype, this->dest);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1891
				/* FALLTHROUGH */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1892
				case 2: /* Escape */ delete this; break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1893
			}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1894
		}
10607
1ab30cead125 (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
parents: 10596
diff changeset
  1895
		return state;
4315
a0fc451fad6b (svn r5968) -Feature: add auto-completion in chat-window. It completes Player-Names and
truelight
parents: 4300
diff changeset
  1896
	}
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1897
};
649
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1898
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1899
static const Widget _chat_window_widgets[] = {
9233
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 9224
diff changeset
  1900
{   WWT_CLOSEBOX, RESIZE_NONE,  14,   0,  10,  0, 13, STR_00C5,                  STR_018B_CLOSE_WINDOW},
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 9224
diff changeset
  1901
{      WWT_PANEL, RESIZE_RIGHT, 14,  11, 319,  0, 13, 0x0,                       STR_NULL}, // background
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 9224
diff changeset
  1902
{    WWT_EDITBOX, RESIZE_RIGHT, 14,  75, 257,  1, 12, STR_NETWORK_CHAT_OSKTITLE, STR_NULL}, // text box
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 9224
diff changeset
  1903
{ WWT_PUSHTXTBTN, RESIZE_LR,    14, 258, 319,  1, 12, STR_NETWORK_SEND,          STR_NULL}, // send button
649
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1904
{   WIDGETS_END},
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1905
};
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1906
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1907
static const WindowDesc _chat_window_desc = {
7859
f0d341e69326 (svn r10726) -Codechange: make it possible that the chat window is less than 640 pixels.
rubidium
parents: 7839
diff changeset
  1908
	WDP_CENTER, -26, 320, 14, 640, 14, // x, y, width, height
6144
5a0ffbf27ced (svn r8511) -Codechange: make WindowClass an enumerated value.
rubidium
parents: 5920
diff changeset
  1909
	WC_SEND_NETWORK_MSG, WC_NONE,
8515
d0401d967e99 (svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents: 8514
diff changeset
  1910
	WDF_STD_TOOLTIPS | WDF_DEF_WIDGET,
649
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1911
	_chat_window_widgets,
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1912
	NULL
649
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1913
};
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1914
7027
f3d60745346d (svn r9719) -Fix: in-game private messages did not work for clients with a Client ID > 255.
rubidium
parents: 6988
diff changeset
  1915
void ShowNetworkChatQueryWindow(DestType type, int dest)
649
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1916
{
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1917
	DeleteWindowById(WC_SEND_NETWORK_MSG, 0);
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1918
	new NetworkChatWindow (&_chat_window_desc, type, dest);
649
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1919
}
5b5f9ae5115f (svn r1082) Feature: Chat toolbar
dominik
parents: 624
diff changeset
  1920
8494
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1921
/** Enum for NetworkGameWindow, referring to _network_game_window_widgets */
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1922
enum NetworkCompanyPasswordWindowWidgets {
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1923
	NCPWW_CLOSE,                    ///< Close 'X' button
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1924
	NCPWW_CAPTION,                  ///< Caption of the whole window
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1925
	NCPWW_BACKGROUND,               ///< The background of the interface
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1926
	NCPWW_LABEL,                    ///< Label in front of the password field
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1927
	NCPWW_PASSWORD,                 ///< Input field for the password
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1928
	NCPWW_SAVE_AS_DEFAULT_PASSWORD, ///< Toggle 'button' for saving the current password as default password
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1929
	NCPWW_CANCEL,                   ///< Close the window without changing anything
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1930
	NCPWW_OK,                       ///< Safe the password etc.
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1931
};
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1932
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1933
struct NetworkCompanyPasswordWindow : public QueryStringBaseWindow {
10563
76819f7c2dc2 (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents: 10502
diff changeset
  1934
	NetworkCompanyPasswordWindow(const WindowDesc *desc, Window *parent) : QueryStringBaseWindow(desc)
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1935
	{
10563
76819f7c2dc2 (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents: 10502
diff changeset
  1936
		this->parent = parent;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1937
		this->afilter = CS_ALPHANUMERAL;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1938
		InitializeTextBuffer(&this->text, this->edit_str_buf, min(lengthof(_network_default_company_pass), lengthof(this->edit_str_buf)), 0);
8494
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1939
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1940
		this->FindWindowPlacementAndResize(desc);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1941
	}
8494
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1942
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1943
	void OnOk()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1944
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1945
		if (this->IsWidgetLowered(NCPWW_SAVE_AS_DEFAULT_PASSWORD)) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1946
			snprintf(_network_default_company_pass, lengthof(_network_default_company_pass), "%s", this->edit_str_buf);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1947
		}
8583
3c3f27c720d6 (svn r11648) -Fix [FS#1560]: the company password was not set when one pressed the enter key.
rubidium
parents: 8578
diff changeset
  1948
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1949
		/* empty password is a '*' because of console argument */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1950
		if (StrEmpty(this->edit_str_buf)) snprintf(this->edit_str_buf, lengthof(this->edit_str_buf), "*");
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1951
		char *password = this->edit_str_buf;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1952
		NetworkChangeCompanyPassword(1, &password);
8494
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  1953
	}
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1954
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1955
	virtual void OnPaint()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1956
	{
10595
7957c71b0dfe (svn r13139) -Codechange: move DrawWindowWidgets and DrawWindowViewport to the Window class and remove Window from their naming.
rubidium
parents: 10591
diff changeset
  1957
		this->DrawWidgets();
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1958
		this->DrawEditBox(4);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1959
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1960
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1961
	virtual void OnClick(Point pt, int widget)
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1962
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1963
		switch (widget) {
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1964
			case NCPWW_OK:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1965
				this->OnOk();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1966
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1967
			/* FALL THROUGH */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1968
			case NCPWW_CANCEL:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1969
				delete this;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1970
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1971
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1972
			case NCPWW_SAVE_AS_DEFAULT_PASSWORD:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1973
				this->ToggleWidgetLoweredState(NCPWW_SAVE_AS_DEFAULT_PASSWORD);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1974
				this->SetDirty();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1975
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1976
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1977
			case NCPWW_PASSWORD:
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1978
				ShowOnScreenKeyboard(this, NCPWW_PASSWORD, 2, 1);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1979
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1980
		}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1981
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1982
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1983
	virtual void OnMouseLoop()
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1984
	{
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1985
		this->HandleEditBox(4);
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1986
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1987
10607
1ab30cead125 (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
parents: 10596
diff changeset
  1988
	virtual EventState OnKeyPress(uint16 key, uint16 keycode)
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1989
	{
10607
1ab30cead125 (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
parents: 10596
diff changeset
  1990
		EventState state;
1ab30cead125 (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
parents: 10596
diff changeset
  1991
		switch (this->HandleEditBoxKey(4, key, keycode, state)) {
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1992
			case 1: // Return
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1993
				this->OnOk();
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1994
				/* FALL THROUGH */
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1995
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1996
			case 2: // Escape
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1997
				delete this;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1998
				break;
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  1999
		}
10607
1ab30cead125 (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
parents: 10596
diff changeset
  2000
		return state;
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  2001
	}
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  2002
};
8494
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2003
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2004
static const Widget _ncp_window_widgets[] = {
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2005
{   WWT_CLOSEBOX, RESIZE_NONE, 14,   0,  10,  0, 13, STR_00C5,                          STR_018B_CLOSE_WINDOW},
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2006
{    WWT_CAPTION, RESIZE_NONE, 14,  11, 299,  0, 13, STR_COMPANY_PASSWORD_CAPTION,      STR_018C_WINDOW_TITLE_DRAG_THIS},
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2007
{      WWT_PANEL, RESIZE_NONE, 14,   0, 299, 14, 50, 0x0,                               STR_NULL},
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2008
{       WWT_TEXT, RESIZE_NONE, 14,   5, 100, 19, 30, STR_COMPANY_PASSWORD,              STR_NULL},
9233
4daa9bb8dbf7 (svn r12425) -Feature [FS#1846]: On Screen Keyboard for input fields so someone without a keyboard can enter text too. Patch by Dominik.
rubidium
parents: 9224
diff changeset
  2009
{    WWT_EDITBOX, RESIZE_NONE, 14, 101, 294, 19, 30, STR_SET_COMPANY_PASSWORD,          STR_NULL},
8494
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2010
{    WWT_TEXTBTN, RESIZE_NONE, 14, 101, 294, 35, 46, STR_MAKE_DEFAULT_COMPANY_PASSWORD, STR_MAKE_DEFAULT_COMPANY_PASSWORD_TIP},
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2011
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14,   0, 149, 51, 62, STR_012E_CANCEL,                   STR_COMPANY_PASSWORD_CANCEL},
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2012
{ WWT_PUSHTXTBTN, RESIZE_NONE, 14, 150, 299, 51, 62, STR_012F_OK,                       STR_COMPANY_PASSWORD_OK},
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2013
{   WIDGETS_END},
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2014
};
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2015
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2016
static const WindowDesc _ncp_window_desc = {
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2017
	WDP_AUTO, WDP_AUTO, 300, 63, 300, 63,
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2018
	WC_COMPANY_PASSWORD_WINDOW, WC_NONE,
8515
d0401d967e99 (svn r11579) -Revert(r11578): some cases of key propagation are not handled correctly.
belugas
parents: 8514
diff changeset
  2019
	WDF_STD_TOOLTIPS | WDF_STD_BTN | WDF_DEF_WIDGET | WDF_UNCLICK_BUTTONS | WDF_STICKY_BUTTON,
8494
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2020
	_ncp_window_widgets,
10499
9c2d9bdea61a (svn r13042) -Codechange: make a class of CreateScenarioWindow, GenerateLandscapeWindow, NetworkChatWindow, NetworkCompanyPasswordWindow, NetworkGameWindow, NetworkStartServerWindow, QueryStringWindow, SaveLoadWindow. All these classes depended on the 'querystr_d' object which is now put into QueryStringBaseWindow. As a side effect this removes quite a lot of WP macro usages and a few global variables.
rubidium
parents: 10498
diff changeset
  2021
	NULL
8494
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2022
};
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2023
10563
76819f7c2dc2 (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents: 10502
diff changeset
  2024
void ShowNetworkCompanyPasswordWindow(Window *parent)
8494
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2025
{
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2026
	DeleteWindowById(WC_COMPANY_PASSWORD_WINDOW, 0);
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2027
10563
76819f7c2dc2 (svn r13107) -Codechange: make NetworkCompanyPasswordWindow and SelectPlayerFaceWindow children of PlayerCompanyWindow.
glx
parents: 10502
diff changeset
  2028
	new NetworkCompanyPasswordWindow(&_ncp_window_desc, parent);
8494
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2029
}
88f26cafc858 (svn r11556) -Feature: allow setting a default password for new companies in network games.
rubidium
parents: 8493
diff changeset
  2030
543
e3b43338096b (svn r942) -Merged branch/network back into the trunk
truelight
parents: 534
diff changeset
  2031
#endif /* ENABLE_NETWORK */